Imodel_fwrap Module

This module has functions for loading, manipulating, and saving an IMOD model from Fortran.


void imodarraylimits(int *maxpt, int *maxob)
void imodpartialmode(int *mode)
int getimod(int ibase[], int npt[], float coord[][3], int color[][2], int *npoint, int *nobject, char *fname, int fsize)
int getopenedimod(int ibase[], int npt[], float coord[][3], int color[][2], int *npoint, int *nobject)
int openimoddata(char *fname, int fsize)
void imodopenerror(char *error, int errlen)
int imodcountcontspoints(int *numContsTotal, int *maxNumConts, int *numPtsTotal, int *maxNumPts)
int getimodobjlist(int objList[], int *ninList, int ibase[], int npt[], float coord[][3], int color[][2], int *npoint, int *nobject)
int getimodobjrange(int *objStart, int *objEnd, int ibase[], int npt[], float coord[][3], int color[][2], int *npoint, int *nobject)
int getimodmesh(int *objnum, float *verts, int *index, int *limverts, int *limindex)
int getimodverts(int *objnum, float *verts, int *index, int *limverts, int *limindex, int *nverts, int *nindex)
int getimodsizes(int *ob, float *sizes, int *limsizes, int *nsizes)
int getcontpointsizes(int *ob, int *co, float *sizes, int *limsizes, int *nsizes)
int putcontpointsizes(int *ob, int *co, float *sizes, int *nsizes)
int getimodtimes(int *times)
int getimodsurfaces(int *surfs)
int getobjsurfaces(int *ob, int *sortSurfs, int *surfs)
int getcontvalue(int *ob, int *co, float *value)
int getpointvalue(int *ob, int *co, int *pt, float *value)
int putcontvalue(int *ob, int *co, float *value)
int putpointvalue(int *ob, int *co, int *pt, float *value)
int clearimodobjstore(int *ob)
int deleteimodmeshes(int *ob)
int deleteimodcont(int *ob, int *co)
int deletelistofconts(int *ob, int *contours, int *numCont)
int deleteimodpoint(int *ob, int *co, int *pt)
int addimodpoint(int *ob, int *co, float *ptOrZ, int *ifByZ, float *x, float *y, float *z)
int getobjvaluethresh(int *ob, float *thresh)
int getobjskiplowvalues(int *ob)
int findaddminmax1value(int *ob)
int putimod(int ibase[], int npt[], float coord[][3], int cindex[], int color[][2], int *npoint, int *nobject)
int writeimod(char *fname, int fsize)
int imodwriteaswimp(char *fname, int fsize)
int putimodscat(int *ob, float *verts)
int putimodmesh(float *verts)
int newimod(void)
int deleteimod(void)
int deleteiobj(void)
int getimodobjsize()
int getimodheado(float *um, float *zscale)
int getimodmaxes(int *xmax, int *ymax, int *zmax)
int getzfromminuspt5()
int getimodhead(float *um, float *zscale, float *xoffset, float *yoffset, float *zoffset, int *ifflip)
int getimodscales(float *ximscale, float *yimscale, float *zimscale)
int putimageref(float *delta, float *origin, float *tilt)
int imodhasimageref()
int getimodflags(int *flags, int *limflags)
int getmodelname(char *fname, int fsize)
int getimodobjname(int *ob, char *fname, int fsize)
int getimodclip(int *objnum, float *clip)
int putimodmaxes(int *xmax, int *ymax, int *zmax)
void putimodflag(int *objnum, int *flag)
void putimodzscale(float *zscale)
void putimodrotation(float *xrot, float *yrot, float *zrot)
int getscatsize(int *objnum, int *size)
void putscatsize(int *objnum, int *size)
void putsymtype(int *objnum, int *type)
void putsymflags(int *objnum, int *flags)
void putlinewidth(int *objnum, int *width)
int getobjcolor(int *objnum, int *red, int *green, int *blue)
void putobjcolor(int *objnum, int *red, int *green, int *blue)
void putsymsize(int *objnum, int *size)
void putvalblackwhite(int *objnum, int *black, int *white)
int putmodelname(char *fname, int fsize)
void putimodobjname(int *objnum, char *fname, int fsize)
int getimodnesting(int *ob, int *inOnly, int *level, int *inIndex, int *inCont, int *outIndex, int *outCont, int *arraySize)

void imodarraylimits(int *maxpt, int *maxob)

Sets limit on number of points and objects in calling arrays

void imodpartialmode(int *mode)

Turns on mode for returning only part of model if mode is non-zero.

int getimod(int ibase[], int npt[], float coord[][3], int color[][2], int *npoint, int *nobject, char *fname, int fsize)

Reads IMOD model from the file given by fname and transforms coordinates, leaves it in a static model structure for further actions. Returns all contour data into the given arrays unless in partial mode.
  ibase   = starting index of contours in coord array, numbered from 0
  npt     = number of points in contour
  coord   = X, Y, Z coordinates of points
  color   = On/Off flag and "color" = 256 - IMOD object number
  npoint  = Total number of points returned, or 0 in partial mode
  nobject = Total number of contours returned, or 0 in partial mode
  fsize is omitted from fortran call.

int getopenedimod(int ibase[], int npt[], float coord[][3], int color[][2], int *npoint, int *nobject)

Returns all contour data from an already opened model into the given arrays unless in partial mode.
  ibase   = starting index of contours in coord array, numbered from 0
  npt     = number of points in contour
  coord   = X, Y, Z coordinates of points
  color   = On/Off flag and "color" = 256 - IMOD object number
  npoint  = Total number of points returned, or 0 in partial mode
  nobject = Total number of contours returned, or 0 in partial mode

int openimoddata(char *fname, int fsize)

Reads in an IMOD model from a file with name fname, places it into a static model structure and transforms coordinates. Called from fortran as openimoddata(fname)

void imodopenerror(char *error, int errlen)

Returns an error string from the last error opening a model into errlen

int imodcountcontspoints(int *numContsTotal, int *maxNumConts, int *numPtsTotal, int *maxNumPts)

Returns the total number of contours in the model in numContsTotal, the maximum in any one object in maxNumConts, the total points in numPtsTotal, and the maximum in any one object in maxNumPts

int getimodobjlist(int objList[], int *ninList, int ibase[], int npt[], float coord[][3], int color[][2], int *npoint, int *nobject)

Returns contours from the given list of objects into the model arrays
  objList = List of IMOD objects to retrieve, numbered from 1
  ninList = Number of objects in list
  ibase   = starting index of contours in coord array, numbered from 0
  npt     = number of points in contour
  coord   = X, Y, Z coordinates of points
  color   = On/Off flag and "color" = 256 - IMOD object number
  npoint  = Total number of points returned
  nobject = Total number of contours returned

int getimodobjrange(int *objStart, int *objEnd, int ibase[], int npt[], float coord[][3], int color[][2], int *npoint, int *nobject)

Returns contours from the given range of objects into the model arrays
  objStart, objEnd = Starting and ending IMOD objects to retrieve, numbered from 1
  ninList = Number of objects in list
  ibase   = starting index of contours in coord array, numbered from 0
  npt     = number of points in contour
  coord   = X, Y, Z coordinates of points
  color   = On/Off flag and "color" = 256 - IMOD object number
  npoint  = Total number of points returned
  nobject = Total number of contours returned

int getimodmesh(int *objnum, float *verts, int *index, int *limverts, int *limindex)

Returns mesh data for the given object objnum.  The vertex/normal data are returned in the array verts, whose maximum size is specified by limverts, and the index data are returned in the array index, whose maximum size is specified by limindex.  The vertex coordinates are shifted to correspond to image index coordinate coordinates of the full volume.

int getimodverts(int *objnum, float *verts, int *index, int *limverts, int *limindex, int *nverts, int *nindex)

Returns mesh data with normals omitted for the given object objnum. The vertex data are returned in the array verts, whose maximum size is specified by limverts, and the index data are returned in the array index, whose maximum size is specified by limindex.  nverts and nindex are returned with the number of vertices and indexes.  The vertex coordinates are shifted to correspond to image index coordinate coordinates of the full volume.

int getimodsizes(int *ob, float *sizes, int *limsizes, int *nsizes)

Returns point sizes for the given object ob in array sizes; limsizes specifies the size of the array and the number of points is returned in nsizes.

int getcontpointsizes(int *ob, int *co, float *sizes, int *limsizes, int *nsizes)

Returns the values in the point size array for contour co of object ob into array sizes; limsizes specifies the size of the array and the number of points is returned in nsizes.  The array contains a -1 for points with the default size.  Returns no points if there is no point size array.

int putcontpointsizes(int *ob, int *co, float *sizes, int *nsizes)

Fills the point size array for contour co of object ob with the values in the array sizes; nsizes specifies the number of values in the array.

int getimodtimes(int *times)

Returns time values for all contours in all objects into array times

int getimodsurfaces(int *surfs)

Returns surface numbers for all contours in all objects into array surfs

int getobjsurfaces(int *ob, int *sortSurfs, int *surfs)

Returns surface numbers for all contours in object ob into the array surfs. If sortSurfs > 0, it analyzes a mesh to sort contours into surfaces using imodObjectSortSurf.

int getcontvalue(int *ob, int *co, float *value)

Returns the general value for contour co of object ob into value.  The return value is -8 if there is no value.

int getpointvalue(int *ob, int *co, int *pt, float *value)

Returns the general value for point pt in contour co of object ob into value.  If pt <= 0, has the same effect as getcontvalue.  The return value is -8 if there is no value.

int putcontvalue(int *ob, int *co, float *value)

Stores a general value value for contour co of object ob.

int putpointvalue(int *ob, int *co, int *pt, float *value)

Stores a general value value for point pt in contour co of object ob.  If pt is <= 0 then the effect is the same as calling putcontvalue.

int clearimodobjstore(int *ob)

Deletes the store structure for the given object ob, if any.

int deleteimodmeshes(int *ob)

Deletes the meshes stored for the given object ob, if any.

int deleteimodcont(int *ob, int *co)

Deletes contour co in object ob using imodDeleteContour, which will adjust contour numbers in an object store, if any.

int deletelistofconts(int *ob, int *contours, int *numCont)

Deletes the list of numCont contours in contours in object ob using imodDeleteListOfConts, which will adjust contour numbers in an object store, if any.  Contours are numbered from 1 as usual.

int deleteimodpoint(int *ob, int *co, int *pt)

Deletes point pt in contour co of object ob using imodPointDelete, which will adjust sizes, labels, and general storage items in the contour, if any.

int addimodpoint(int *ob, int *co, float *ptOrZ, int *ifByZ, float *x, float *y, float *z)

Adds a point with coordinates x, y, z to contour co of object ob at either an index or a Z value given in ptOrZ.  If ifByZ is 0, then ptOrZ should have the floating point value of the index at which to add the point (numbered from 1). If ifByZ is non-zero, the point will be added before the first existing point with a Z value greater than or equal to ptOrZ.  The point must be in the same scaled coordinates as in the model returned by this module.  The point is added using imodPointAdd,  which will adjust sizes, labels, and general storage items in the contour, if any.

int getobjvaluethresh(int *ob, float *thresh)

Returns the threshold value for object ob in thresh.  This value is based on the min and max contour values in the object as the value of the byte valblack as stored by imodfindbeads and findbeads3d or adjusted in beadfixer.  The return value is -8 if there is no min/max stored.

int getobjskiplowvalues(int *ob)

Returns 1 if flags are set to display values and skip ones below threshold for object ob, 0 if not, or a negative number for error.

int findaddminmax1value(int *ob)

Updates the min and max values for VALUE1 for contours and points of object ob, using istoreFindAddMinMax1.

int putimod(int ibase[], int npt[], float coord[][3], int cindex[], int color[][2], int *npoint, int *nobject)

Puts model contours from arrays back into IMOD model structure.  If partial mode is off, all existing contour data in all objects are deleted, and replaced by the points in the contours being stored.  If partial mode is on, existing contour data will be deleted only from objects included in these data (as specified by the color values); other objects will be retained.
  ibase   = starting index of contours in cindex array, numbered from 0
  npt     = number of points in contour
  coord   = X, Y, Z coordinates of points
  cindex  = index to points in coord array, numbered from 1
  color   = On/Off flag and "color" = 256 - IMOD object number
  npoint  = Total number of points
  nobject = Total number of contours

int writeimod(char *fname, int fsize)

Writes the current model structure to the file given by fname after transforming back to index coordinates.  Called from fortran as writeimod(fname).

int imodwriteaswimp(char *fname, int fsize)

Writes the current model as an ascii WIMP model file with the same library function used by 3dmod

int putimodscat(int *ob, float *verts)

Puts scattered points back into object ob from array verts.  The number of points must be the same as the number in the original object.

int putimodmesh(float *verts)

Puts vertex/normal data back into the current model object from array verts and sets the flag that normals are magnitudes.

int newimod(void)

Deletes current model and allocates a new, default model structure

int deleteimod(void)

Deletes current model and frees all memory

int deleteiobj(void)

Removes all objects from model.

int getimodobjsize()

Returns number of IMOD objects in the model, or -1 for error.

int getimodheado(float *um, float *zscale)

Returns pixel size in microns in um and Z-scale in zscale, -1 if there is no model or -13 if there is no pixel size in the model

int getimodmaxes(int *xmax, int *ymax, int *zmax)

Returns maximum X, Y, Z coordinates of image that model was loaded on

int getzfromminuspt5()

Returns 1 if the model flag is set that Z coordinates start at -0.5, or negative if there is no open model.

int getimodhead(float *um, float *zscale, float *xoffset, float *yoffset, float *zoffset, int *ifflip)

Returns header values: pixel size in microns in um, Z-scale in zscale, offsets to get from model coordinates to full volume index coordinates in xoffset, yoffset, zoffset, and ifflip nonzero if Y/Z are flipped.

int getimodscales(float *ximscale, float *yimscale, float *zimscale)

Returns the image file scale values used to get from model to index coords

int putimageref(float *delta, float *origin, float *tilt)

Sets the image reference information of the model with the delta, origin, and current tilt angle values from an MRC file header.

int imodhasimageref()

Returns 1 if a model has image reference information, 0 if it does not, or -5 for no model.

int getimodflags(int *flags, int *limflags)

Return a flag for each object in array flags; limflags specifies the maximum size of the array.  The flag is the sum of 0, 1 or 2 for closed, open or scattered point object, plus 4 if the object has a mesh.

int getmodelname(char *fname, int fsize)

Returns model name in fname; fsize is omitted in the call from fortran.

int getimodobjname(int *ob, char *fname, int fsize)

Returns name of object ob in fname; fsize is omitted in the call from fortran.

int getimodclip(int *objnum, float *clip)

Returns the clipping planes for the object objnum in the array clip. Each clipping plane is specified by 4 numbers: the normal and the dot product of normal and point, scaled by the pixel size. The return value is the number of clipping planes or negative for an error.

int putimodmaxes(int *xmax, int *ymax, int *zmax)

Sets the maximum X, Y, Z coordinates for the model

void putimodflag(int *objnum, int *flag)

Specifies a flag or value for object objnum; in external calls flag should be 0 for closed contour, 1 for open contour, 2 for scattered points, 7 to set IMOD_OBJFLAG_USE_VALUE in flags and MATFLAGS2_CONSTANT and MATFLAGS2_SKIP_LOW in matflags2, 9 to set IMOD_OBJFLAG_PNT_ON_SEC, and 10 to set IMOD_OBJFLAG_THICK_CONT.

void putimodzscale(float *zscale)

Sets the Z-scale of the model to zscale

void putimodrotation(float *xrot, float *yrot, float *zrot)

Sets the display rotation angles of the model to xrot, yrot, zrot

int getscatsize(int *objnum, int *size)

Returns the 3D point size for objnum into size

void putscatsize(int *objnum, int *size)

Sets the 3D point size for objnum to size

void putsymtype(int *objnum, int *type)

Sets the symbol type of object objnum to type

void putsymflags(int *objnum, int *flags)

Sets the symbol flags of object objnum to flags, the sumof 1 for filled symbols and 2 for marked ends.

void putlinewidth(int *objnum, int *width)

Sets the 2D line width for objnum to width

int getobjcolor(int *objnum, int *red, int *green, int *blue)

Returns the color for object objnum into red, green, blue, where values range from 0 to 255.

void putobjcolor(int *objnum, int *red, int *green, int *blue)

Sets the color for object objnum to red, green, blue, where values range from 0 to 255.

void putsymsize(int *objnum, int *size)

Sets the symbol size of object objnum to size

void putvalblackwhite(int *objnum, int *black, int *white)

Sets the valblack and valwhite members of object objnum to black and white.

int putmodelname(char *fname, int fsize)

Sets the model name to the string in fname

void putimodobjname(int *objnum, char *fname, int fsize)

Sets the name for object objnum to the string in fname

int getimodnesting(int *ob, int *inOnly, int *level, int *inIndex, int *inCont, int *outIndex, int *outCont, int *arraySize)

Returns information about nested contours for object ob. Only inside information is returned if inOnly is nonzero.
level is filled with nesting level or 0 if no inside/outside contours
inCont and outCont are filled with the inside and outside contours numbers from the nesting analysis, numered from 1
inIndex and outIndex are filled with indices into these arrays for each contour, numbered from 1
arraySize specifies limiting size of ALL arrays, but if inOnly is nonzero then outCont and outIndex are ignored and do not need to be arrays