Header to include: imodel.h
(includes ilist.h and mcrfiles.h)
Allocates a new model structure and returns a pointer to it, or NULL if there is an error. Initializes the model with imodDefault
Initializes model structure pointed to by model to default values and allocates an initial view (which will leak if this is called twice). Returns 0 (there are no errors)
Deletes a model; frees all memory used in objects, views, and object views and frees the model itself.
Returns the current object, contour, and point indexes of the model in object, contour, and point
Sets the current object, contour, and point indexes of the model with the values in object, contour, and point. Indexes are checked for legality and if one is out of bounds it is set to -1. If an index is -1, any index at a lower level is set to -1 also (e.g., point if contour is -1).
Returns the current mesh surface number for model imod if the current object is legal and has meshes but no contours, and if the stored surface number is in range for this object; otherwise returns -1.
Set the current mesh surface number for model imod to surf if the current object is legal and has meshes but no contours, and if surf is in range for this object; otherwise leaves it unchanged.
Returns the maximum coordinates of contour points in model imod in pnt, or -1,-1,-1 if there are no points
Returns the minimum coordinates of contour points in the model imod in pnt, or -1,-1,-1 if there are no points
Returns the minimum and maximum coordinates of the model imod in min and max, based either on the coordinates of points in contours, or on mesh vertices for objects with no contours. Returns -1,-1,-1 if there are no points or meshes.
Transforms all contour points in model imod with the 3D transform in mat. Returns -1 if error.
Transforms all contour points in model with Z values that round to slice. The 2D transformation in mat is applied to X and Y coordinates. Returns 0.
Cleans model mod by removing empty contours, removing empty objects if keepEmptyObjs is 0, constraining points within the model xmax, ymax, and zmax values, and making all points have the same Z value as the first point for non-wild closed contours. Returns 0.
Returns a string (e.g., "nm") for the pixel size units of model mod.
Returns the maximum time (type) value of any contour in model imod.
Computes a checksum from the coordinates and most other features of model mod and returns the value.
Fixes the surface size information for all objects in model imod by determining the maximum surface number for the contours in each object.
Flip the model imod by exchanging Y and Z in contours and meshes.
Rotates the model in imod by 90 degrees around the X axis and shifts along the appropriate axis to retain positive values. The rotation is by -90 degrees if toNative is 0, corresponding to the Y-Z flip in 3dmod, and by +90 degrees if toNative is non-zero, corresponding to flipping back to native orientation. The incoming ymax and zmax values will be swapped and must be correct for the current model coordinates.
Inverts the model in imod in the Z direction and shifts it in Z to retain positive values. The incoming model zmax value must be correct for the current model coordinates.
Sets the IrefImage structure refImage in imod with the image coordinate information in the MRC header hdata. Returns 1 for memory error allocating the structure.
Shifts the model imod back to full volume coordinates if it was saved after being loaded on a subset of the image whose header is in hdata, and also shifts it to the coordinates of a subset currently being loaded, using the xmin, ymin, and zmin elements in li, if li is not NULL.
Transforms the model in imod according to the old and current shift, scale, and rotation in the IrefImage structure iref, with the additional scaling required for binning in each dimension specified in binScale. The image reference information in the existing model IrefImage structure, if any, is not considered. Typically, if that exists, its ctrans, cscale, and crot members would be copied to the otrans, oscale and orot members of iref, and the current values in iref would be filled in from the origin, delta, and tilt angle values in an image file header. Returns 1 for memory errors.
Transforms the model in imod given three matrices: mat for transforming points, matNorm for transforming the mesh normals, and matClip for transforming clip plane normals.
Transforms model with the 3D matrix in mat, which includes translations.
normMat is a 3D matrix for normal transformations, or NULL if none are needed.
newCen are the center coordinates of the volume being transformed to; the center
coordinates for the transformation are taken from the xmax, ymax, and zmax
members of the model structure.
zscale is the Z scale factor, or 1 to not apply any Z scaling.
doflip should be nonzero if the model is in Y-Z flipped coordinates
Get the number of objects in model imod (not the maximum object index).
Get the Z scale in model imod
Get the pixel size in model imod
Get a pointer to the filename of model imod
Returns non-zero if model imod is flipped
Adds new object to end of object array in model mod. Color is automatically assigned from the collection of 35 stock colors. Returns 1 if error.
Removes the object at the given index from the model mod. All contour data is deleted and object views are deleted. The object array is packed down and reallocated or freed if there are no more objects. Returns -1 if there is an error.
Moves an object from index obOld to index obNew in the model imod. Returns 1 if memory error.
Advances from the current object to the next object in the model imod, adjusting the index of the current contour and point to stay within bounds or setting them to -1 if appropriate. Returns new object index or -1 if there is no model or objects.
Moves from the current object to the previous object in the model mod, adjusting the index of the current contour and point to stay within bounds or setting them to -1 if appropriate. Returns new object index or -1 if there is no model or objects.
Returns a pointer to the current object in model imod, or NULL if no legal object is selected.
Sets first object in model imod as current object and returns pointer to it, or NULL if error.
Advances the current object index by one in model imod and returns pointer to new current object, or NULL if error or if the existing current object is the last one in the model.
Adds a new contour to the current object of the model mod. It will inherit surface and open/closed properties from the current contour and become the new current contour. Returns -1 if error.
Deletes the current contour of the model imod.
Deletes the contour at index in the current object of the model mod, freeing all point, size, and label data, maintaining general storage lists, and reducing the size of the contour array. Sets the current contour and point index to -1 and returns the size of the current object or -1 if error.
Deletes the list of numConts contours in contours in the current object of the model mod, freeing all point, size, and label data, maintaining general storage lists, and reducing the size of the contour array. Contours are numbered from 0. Sets the current contour and point index to -1 and returns the size of the current object or -1 if error.
Moves the current contour index back by one in model mod. If there is no current contour it selects the last one in the object. Returns the current contour index or -1 for error.
Advances the current contour index forward by one in model mod. If there is no current contour it selects the first one in the object. Returns the current contour index or -1 for error.
Returns a pointer to the current contour in model imod, or NULL if there is no current contour or the contour index is not legal.
Sets the current contour index to 0 in the current object in model imod and returns pointer to first contour, or NULL if there is no contour.
Advances to the next contour in the current object of model imod and returns pointer to the contour, or NULL if there is none (error or end of object).
Adds point to the end of the current contour in model imod. Returns new number of points in contour, or 0 for an error.
Inserts point at position index into the current contour in model imod. Returns new number of points in contour, or 0 for an error.
Deletes the current point in model imod, or the current contour if it is empty. Returns size of current contour or -1 for error.
Moves the current point index back by one in model mod. Returns the new current point index or -1 if no object or contour is selected.
Advances the current point index forward by one in model mod. Returns the new current point index or -1 if no object or contour is selected.
Returns a pointer to the current point in model imod, or NULL if there is no current contour or current point.
Sets the current point index to 0 in the current contour in model imod and returns pointer to first point, or NULL if there is no current contour or point.
Advances to the next point in the current contour of model imod and returns pointer to the point , or NULL if there is none (error or end of contour).