Imodel_files Module

This module contains functions for reading and writing IMOD models.

Header to include: imodel.h


Imod *imodFileRead(const char *filename)
int imodFileWrite(Imod *imod, const char *filename)
int imodOpenFile(const char *filename, const char *mode, Imod *imod)
int imodCloseFile(Imod *imod)
int imodReadFile(Imod *imod)
Imod *imodRead(const char *filename)
int imodTestIfModelFile(const char *filename)
int imodWriteFile(Imod *imod)
int imodWrite(Imod *imod, FILE *fout)
int imodWriteSkipMesh(Imod *imod, FILE *fout, int whichSkip)
int imodReadAscii(Imod *imod)
int imodWriteAscii(Imod *imod)

Imod *imodFileRead(const char *filename)

Reads a model from file given by filename and returns created model structure or NULL for error.  (Unused, calls imodRead).

int imodFileWrite(Imod *imod, const char *filename)

Writes the model imod to the file given by filename.  Returns -1 for error, 0 for success.  (Unused 4/23/05).

int imodOpenFile(const char *filename, const char *mode, Imod *imod)

Opens the file given by filename with the given mode, sets the file pointer into imod->file and the filename into imod->filename.  Returns -1 for error or 0 for success.

int imodCloseFile(Imod *imod)

Closes the file for model imod, using file pointer in imod->file.  Returns -1 for error.

int imodReadFile(Imod *imod)

Reads model from file pointer in imod->file and places model in imod. The model should be set to default settings before calling, either by allocating with imodNew or by calling imodDefault. Returns -2 if file is not a binary or ASCII IMOD model, or -1 for other errors.

Imod *imodRead(const char *filename)

Reads a model from file given by filename and returns created model structure or NULL for error.

int imodTestIfModelFile(const char *filename)

Reads just enough of the file filename to determine if it is model file; returns 0 for a binary mode, -1 for an acsii model, 1 for error opening the file, or 2 for not a model file.

int imodWriteFile(Imod *imod)

Writes the model imod to the file pointer in imod->file.  Returns -1 for error, 0 for success.

int imodWrite(Imod *imod, FILE *fout)

Writes the model imod to the file pointer in fout.  Returns -1 for error, 0 for success.

int imodWriteSkipMesh(Imod *imod, FILE *fout, int whichSkip)

Writes the model imod to the file pointer in fout, leaving out meshes in regular contour-based objects if bit 0 of whichSkip is set and meshes in isosurface objects if bit 1 is set.  Returns -1 for error, 0 for success.

int imodReadAscii(Imod *imod)

Reads an ascii model from file point in imod->file.  This is called automatically by general model reading routines when the file is not recognized as IMOD binary format.  Returns -2 for file not an IMOD model or -1 for other errors.

int imodWriteAscii(Imod *imod)

Writes the model imod in ascii format to the file pointer in imod->file. Returns 0.