The classes ImGear3DVisualization Class, ImGear3DVisualizationVerifier Class and ImGearIsosurfaceOptions Class present a set of properties and methods for generating an isosurface for 3D objects.
The 3D algorithm works on the set of images that should comprise a 3D object, and generate an isosurface for 3D visualization. It allows the options of adding "cover-up" slices at both ends, and also limiting the surface depth to reduce the number of triangles in the isosurface. Both of these two options, along with a few others, can be passed to the algorithm through an object of type ImGearIsosurfaceOptions Class.
Usually, you need to create an object of ImGearIsosurfaceOptions Class to store the values of options to be passed to the isosurface algorithm. There is no need to explicitly instantiate any object for class ImGear3DVisualization Class, since the only public method in the ImGear3DVisualization Class, GenerateIsosurface Method, is a static method . ImGear3DVisualization Class also has a static member Verifier Property of type ImGear3DVisualizationVerifier Class that can be used to check whether an ImGearDocument Class can be used to calculate an isosurface. The user should use this Verifier Property instead of instantiating such an object.
The algorithm itself takes an ImGearDocument Class object as the data source, so there is no limitation as far as the image format is concerned. It is the user's responsibility to somehow read data from the images and store them in an ImGearDocument Class object. It is important to make sure that the slices of images in the ImGearDocument Class are in the desired order, as the order will be the same in the 3D object.
This algorithm generates an ImGearVectPage Class as a result, in which the vertices of triangles together with the normals at those vertices are included. This ImGearVectPage Class must be associated with an ImGearVectorView Class object in order to visualize it.
C# |
Copy Code |
// Declare an ImGearDocument object and load it with data.
ImGearDocument igDocument = new ImGearDocument();
// ......
// Load images into igDocument
// ......
// Call function CanApplyGenerateIsosurface() on igDocument to
// check whether it is suitable for the algorithm
if (!ImGear3DVisualization.Verifier.CanApplyGenerateIsosurface(igDocument))
{
// Show some error message regarding this fact that igDocument
// is not suitable
return;
}
// Instantiate an object of type ImGearIsosurfaceOptions for the
// options to be passed to the algorithm
ImGearIsosurfaceOptions isoOptions = new ImGearIsosurfaceOptions();
// Set the values for the members of isoOptions, usually, a
// dialog should be presented for the end user to set/modify these
// options
isoOptions.IsoValue = 120.0; // the intensity of pixels on the surface,
// this needs to be determined BEFOREHAND.
isoOptions.IsDoNorms = true;
/// .....
// Call function GenerateIsosurface to generate the isosurface
ImGearVectPage igVectPage = ImGear3DVisualization.GenerateIsosurface(igDocument, isoOptions); |