Class FileSurface_WM
java.lang.Object
gov.nih.mipav.view.renderer.WildMagic.Interface.FileSurface_WM
FileSurface. Reads and writes surface files for the JPanelSurface class. When
surface files are loaded by the user in the JPanelSurface.java class through
the "Add" button, when surfaces are loaded as surfaces attached to .xml image
files, or surfaces loaded through the FlyThruRender class. Any time a surface
file is read from disk for display in the JPanelSurface (SurfaceRender) class
the FileSurface.java class is used to provide the interface. Loaded surfaces
are returned in an array of SurfaceAttributes[] which are then used to add
the surfaces to the SurfaceRender scene graph.
This class also handles saving files from the JPanelSurface class. Surfaces are saved as surface files (.sur), single-level (.wrl), multi-level (.wrl) or XML surfaces (.xml).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static float[]image volume bounding box.private static float[]coordinate used to transform data point from image coordinate to dicom coordinateprivate javax.vecmath.Point3f[]private static booleanflag indicates to read dicom matrix or not.private static Filedicom matrix file.private static int[]image x, y, z orientation.private static booleanflag indicates to flip y, z coordinate or not.private static double[][]inverse dicom matrix array.private static TransMatrixinverset dicom matrix.private WildMagic.LibFoundation.Mathematics.Vector3f[]private static float[]image start location.private int[]private static float[]coordinate used to transform data point from image coordinate to dicom coordinate. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static WildMagic.LibGraphics.SceneGraph.VertexBufferconvertVertex(ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Convert the vertex from display space to dicom space.private static StringgetFileName(boolean bLoad) Calls a dialog to get a file name.private static WildMagic.LibGraphics.Detail.CollapseRecordload(RandomAccessFile kIn) Support for loading the collapse records from a binary file.static WildMagic.LibGraphics.Detail.ClodMeshloadCMesh(RandomAccessFile kIn, ViewJProgressBar pBar, int added, int piece) Load the clod mesh from a binary file.private static WildMagic.LibGraphics.SceneGraph.TriMeshloadGiftiXMLMesh(String absPath, String fileName, String dir) Read Gifti mesh from file.private static WildMagic.LibGraphics.SceneGraph.TriMeshloadPlyAsciiMesh(File file, ModelImage kImage, boolean isFileCoords) Read a TriMesh from a Ply ascii file.private static WildMagic.LibGraphics.SceneGraph.TriMeshloadSTLAsciiMesh(File file, ModelImage kImage) Load the STL ASCII file.private static WildMagic.LibGraphics.SceneGraph.TriMeshloadSTLBinaryMesh(File file, ModelImage kImage) Load the STL ASCII file.static WildMagic.LibGraphics.SceneGraph.TriMeshloadTMesh(RandomAccessFile kIn, ViewJProgressBar progress, int added, int total, boolean isVisible, WildMagic.LibGraphics.Rendering.MaterialState kMaterial, float[] startLocation, float[] direction, float[] box) Load the TriMesh from a binary file.static WildMagic.LibGraphics.SceneGraph.TriMeshloadVRMLMesh(RandomAccessFile kIn, ViewJProgressBar progress, int added, int total, boolean flag, float[] startLocation, float[] direction, float[] box) Load the triangle mesh from a VRML file specifically written by MIPAV.private static WildMagic.LibGraphics.SceneGraph.TriMeshloadVTKLegacyMesh(RandomAccessFile kIn, ViewJProgressBar progress, int added, int total, String fileName) Load legacy VTK mesh.private static WildMagic.LibGraphics.SceneGraph.TriMeshloadVTKXMLMesh(String absPath, String fileName, String dir) Read VTK mesh from file.private static FileopenDicomMatrixFiles(boolean bLoad) Returns a dicomMatrix file objects, based on the user-selected filed from the FileChooser dialog.static File[]openFiles(boolean bLoad) Returns an array of File objects, based on the user-selected files from the FileChooser dialog.static WildMagic.LibGraphics.SceneGraph.TriMesh[]openSurfaces(ModelImage kImage) The action taken when the Add button is clicked in the JPanelSurface class.static WildMagic.LibGraphics.SceneGraph.TriMesh[]openSurfaces(ModelImage kImage, boolean isFileCoords) The action taken when the Add button is clicked in the JPanelSurface class.static intParses the VRML to see how many surfaces there are.private static voidprintAscii(PrintWriter kOut, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Print the contents of the TriMesh in ascii format.private static voidprintProstateSTLAscii(PrintWriter kOut, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Print the contents of the TriMesh in STL ascii format.private static voidprintSTLAscii(PrintWriter kOut, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Print the contents of the TriMesh in STL ascii format.private static WildMagic.LibGraphics.SceneGraph.TriMeshRead a TriMesh from an ascii file.private voidreadFacetB(ByteBuffer in, int index) Method that reads a face in binary files All binary versions of the methods end by 'B' As in binary files we can read the number of faces, we don't need to use coordArray and normArray (reading binary files should be faster)private static StringreadLine(InputStream in) Read a line of ASCII text from the input stream.private static WildMagic.LibFoundation.Mathematics.Vector3freadPoint(StreamTokenizer tokenizer, String label) Find the given label in the tokenizer stream and then return the next three numbers as a point.private static WildMagic.LibGraphics.SceneGraph.TriMeshreadSTLAscii(StreamTokenizer tokenizer, ModelImage kImage) Read the STL ASCII file as a single stream tokenizer.private static WildMagic.LibGraphics.SceneGraph.TriMeshreadSTLBinary(FileInputStream data, ModelImage kImage) Method for reading binary files Execution is completly different It uses ByteBuffer for reading data and ByteOrder for retrieving the machine's endian (Needs JDK 1.4) TO-DO: 1.static WildMagic.LibGraphics.SceneGraph.TriMeshreadSurface(ModelImage kImage, File file, WildMagic.LibGraphics.Rendering.MaterialState kMaterial) Load a triangle mesh from the specified file and assign to it the MaterialState.static WildMagic.LibGraphics.SceneGraph.TriMeshreadSurface(ModelImage kImage, File file, WildMagic.LibGraphics.Rendering.MaterialState kMaterial, boolean isFileCoords) Load a triangle mesh from the specified file and assign to it the MaterialState.static voidsave(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iType, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer, boolean flip, int[] direction, float[] startLocation, float[] box, TransMatrix inverseDicomMatrix) Save a TriMesh to diskstatic voidsave(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, ModelImage image, boolean transform) private static voidsaveAsGiftiXML(String fileName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Save the TriMesh in Gifti format.private static voidsaveAsTextFile(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Save the TriMesh as an ascii text file.protected static voidsaveAsVRML(PrintWriter kOut, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer, boolean flip, int[] direction, float[] startLocation, float[] box) Saves the triangle mesh in VRML97 (VRML 2.0) format.private static voidsaveAsVRML(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer, boolean flip, int[] direction, float[] startLocation, float[] box) Saves the triangle mesh in VRML97 (VRML 2.0) format (text format).private static voidsaveAsVTKLegacy(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Save the TriMesh in VTK legacy format.private static voidsaveAsVTKXML(String fileName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Save the TriMesh in VTK format.static voidsaveClodMesh(String kName, WildMagic.LibGraphics.Detail.ClodMesh[] akComponent, boolean flip, int[] direction, float[] startLocation, float[] box, TransMatrix inverseDicomMatrix) Save ClodMesh to diskprivate static voidsaveCollapseRecord(RandomAccessFile kOut, WildMagic.LibGraphics.Detail.CollapseRecord kRecord) Support for saving the collapse records to a binary file.private static voidsaveProstatePlyMesh(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a STL mesh file.private static voidsaveProstateSTLMesh(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a STL ascii mesh file.static voidsaveProstateSurface(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, ModelImage keyImage) Save a TriMesh to diskprivate static voidsaveSingleMesh(ModelImage kImage, boolean isSur, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a mesh file.private static voidsaveSingleMesh(String name, ModelImage kImage, boolean isSur, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a mesh file.private static voidsaveSinglePlyMesh(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a STL mesh file.private static voidsaveSingleSTLMesh(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a STL mesh file.private static voidsaveSur(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iType, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer, boolean flip, int[] direction, float[] startLocation, float[] box, TransMatrix inverseDicomMatrix) Write the TriMesh to disk in the .sur format.static voidsaveSurfaces(ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh[] akSurfaces, String kCommand) The action taken when the one of the save surface buttons is pressed in the JPanelSurface class.private static voidwriteTriangleMeshXML(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Writes a TriMesh to disk in the xml format, based on surface.xsd.
-
Field Details
-
flip
private static boolean flipflag indicates to flip y, z coordinate or not. -
dicom
private static boolean dicomflag indicates to read dicom matrix or not. -
inverseDicomArray
private static double[][] inverseDicomArrayinverse dicom matrix array. -
inverseDicomMatrix
inverset dicom matrix. -
direction
private static int[] directionimage x, y, z orientation. -
startLocation
private static float[] startLocationimage start location. -
box
private static float[] boximage volume bounding box. -
tCoord
private static float[] tCoordcoordinate used to transform data point from image coordinate to dicom coordinate. -
coord
private static float[] coordcoordinate used to transform data point from image coordinate to dicom coordinate -
dicomMatrixFile
dicom matrix file. -
coordArray
private javax.vecmath.Point3f[] coordArray -
normArray
private WildMagic.LibFoundation.Mathematics.Vector3f[] normArray -
stripCounts
private int[] stripCounts
-
-
Constructor Details
-
FileSurface_WM
public FileSurface_WM()
-
-
Method Details
-
loadCMesh
public static WildMagic.LibGraphics.Detail.ClodMesh loadCMesh(RandomAccessFile kIn, ViewJProgressBar pBar, int added, int piece) Load the clod mesh from a binary file. The caller must have already opened the file and read the mesh type (0 = TriMesh, 1 = ModelClodMesh) and the number of meshes in the file. The caller then calls this function for each mesh. The format for a mesh isint vCount; // number of vertices Point3f vertices[vCount]; Point3f normals[vCount]; int iCount; // number of indices in the connectivity array int indices[iCount]; int rCount; ModelCollapseRecord collapses[rCount];with 4-byte quantities stored in Big Endian format.- Parameters:
kIn- the file from which the triangle mesh is loadedpBar- DOCUMENT ME!added- DOCUMENT ME!piece- DOCUMENT ME!- Returns:
- the loaded triangle mesh
- Throws:
IOException- if there is an error reading from the file
-
loadTMesh
public static WildMagic.LibGraphics.SceneGraph.TriMesh loadTMesh(RandomAccessFile kIn, ViewJProgressBar progress, int added, int total, boolean isVisible, WildMagic.LibGraphics.Rendering.MaterialState kMaterial, float[] startLocation, float[] direction, float[] box) Load the TriMesh from a binary file. The caller must have already opened the file and read the mesh type (0 = TriMesh, 1 = ClodMesh) and the number of meshes in the file. The caller then calls this function for each mesh. The format for a mesh isint vCount; // number of vertices Point3f vertices[vCount]; Point3f normals[vCount]; int iCount; // number of indices in the connectivity array int indices[iCount];
- Parameters:
kIn- file containing TriMesh dataprogress- progress baradded- number of meshes added so fartotal- total number of meshes to addisVisible- sets the visibility of the progress barkMaterial- MaterialState for the new meshstartLocation- 3D location of the meshdirection- 3D orientation of the meshbox- mesh bounding box- Returns:
- new TriMesh
-
loadVRMLMesh
public static WildMagic.LibGraphics.SceneGraph.TriMesh loadVRMLMesh(RandomAccessFile kIn, ViewJProgressBar progress, int added, int total, boolean flag, float[] startLocation, float[] direction, float[] box) Load the triangle mesh from a VRML file specifically written by MIPAV. The caller must have already opened the file.- Parameters:
kIn- the file from which the triangle mesh is loadedprogress- progress baradded- number of meshes added so fartotal- number of meshes to addflag- when true this is the first mesh, read header info.startLocation- 3D location of meshdirection- 3D orientation of meshbox- mesh bounding box- Returns:
- new TriMesh
-
openSurfaces
The action taken when the Add button is clicked in the JPanelSurface class. A file dialog is launched that allows the user to select new surfaces to load from disk.- Parameters:
kImage- ModelImage for location/orientation and scale information.- Returns:
- array of TriMesh objects.
-
openSurfaces
public static WildMagic.LibGraphics.SceneGraph.TriMesh[] openSurfaces(ModelImage kImage, boolean isFileCoords) The action taken when the Add button is clicked in the JPanelSurface class. A file dialog is launched that allows the user to select new surfaces to load from disk.- Parameters:
kImage- ModelImage for location/orientation and scale information.- Returns:
- array of TriMesh objects.
-
parseVRMLMesh
Parses the VRML to see how many surfaces there are.- Parameters:
kIn- the file to parse- Returns:
- int value for the number of surfaces in the file.
- Throws:
IOExceptionNoSuchElementException
-
save
public static void save(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, ModelImage image, boolean transform) throws IOException - Throws:
IOException
-
save
public static void save(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iType, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer, boolean flip, int[] direction, float[] startLocation, float[] box, TransMatrix inverseDicomMatrix) throws IOException Save a TriMesh to disk- Parameters:
kName- file namekMesh- TriMeshiType- type of mesh TriMesh or ClodMeshkVBuffer- VertexBufferflip- invert y,z valuesdirection- 3D orientation of meshstartLocation- 3D location of meshbox- 3D bounding boxinverseDicomMatrix- dicom matrix- Throws:
IOException- file I/O exception
-
saveProstateSurface
public static void saveProstateSurface(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, ModelImage keyImage) throws IOException Save a TriMesh to disk- Parameters:
kName- file namekMesh- TriMeshkeyImage- image- Throws:
IOException- file I/O exception
-
saveClodMesh
public static void saveClodMesh(String kName, WildMagic.LibGraphics.Detail.ClodMesh[] akComponent, boolean flip, int[] direction, float[] startLocation, float[] box, TransMatrix inverseDicomMatrix) Save ClodMesh to disk- Parameters:
kName- file nameakComponent- array of ClodMesh to saveflip- invert y,z valuesdirection- 3D mesh orientationstartLocation- 3D mesh locationbox- mesh bounding boxinverseDicomMatrix- dicom matrix
-
saveSurfaces
public static void saveSurfaces(ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh[] akSurfaces, String kCommand) The action taken when the one of the save surface buttons is pressed in the JPanelSurface class. A file dialog is launched that allows the user to select where to save the surfaces.- Parameters:
kImage- the ModelImage displayed in the SurfaceRender classakSurfaces- an array of surfaces described by their SurfaceAttributes, containing information that is saved with the TriMeshkCommand- the type of save operation to perform
-
saveAsVRML
protected static void saveAsVRML(PrintWriter kOut, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer, boolean flip, int[] direction, float[] startLocation, float[] box) Saves the triangle mesh in VRML97 (VRML 2.0) format. File name should end with ".wrl"- Parameters:
kOut- the file to which the triangle mesh is savedflip- if the y and z axes should be flipped - true in extract and in save of JDialogSurface To have proper orientations in surface file if flip is true flip y and z on reading.direction- 1 or -1 for each axisstartLocation- DOCUMENT ME!box- (dimension-1)*resolutioncolor- DOCUMENT ME!- Throws:
IOException- if there is an error writing to the file
-
getFileName
Calls a dialog to get a file name.- Parameters:
bLoad- iftrue, make it a load dialog.- Returns:
- File name.
-
load
Support for loading the collapse records from a binary file.- Parameters:
kIn- the file from which the records are loaded- Returns:
- CollapseRecord
- Throws:
IOException- if the there is an error reading from the file
-
loadPlyAsciiMesh
private static WildMagic.LibGraphics.SceneGraph.TriMesh loadPlyAsciiMesh(File file, ModelImage kImage, boolean isFileCoords) Read a TriMesh from a Ply ascii file.- Parameters:
file- file storing the mesh- Returns:
- TriMesh
-
loadSTLAsciiMesh
private static WildMagic.LibGraphics.SceneGraph.TriMesh loadSTLAsciiMesh(File file, ModelImage kImage) Load the STL ASCII file.- Parameters:
file- STL surface file referencesource- image- Returns:
- TriMesh
-
loadVTKLegacyMesh
private static WildMagic.LibGraphics.SceneGraph.TriMesh loadVTKLegacyMesh(RandomAccessFile kIn, ViewJProgressBar progress, int added, int total, String fileName) Load legacy VTK mesh.- Parameters:
kIn- file containing meshprogress- progress baradded- number of meshes read from file so fartotal- total number of meshes in fileflag- invert y,z values- Returns:
- TriMesh
- Throws:
IOException
-
loadVTKXMLMesh
private static WildMagic.LibGraphics.SceneGraph.TriMesh loadVTKXMLMesh(String absPath, String fileName, String dir) Read VTK mesh from file.- Parameters:
absPath- file pathfileName- file namedir- file directory- Returns:
- TriMesh
-
loadGiftiXMLMesh
private static WildMagic.LibGraphics.SceneGraph.TriMesh loadGiftiXMLMesh(String absPath, String fileName, String dir) Read Gifti mesh from file.- Parameters:
absPath- file pathfileName- file namedir- file directory- Returns:
- TriMesh
-
openFiles
Returns an array of File objects, based on the user-selected files from the FileChooser dialog.- Parameters:
bLoad- whether the files are opened for reading (bLoad = true) or writing (bLoad = false)- Returns:
- File[] array of opened files.
-
openDicomMatrixFiles
Returns a dicomMatrix file objects, based on the user-selected filed from the FileChooser dialog.- Parameters:
bLoad- whether the files are opened for reading (bLoad = true) or writing (bLoad = false)- Returns:
- File of opened file.
-
printAscii
Print the contents of the TriMesh in ascii format.- Parameters:
kOut- outputkMesh- TriMesh
-
printSTLAscii
private static void printSTLAscii(PrintWriter kOut, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Print the contents of the TriMesh in STL ascii format.- Parameters:
kOut- outputkMesh- TriMesh
-
printProstateSTLAscii
private static void printProstateSTLAscii(PrintWriter kOut, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Print the contents of the TriMesh in STL ascii format.- Parameters:
kOut- outputkMesh- TriMesh
-
readAscii
Read a TriMesh from an ascii file.- Parameters:
kFile- file containing TriMesh- Returns:
- TriMesh
- Throws:
IOException- I/O exception
-
readLine
Read a line of ASCII text from the input stream.- Parameters:
in- InputStream- Returns:
- line of the ascii file as a String
- Throws:
IOException- I/O exception
-
readPoint
private static WildMagic.LibFoundation.Mathematics.Vector3f readPoint(StreamTokenizer tokenizer, String label) throws IOException Find the given label in the tokenizer stream and then return the next three numbers as a point. Return null if end of stream- Parameters:
tokenizer- stream inlabel- string label (vertex, normal ) in the STL ASCII file.- Returns:
- Vector3f point coordinate.
- Throws:
IOException
-
readSTLAscii
private static WildMagic.LibGraphics.SceneGraph.TriMesh readSTLAscii(StreamTokenizer tokenizer, ModelImage kImage) throws IOException Read the STL ASCII file as a single stream tokenizer.- Parameters:
tokenizer- stream in- Returns:
- Triangle mesh
- Throws:
IOException
-
loadSTLBinaryMesh
private static WildMagic.LibGraphics.SceneGraph.TriMesh loadSTLBinaryMesh(File file, ModelImage kImage) Load the STL ASCII file.- Parameters:
file- STL surface file referencesource- image- Returns:
- TriMesh
-
readSTLBinary
private static WildMagic.LibGraphics.SceneGraph.TriMesh readSTLBinary(FileInputStream data, ModelImage kImage) throws IOException Method for reading binary files Execution is completly different It uses ByteBuffer for reading data and ByteOrder for retrieving the machine's endian (Needs JDK 1.4) TO-DO: 1.-Be able to read files over Internet 2.-If the amount of data expected is bigger than what is on the file then the program will block forever- Parameters:
file- The name of the file- Throws:
IOException
-
readFacetB
Method that reads a face in binary files All binary versions of the methods end by 'B' As in binary files we can read the number of faces, we don't need to use coordArray and normArray (reading binary files should be faster)- Parameters:
in- The ByteBuffer with the data of the object.index- The facet index- Throws:
IOException
-
readSurface
public static WildMagic.LibGraphics.SceneGraph.TriMesh readSurface(ModelImage kImage, File file, WildMagic.LibGraphics.Rendering.MaterialState kMaterial) Load a triangle mesh from the specified file and assign to it the MaterialState.- Parameters:
kImage- ModelImage displayed in the SurfaceRender classfile- The triangle mesh file to load.kMaterial- The Material for the surface.- Returns:
- TriMesh
-
readSurface
public static WildMagic.LibGraphics.SceneGraph.TriMesh readSurface(ModelImage kImage, File file, WildMagic.LibGraphics.Rendering.MaterialState kMaterial, boolean isFileCoords) Load a triangle mesh from the specified file and assign to it the MaterialState.- Parameters:
kImage- ModelImage displayed in the SurfaceRender classfile- The triangle mesh file to load.kMaterial- The Material for the surface.- Returns:
- TriMesh
-
saveAsTextFile
private static void saveAsTextFile(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) throws IOException Save the TriMesh as an ascii text file.- Parameters:
kName- file namekMesh- TriMesh- Throws:
IOException- I/O exception
-
saveAsVRML
private static void saveAsVRML(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer, boolean flip, int[] direction, float[] startLocation, float[] box) throws IOException Saves the triangle mesh in VRML97 (VRML 2.0) format (text format).- Parameters:
kName- the name of file to which the triangle mesh is savedkMesh- TriMesh to save.kVBuffer- TriMesh VertexBufferflip- if the y and z axes should be flipped - true in extract and in save of JDialogSurface To have proper orientations in surface file if flip is true flip y and z on reading. param direction 1 or -1 for each axis param startLocation param box (dim-1)*resolutiondirection- 3D mesh orientationstartLocation- 3D mesh locationbox- 3D mesh bounding box- Throws:
IOException- if the specified file could not be opened for writing
-
saveAsVTKLegacy
private static void saveAsVTKLegacy(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) throws IOException Save the TriMesh in VTK legacy format.- Parameters:
kName- file namekMesh- TriMesh- Throws:
IOException- I/O exception
-
saveAsVTKXML
Save the TriMesh in VTK format.- Parameters:
fileName- file namekMesh- TriMesh
-
saveAsGiftiXML
Save the TriMesh in Gifti format.- Parameters:
fileName- file namekMesh- TriMesh
-
saveCollapseRecord
private static void saveCollapseRecord(RandomAccessFile kOut, WildMagic.LibGraphics.Detail.CollapseRecord kRecord) throws IOException Support for saving the collapse records to a binary file.- Parameters:
kOut- the file to which the records are savedkRecord- CollapseRecord to save.- Throws:
IOException- if the there is an error writing to the file
-
saveSingleMesh
private static void saveSingleMesh(ModelImage kImage, boolean isSur, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a mesh file. Opens a file dialog to get the output file name from the user.- Parameters:
kImage- ModelImage displayed in the SurfaceRender objectisSur- true if .sur file, otherwise .wrl filekMesh- TruNesg
-
saveSingleMesh
private static void saveSingleMesh(String name, ModelImage kImage, boolean isSur, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a mesh file. The file name is passed as a parameter.- Parameters:
name- the file namekImage- ModelImage displayed in the SurfaceRender objectisSur- true if .sur file, otherwise .wrl filekMesh- TriMesh
-
saveSinglePlyMesh
private static void saveSinglePlyMesh(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a STL mesh file.- Parameters:
kName- file name.kMesh- Triangle mesh
-
saveProstatePlyMesh
private static void saveProstatePlyMesh(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a STL mesh file.- Parameters:
kName- file name.kMesh- Triangle mesh
-
saveSingleSTLMesh
private static void saveSingleSTLMesh(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a STL mesh file.- Parameters:
kName- file name.kMesh- Triangle mesh
-
saveProstateSTLMesh
private static void saveProstateSTLMesh(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Saves a single level of detail to a STL ascii mesh file.- Parameters:
kName- file name.kMesh- Triangle mesh
-
saveSur
private static void saveSur(String kName, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iType, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer, boolean flip, int[] direction, float[] startLocation, float[] box, TransMatrix inverseDicomMatrix) throws IOException Write the TriMesh to disk in the .sur format.- Parameters:
kName- file name.kMesh- TriMesh.iType- type == 0 for TriMesh, type == 1 for ClodMeshkVBuffer- TriMesh VertexBufferflip- flag for inverting the y,z valuesdirection- 3D mesh directionstartLocation- 3D mesh locationbox- 3D mesh bounding boxinverseDicomMatrix- dicom matrix information.- Throws:
IOException- if there is an error writing to the file
-
writeTriangleMeshXML
private static void writeTriangleMeshXML(String kName, ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Writes a TriMesh to disk in the xml format, based on surface.xsd.- Parameters:
kName- file name.kImage- ModelImage associated with the TriMesh.kMesh- TriMesh surface mesh.
-
convertVertex
private static WildMagic.LibGraphics.SceneGraph.VertexBuffer convertVertex(ModelImage kImage, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh) Convert the vertex from display space to dicom space.- Parameters:
kImage- ModelImagekMesh- Triangle mesh- Returns:
- kVBuffer Converted vertex buffer
-