|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.xinapse.multisliceimage.MultiSliceImage
com.xinapse.multisliceimage.Analyze.ANZImage
com.xinapse.multisliceimage.Analyze.Analyze75Image
public class Analyze75Image
This class is a representation of a multi-dimensional image in the Analyze 7.5 format. An Analayze75Image object can be created from two data sources (one for the header, the other for the image data), or it can be created afresh.
Image data for images loaded from disk remain on disk, and have their pixel loaded as required; image data loaded from streams or created afresh reside in memory.
Both big-endian and little-endian byte ordering are implemented and supported. When reading existing images, the byte order is auto detected from the header file. When existing images are copied or modified, the original byte order is retained. For images newly-created from scratch by this package, the byte ordering is the native byte order.
N.B. The Analyze format requires that for BINARY images, individual slices must begin on a byte boundary. In this implementation, that restriction is removed. If you wish to maintain compatibility with Analyze and other programs that maintain this restriction, please ensure that a multi-slice/multi-frame images have slices with a number of pixels that is a multiple of 8 (bits).
| Field Summary | |
|---|---|
static java.lang.String |
COMPRESSED_PROPERTY_KEY
The property value key for setting whether Analyze 7.5 images should be stored compressed, or uncompressed. |
static boolean |
DEFAULT_COMPRESSED
Whether to store Analyze 7.5 images compressed by default. |
| Fields inherited from class com.xinapse.multisliceimage.Analyze.ANZImage |
|---|
COMPRESSED_EXTENSION, COMPRESSED_UPPERCASE_EXTENSION, EXTENSION, UPPERCASE_EXTENSION |
| Constructor Summary | |
|---|---|
Analyze75Image(Analyze75Header hdr)
Creates a new in-memory Analyze75Image, using information from an existing Analyze75header. |
|
Analyze75Image(java.io.File f,
Analyze75Header header)
Creates a new disk-based Analyze75Image, using an existing header as a template for the new image. |
|
Analyze75Image(short nCols,
short nRows,
short nSlices,
short nFrames,
ANZPixFormat dataType)
Creates a new in-memory Analyze75Image. |
|
Analyze75Image(java.lang.String filename,
Analyze75Header header)
Creates a new disk-based Analyze75Image, using an existing header as a template for the new image. |
|
Analyze75Image(java.lang.String filename,
short nCols,
short nRows,
short nSlices,
short nFrames,
ANZPixFormat dataType)
Creates a new disk-based Analyze75Image. |
|
Analyze75Image(java.lang.String filename,
java.lang.String mode)
Opens an existing Analyze75Image, with pixel data remaining on disk until requested. |
|
| Method Summary | |
|---|---|
void |
appendAuditInfo(java.lang.String name,
java.lang.String value)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
static java.lang.String |
getCommonName()
Returns the common name for this type of image. |
float[] |
getDWBMatrix(int slice)
This action is not supported by the Analyze file format, so this method always throws a ParameterNotSetException always. |
float |
getDWbValue(int slice)
This action is not supported by the Analyze file format, so this method always throws a ParameterNotSetException always. |
javax.vecmath.Vector3f |
getDWGradientVector(int slice)
This action is not supported by the Analyze file format, so this method always throws a ParameterNotSetException always. |
float |
getFlipAngle()
This action is not supported by the Analyze file format, so this method always throws a ParameterNotSetException always. |
MultiSliceImage |
getInstance(java.lang.Class cl,
int nSlices)
Creates a new in-memory MultiSliceImage with the MultiSliceImage class given by the argument, possibly changing the number of slices in the image. |
float[] |
getIntensityRescale()
Intensity rescaling is not supported by Analyze 7.5 format, so this method always the float[] [1.0f, 0.0f]. |
java.lang.Double |
getMax()
Returns the maximum pixel intensity in the image. |
java.lang.Double |
getMin()
Returns the minimum pixel intensity in the image. |
Modality |
getModality()
Modality recording is not supported by the Analyze file format, so this method always returns Modality.UNKNOWN |
byte |
getOrient()
Gets the orientation of this Analyze75Image. |
java.util.Date |
getPatientDoB()
Patient's Birth Date is not supported by Analyze 7.5 format. |
java.lang.String |
getPatientID()
Returns the Patient ID set in the image header. |
java.lang.String |
getPatientName()
Patient names are not supported by Analyze 7.5 format. |
PatientPosition |
getPatientPosition()
This action is not supported by the Analyze file format, so this method always returns PatientPosition.UNKNOWN; |
static boolean |
getPreferredCompressed()
Returns the user's preference about whether Analyze 7.5 images should be stored compressed. |
static PreviewIcon |
getPreviewIcon(java.io.File f)
Returns the PreviewIcon for an Analyze75Image header, or null if the supplied File does not represent an Analyze 7.5 image header. |
java.lang.String |
getPulseSequence()
Pulse sequence names are not supported by Analyze 7.5 for,at. |
java.lang.String |
getRescaleUnits()
Specifies the output units of Intensity Rescale Slope and Intensity Rescale Intercept, retrieved by getIntensityRescale(). |
java.util.Date |
getScanDate()
Scan dates are not supported by Analyze 7.5 format. |
PulseSequenceType |
getScanningSequence()
Scan sequences are not supported by Analyze 7.5 format. |
float |
getScanTE()
This action is not supported by the Analyze file format, so this method always throws a ParameterNotSetException. |
float |
getScanTE(int slice)
This action is not supported by the Analyze file format, so this method always throws a ParameterNotSetException. |
float |
getScanTI()
This action is not supported by the Analyze 7.5 format, so this method always throws a ParameterNotSetException. |
float |
getScanTR()
This action is not supported by the Analyze 7.5 format, so this method always throws a ParameterNotSetException. |
PulseSequenceVariant |
getSequenceVariant()
Scan sequence variants are not supported by Analyze 7.5 format. |
java.lang.String |
getSimpleName()
Returns the simple name for this type of image - the String that should be seen by the users to identify this type of image. |
float |
getSliceThickness()
This action is not supported by the Analyze file format, so this method always throws ParameterNotSetException |
boolean |
isFlipped()
Returns true if this Analyze75Image is flipped. |
static void |
main(java.lang.String[] args)
Run the self-test for the Analyze75Image class. |
static void |
savePreferredCompressed(boolean compressed)
Sets the user's preference about whether Analyze 7.5 images should be stored compressed. |
void |
setDWBMatrix(float[] bMatrix,
int slice)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setDWbValue(float bValue,
int slice)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setDWGradientVector(javax.vecmath.Vector3f gradVec,
int slice)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setFlipAngle(float flipAngle)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setImageOrientationPatient(javax.vecmath.Vector3f[] dirCos,
int slice)
This action is not supported by the Analyze 7.5 file format, so this method has no effect. |
void |
setImagePositionPatient(javax.vecmath.Point3f position,
int slice)
This action is not supported by the Analyze 7.5 file format, so this method has no effect. |
void |
setIntensityRescale(float[] rescale)
Intensity rescaling is not supported by Analyze 7.5 format, so this method always throws a MultiSliceImageException. |
void |
setModality(Modality modality)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setOrient(byte orient)
Sets the orientation of this Analyze75Image. |
void |
setPatientDoB(java.util.Date patientDoB)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setPatientID(java.lang.String patientID)
Sets the patient ID for this image. |
void |
setPatientName(java.lang.String patientName)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setPatientPosition(PatientPosition position)
This action is not supported by the Analyze file format, so this method does nothing. |
void |
setPulseSequence(java.lang.String seqName)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setRescaleUnits(java.lang.String unitsString)
This action is not supported by the Analyze file format, so this method does nothing. |
void |
setScanDate(java.util.Date scanDate)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setScanningSequence(PulseSequenceType seq)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setScanTE(float TE)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setScanTE(float TE,
int slice)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setScanTI(float TI)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setScanTR(float TR)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setSequenceVariant(PulseSequenceVariant seqVar)
This action is not supported by Analyze 7.5 format, so this method does nothing. |
void |
setSliceThickness(float thickness)
This action is not supported by the Analyze file format, so this method does nothing. |
| Methods inherited from class com.xinapse.multisliceimage.MultiSliceImage |
|---|
autoResample, checkMinMax, crop, deleteImage, exists, export, export, export, getClasses, getDateFormat, getFrameOfReferenceUID, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getMostLikePlane, getNPixels, getPix, getPix, getPix, getPix, getPix, getPreferredImageClass, getPreview, getROIs, getScanDateFormat, getSlice, getSlice, getSliceDim, getSuggestedFileName, isImage, isModified, pad, parseMultiValuedString, putPix, putPix, putPix, putPix, putSlice, reorient, reorientRadiological, reSample, reSample, savePreferredImageClass, set3DBlockParameters, setMinMax, setModified, setOrientationPositionRadiological, setSuggestedFileName, toBufferedImage |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String COMPRESSED_PROPERTY_KEY
public static final boolean DEFAULT_COMPRESSED
| Constructor Detail |
|---|
public Analyze75Image(short nCols,
short nRows,
short nSlices,
short nFrames,
ANZPixFormat dataType)
throws ANZException
nCols - the number of columns in the image x-direction.nRows - the number of rows in the image y-direction.nSlices - the number of slice in the image.nFrames - the number of frames (time points) in the image.dataType - the ANZPixFormat for the image. If dataType is not one of the
original Analyze 7.5 pixel formats, then an ANZException is thrown.
ANZException - if the image cannot be created.
public Analyze75Image(Analyze75Header hdr)
throws ANZException
hdr - the Analyze75Header that will be used for dimensional information etc.
ANZException
public Analyze75Image(java.lang.String filename,
short nCols,
short nRows,
short nSlices,
short nFrames,
ANZPixFormat dataType)
throws java.io.IOException,
ANZException
filename - the root of the Analyze file name (i.e. without the ".img" or ".hdr"
extension). If the filename does have an extension, this this will be handled.nCols - the number of columns in the image x-direction.nRows - the number of rows in the image y-direction.nSlices - the number of slice in the image.nFrames - the number of frames (time points) in the image.dataType - the ANZPixFormat for the image. If dataType is not one of the
original Analyze 7.5 pixel formats, then an ANZException is thrown.
ANZException - if the Analyze75Image cannot be instantiated.
java.io.IOException - if an I/O error occurs.
public Analyze75Image(java.io.File f,
Analyze75Header header)
throws java.io.IOException,
ANZException
f - the File object that will form the root of the Analyze file name
(i.e. without the ".img" or ".hdr" extension). If f's name does have an
extension, this this will be handled.header - the Analyze75Header to use as the template.
ANZException - if the new image cannot be created on disk.
java.io.IOException - if an I/O error occurs.
public Analyze75Image(java.lang.String filename,
Analyze75Header header)
throws ANZException,
java.io.IOException
filename - the root of the Analyze file name (i.e. without the ".img" or ".hdr"
extension). If the filename does have an extension, this this will be handled.header - the Analyze75Header to use as the template.
ANZException - if the new image cannot be created.
java.io.IOException - if an I/O error occurs.
public Analyze75Image(java.lang.String filename,
java.lang.String mode)
throws MultiSliceImageException,
java.io.IOException,
java.io.FileNotFoundException
filename - the name of the image file.mode - the open mode. Can be either "r" (read-only) or "rw" (read-write).
MultiSliceImageException - if the image cannot be opened or loaded,
or if mode is invalid.
java.io.FileNotFoundException - if the image file doesn't exist.
java.io.IOException - if an I/O error occurs.| Method Detail |
|---|
public static boolean getPreferredCompressed()
If the system property "analyze.compressed" exists, and the property value is either "true" or "false", then the user's preference is overridden by the property value.
public static void savePreferredCompressed(boolean compressed)
compressed - true if the user prefers to store Analyze 7.5 images
compressed.
public MultiSliceImage getInstance(java.lang.Class cl,
int nSlices)
throws java.io.IOException,
MultiSliceImageException
MultiSliceImage
getInstance in class ANZImagecl - the class of image to be written (e.g.
com.xinapse.multisliceimage.UNC.UNCImage.class).nSlices - the number of slices in the image that is to be written.
java.io.IOException - if an I/O error occurs.
MultiSliceImageException - if the image cannot be written.public static PreviewIcon getPreviewIcon(java.io.File f)
f - the File to be tested.
public boolean isFlipped()
public byte getOrient()
throws MultiSliceImageException
MultiSliceImageException - if the orientation cannot be gotten.
public void setImagePositionPatient(javax.vecmath.Point3f position,
int slice)
setImagePositionPatient in class MultiSliceImageposition - the position of the first pixel in the volume.slice - the slice number in the volume.
public void setImageOrientationPatient(javax.vecmath.Vector3f[] dirCos,
int slice)
setImageOrientationPatient in class MultiSliceImagedirCos - the direction cosines of the image row, column and (optionally)
slice directions respectively in Left,Posterior,Superior (LPS) coordinates.slice - the slice number in the volume.public float[] getIntensityRescale()
public void setIntensityRescale(float[] rescale)
throws MultiSliceImageException
setIntensityRescale in class MultiSliceImagerescale - ignored.
MultiSliceImageException - always.public void setRescaleUnits(java.lang.String unitsString)
setRescaleUnits in class MultiSliceImageunitsString - a String describing the physical meaning of the pixel intensity units.
If the unitsString is null, future calls to getRescaleUnits() will return the
String "arbitrary units".
public void setOrient(byte orient)
throws MultiSliceImageException
orient - the orientation code for the image. Must be one of:
MultiSliceImageException - if the orient is invalid, or if the orientation cannot
be set.
public void appendAuditInfo(java.lang.String name,
java.lang.String value)
name - the audit information name.value - the audit information value.public PatientPosition getPatientPosition()
MultiSliceImageException - always.public void setPatientPosition(PatientPosition position)
setPatientPosition in class MultiSliceImageposition - the position in which the patient is lying in the scanning equipment.
e.g. PatientPosition.HFS (head-first supine).public void setScanTR(float TR)
setScanTR in class MultiSliceImageTR - the scan repetition time.public void setScanTI(float TI)
setScanTI in class MultiSliceImageTI - the scan inversion time.public void setScanTE(float TE)
setScanTE in class MultiSliceImageTE - the scan echo time.
public void setScanTE(float TE,
int slice)
setScanTE in class MultiSliceImageTE - the scan echo time.slice - the slice number for which to set the TE.public void setFlipAngle(float flipAngle)
setFlipAngle in class MultiSliceImageflipAngle - the scan flip angle.
public float getSliceThickness()
throws ParameterNotSetException
ParameterNotSetException - if the slice thickness is not set, or its value is corrupt.public void setSliceThickness(float thickness)
setSliceThickness in class MultiSliceImagethickness - the slice thickness in mm.public java.util.Date getScanDate()
public void setScanDate(java.util.Date scanDate)
setScanDate in class MultiSliceImagescanDate - the new scan date/time.
public java.lang.String getPulseSequence()
throws ParameterNotSetException
ParameterNotSetException - always.public void setPulseSequence(java.lang.String seqName)
setPulseSequence in class MultiSliceImageseqName - the new scanning sequence name.
public PulseSequenceType getScanningSequence()
throws ParameterNotSetException
ParameterNotSetException - always.public void setScanningSequence(PulseSequenceType seq)
setScanningSequence in class MultiSliceImageseq - the new scanning sequence name.
public PulseSequenceVariant getSequenceVariant()
throws ParameterNotSetException
ParameterNotSetException - always.public void setSequenceVariant(PulseSequenceVariant seqVar)
setSequenceVariant in class MultiSliceImageseqVar - the new scanning sequence variant name.public Modality getModality()
getModality in interface LoadableImagegetModality in class MultiSliceImagepublic void setModality(Modality modality)
setModality in class MultiSliceImagemodality - the imaging modality.public java.lang.String getPatientName()
public java.lang.String getPatientID()
public java.util.Date getPatientDoB()
public float getScanTR()
throws ParameterNotSetException
ParameterNotSetException - always.
public float getScanTI()
throws ParameterNotSetException
ParameterNotSetException - always.
public float getScanTE()
throws ParameterNotSetException
ParameterNotSetException - always.
public float getScanTE(int slice)
throws ParameterNotSetException
slice - the slice number for which to return the echo time.
ParameterNotSetException - always.
public float getFlipAngle()
throws ParameterNotSetException
ParameterNotSetException - always.
public float getDWbValue(int slice)
throws ParameterNotSetException
slice - the slice number for which to return the b-value.
ParameterNotSetException - always.
public void setDWbValue(float bValue,
int slice)
setDWbValue in class MultiSliceImagebValue - the diffusion-weighting b-value.slice - the slice number for which to set the b-value.
public javax.vecmath.Vector3f getDWGradientVector(int slice)
throws ParameterNotSetException
slice - the slice number for which to return the gradient-vector.
ParameterNotSetException - always.
public void setDWGradientVector(javax.vecmath.Vector3f gradVec,
int slice)
setDWGradientVector in class MultiSliceImagegradVec - the diffusion-weighting gradient vector.slice - the slice number for which to set the gradient vector.
public float[] getDWBMatrix(int slice)
throws ParameterNotSetException
slice - the slice number for which to get the b-matrix.
ParameterNotSetException - always.
public void setDWBMatrix(float[] bMatrix,
int slice)
setDWBMatrix in class MultiSliceImagebMatrix - the diffusion-weighting B-matrix.slice - the slice number for which to set the B-matrix.public java.lang.String getRescaleUnits()
LoadableImage
getRescaleUnits in interface LoadableImagegetRescaleUnits in class ANZImagepublic void setPatientName(java.lang.String patientName)
setPatientName in class MultiSliceImagepatientName - is ignored.public void setPatientID(java.lang.String patientID)
MultiSliceImage
setPatientID in class MultiSliceImagepatientID - the new patient ID to be assigned to this image.public void setPatientDoB(java.util.Date patientDoB)
setPatientDoB in class MultiSliceImagepatientDoB - is ignored.
public java.lang.Double getMin()
throws MultiSliceImageException
LoadableImage
getMin in interface LoadableImagegetMin in class ANZImageMultiSliceImageException
public java.lang.Double getMax()
throws MultiSliceImageException
LoadableImage
getMax in interface LoadableImagegetMax in class ANZImageMultiSliceImageExceptionpublic java.lang.String getSimpleName()
MultiSliceImage
getSimpleName in class MultiSliceImagepublic static java.lang.String getCommonName()
public static void main(java.lang.String[] args)
args - a list of images to try to open.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||