Package gov.nih.mipav.model.file
Class FileVOI
java.lang.Object
gov.nih.mipav.model.file.FileBase
gov.nih.mipav.model.file.FileXML
gov.nih.mipav.model.file.FileVOI
VOI reader/writer. This classes incorporates the ability to write/read VOIs in three formats (MIPAV *.voi, Nuages,
and MIPAV *.xml . The first is a simple text format in which the points of the VOIs are stored in text format. The
VOIs can be also stored in a second format, also a text format, termed a Nauges. Nauges is a program that forms
triangles (i.e., tesselates) from contours. Therefore, if one wishes to render a surface of a VOI, first save the VOI
in Nauges format and supply the VOI file to the Nauges executable. MIPAV's lastest file format is based on XML and
should be used in the future.
Note: A single VOI per file. However, a VOI can be formed from multiple contours.
- Version:
- 0.1 Feb 24, 1998
- Author:
- Matthew J. McAuliffe, Ph.D.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classHandle events generated while parsing the XML file.private classDOCUMENT ME!private classDOCUMENT ME!private classHandle events generated while parsing the Annotation XML file.private classHandle events generated while parsing the XML file.Nested classes/interfaces inherited from class gov.nih.mipav.model.file.FileXML
FileXML.XMLAttributes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprotected FileFile reference, it and its components are able to be modified by extending classes.protected StringFile directory where the VOI is to read or written.protected StringFile name of the VOI.private final ModelImageImage used to reference properties of the image to aid reading and writing of the VOI.private booleanFlag indicating whether the VOI should be written in MIPAV's XML format.private final shortThe number of VOIs in the image.private intFile directory where the VOI is to read or written.private static final Stringprivate StringFile name without the extension.private static final StringThe MIPAV XML header comment.private static final StringThe W3C XML schema.private static final StringThe charset the XML file is written in.private static final StringThe XML version description header.Fields inherited from class gov.nih.mipav.model.file.FileXML
bw, fileInfo, m_kHandler, MIPAV_HEADER, pInterface, TAB, tabLevelFields inherited from class gov.nih.mipav.model.file.FileBase
BIG_ENDIAN, bitsPerPixel, fileNames, LITTLE_ENDIAN, pBarVisible, raFile, READ, READ_WRITE -
Constructor Summary
ConstructorsConstructorDescriptionFileVOI(String fileName, String fileDir, ModelImage image) VOI reader/writer constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddecodeLine(String str, WildMagic.LibFoundation.Mathematics.Vector2f pt) Converts string point (x,y) to Vector2f point.private booleanreadAnnotationXML(VOIVector voiVector) Reads in an annotation xml (.lbl) file and puts all VOITexts into a VOIVector (to be added to the image)private VOIThis method read a VOI file that has been saved in the MIPAV VOI format.private booleanreadCoordXML(VOI voi, boolean isLPS) Reads in a VOI from a file using the new VOI schema based on Scanner coordinates rather than pixel spaceprivate StringreadLine()Reads a line of the file and strips comments indicated by the # symbol.private VOIreadNaugeVOI(String firstStr) This method read a VOI file that has been saved in the Nauge VOI format.VOI[]This method read a VOI file that has been saved in the MIPAV VOI format (MIPAV *.voi, Nuages, and MIPAV *.xml).private VOIThis method read a VOI.POINT file that has been saved in the MIPAV PTS format.VOI[]readVOI(boolean doLabel) This method read a VOI file that has been saved in the MIPAV VOI format (MIPAV *.voi, Nuages, and MIPAV *.xml).private booleanReads in the older VOI XML schema (using pixel coordinates)voidwriteAnnotationInVoiAsXML(String voiName, boolean writeAllContours) Writes VOIText(s) to a .lbl file (XML based)voidwriteAnnotationXML(boolean writeAll) Writes VOIText(s) to a .lbl file (XML based)voidwriteNaugeVOI(VOI voi) Writes a single VOI to a file in Nauge format.voidwritePointVOI(VOI voi) Writes a single VOI.POINT to a file MIPAV format.voidWrites a single VOI to a file MIPAV format.voidvoidWrites VOI to an XML formatted file.Methods inherited from class gov.nih.mipav.model.file.FileXML
closedTag, closedTag, closedTag, finalize, openTag, readHeader, setPBarMethods inherited from class gov.nih.mipav.model.file.FileBase
addProgressChangeListener, bytesToDouble, bytesToFloat, bytesToInt, bytesToShort, doubleToBytes, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, floatToBytes, getBufferDouble, getBufferFloat, getBufferInt, getBufferLong, getBufferShort, getBufferUShort, getDataType, getDouble, getFloat, getInt, getLong, getProgressChangeListeners, getRaFile, getSignedShort, getString, getUInt, getUnsignedByte, getUnsignedShort, intToBytes, isBigEndian, isProgressBarVisible, linkProgress, longToBytes, readDouble, readFloat, readInt, readLong, readShort, readString, readUnsignedShort, removeProgressChangeListener, setBigEndian, setBufferFloat, setBufferInt, setBufferLong, setBufferShort, setBufferString, setDataType, setEndianess, shortToBytes, writeBytes, writeDouble, writeFloat, writeInt, writeLong, writeShort
-
Field Details
-
W3C_XML_SCHEMA
The W3C XML schema.- See Also:
-
XML_ENCODING
The charset the XML file is written in.- See Also:
-
XML_HEADER
The XML version description header.- See Also:
-
VOI_HEADER
The MIPAV XML header comment.- See Also:
-
TEXT_HEADER
- See Also:
-
file
File reference, it and its components are able to be modified by extending classes. -
fileDir
File directory where the VOI is to read or written. -
fileName
File name of the VOI. -
image
Image used to reference properties of the image to aid reading and writing of the VOI. -
isXML
private boolean isXMLFlag indicating whether the VOI should be written in MIPAV's XML format. -
numVOIs
private final short numVOIsThe number of VOIs in the image. -
sliceNum
private int sliceNumFile directory where the VOI is to read or written. -
trimmedFileName
File name without the extension. -
extension
-
-
Constructor Details
-
FileVOI
VOI reader/writer constructor.- Parameters:
fileName- file namefileDir- file directoryimage- image model: needed during the read process to ensure the VOI "fits" in the image space.- Throws:
IOException- if there is an error making the files
-
-
Method Details
-
readVOI
This method read a VOI file that has been saved in the MIPAV VOI format (MIPAV *.voi, Nuages, and MIPAV *.xml).- Parameters:
doLabel- boolean telling to read the files as VOITexts (labels)- Returns:
- the VOI read off the disk
- Throws:
IOException- if there is an error reading the file
-
readOtherOrientationVOI
This method read a VOI file that has been saved in the MIPAV VOI format (MIPAV *.voi, Nuages, and MIPAV *.xml).- Returns:
- the VOI read off the disk
- Throws:
IOException- if there is an error reading the file
-
writeAnnotationXML
Writes VOIText(s) to a .lbl file (XML based)- Parameters:
writeAll- whether or not to write all VOITexts into the same file, or only the selected VOIText- Throws:
IOException- exception thrown if there is an error writing the file
-
writeAnnotationInVoiAsXML
Writes VOIText(s) to a .lbl file (XML based)- Parameters:
String- voiName Name of VOIText to write outboolean- writeAllContours Whether to write all contours or only selected contours- Throws:
IOException- exception thrown if there is an error writing the file
-
writeNaugeVOI
Writes a single VOI to a file in Nauge format.- Parameters:
voi- VOI to write- Throws:
IOException- if there is an error writing the file
-
writePointVOI
Writes a single VOI.POINT to a file MIPAV format.- Parameters:
voi- VOI.POINT to write- Throws:
IOException- if there is an error writing the file
-
writeVOI
Writes a single VOI to a file MIPAV format.- Parameters:
voi- VOI to writesaveAllContours- if true save all contours, not just the active ones- Throws:
IOException- if there is an error writing the file
-
writeXML
- Throws:
IOException
-
writeXML
Writes VOI to an XML formatted file.- Parameters:
voi- VOI to be savedsaveAllContours- if true save all contours, not just the active ones- Throws:
IOException- exception thrown if there is an error writing the file
-
decodeLine
Converts string point (x,y) to Vector2f point.- Parameters:
str- string to convertpt- point to return
-
readAnnotationXML
Reads in an annotation xml (.lbl) file and puts all VOITexts into a VOIVector (to be added to the image)- Parameters:
voiVector- a VOIVector for holding the VOIs before they are transferred to the image- Returns:
- boolean
-
readContourVOI
This method read a VOI file that has been saved in the MIPAV VOI format.- Returns:
- the new VOI read from the file
- Throws:
IOException- if there is an error reading the file
-
readCoordXML
Reads in a VOI from a file using the new VOI schema based on Scanner coordinates rather than pixel space- Parameters:
voi- VOI to be read in- Returns:
- boolean whether or not the VOI read in successfully
-
readLine
Reads a line of the file and strips comments indicated by the # symbol.- Returns:
- the line read in
- Throws:
IOException- if there is an error reading the file
-
readNaugeVOI
This method read a VOI file that has been saved in the Nauge VOI format.- Parameters:
firstStr- first line of the Nauge VOI file- Returns:
- the VOI
- Throws:
IOException- if there is an error reading the file
-
readPointVOI
This method read a VOI.POINT file that has been saved in the MIPAV PTS format.- Returns:
- the new VOI read from the file
- Throws:
IOException- if there is an error reading the file
-
readXML
Reads in the older VOI XML schema (using pixel coordinates)- Parameters:
voi- VOI- Returns:
- boolean
-