Class NIFTI2Image
java.lang.Object
com.xinapse.multisliceimage.MultiSliceImage
com.xinapse.multisliceimage.Analyze.ANZImage
com.xinapse.multisliceimage.Analyze.NIFTIImage
com.xinapse.multisliceimage.Analyze.NIFTI2Image
- All Implemented Interfaces:
ReadableImage
,WritableImage
,InfoStorer
,AutoCloseable
,Cloneable
This class is a representation of a multi-dimensional image in the NIFTI-2 format,
the updated NIFTI format.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.xinapse.image.ReadableImage
ReadableImage.Position
-
Field Summary
Fields inherited from class com.xinapse.multisliceimage.Analyze.NIFTIImage
COMPRESSED_EXTENSION, COMPRESSED_PROPERTY_KEY, DEFAULT_COMPRESSED, DEFAULT_NIFTI_ONE_FILE, EXTENSION, ONE_FILE_PROPERTY_KEY, UPPERCASE_COMPRESSED_EXTENSION, UPPERCASE_EXTENSION
Fields inherited from class com.xinapse.multisliceimage.Analyze.ANZImage
COMPRESSED_UPPERCASE_EXTENSION
Fields inherited from class com.xinapse.multisliceimage.MultiSliceImage
AUDIT_TRAIL_ACTION_TEXT, BIRTH_DATE_NAME, BODY_PART_NAME, COLOUR_MAPPING_NAME, DW_B_MATRIX_NAME, DW_B_VALUE_NAME, DW_GRADIENT_VECTOR_NAME, ECHO_TIME_NAME, ECHO_TRAIN_LENGTH_NAME, FLIP_ANGLE_NAME, FRAME_OF_REFERENCE_UID_NAME, IMAGE_ORIENTATION_PATIENT_NAME, IMAGE_POSITION_PATIENT_NAME, INTENSITY_RESCALE_INTERCEPT_NAME, INTENSITY_RESCALE_SLOPE_NAME, INTENSITY_RESCALE_UNITS_NAME, INVERSION_TIME_NAME, LATERALITY_NAME, MODALITY_NAME, mode, PATIENT_ID_NAME, PATIENT_NAME_NAME, PATIENT_POSITION_NAME, PATIENT_SEX_NAME, pixArray, PIXEL_SPACING_NAME, PIXEL_X_SIZE_NAME, PIXEL_Y_SIZE_NAME, PIXEL_Z_SIZE_NAME, PULSE_SEQUENCE_NAME, randomAccessFile, REPETITION_TIME_NAME, SAT_PULSE_FREQ_OFFSET_PPM_NAME, SCAN_DATE_NAME, SCANNING_SEQUENCE_NAME, SEQUENCE_VARIANT_NAME, SERIES_DESCRIPTION_NAME, SERIES_INSTANCE_UID_NAME, SERIES_NUMBER_NAME, SLICE_THICKNESS_NAME, STORAGE_CLASS_UID_NAME, STUDY_ID_NAME, STUDY_INSTANCE_UID_NAME, TIME_BETWEEN_FRAMES_NAME, TRIGGER_DELAY_NAME
-
Constructor Summary
ConstructorDescriptionCreates an uninitialised instance of a NIFTI2Image.NIFTI2Image
(long nCols, long nRows, long nSlices, long nFrames, ANZPixFormat dataType) Creates a new in-memory NIFTI2Image.NIFTI2Image
(ANZPixFormat dataType, Long... dims) Creates a new in-memory NIFTI2Image.NIFTI2Image
(NIFTIHeader hdr) Creates a new in-memory NIFTI2Image, using information from an existing NIFTIHeader.NIFTI2Image
(File f, NIFTI2Header header) Creates a new disk-based NIFTI2Image, using an existing header as a template for the new image.NIFTI2Image
(String fileName, long nCols, long nRows, long nSlices, long nFrames, ANZPixFormat dataType) Creates a new disk-based NIFTI2Image.NIFTI2Image
(String fileName, ANZPixFormat dataType, Long... dims) Creates a new disk-based NIFTI2Image.NIFTI2Image
(String fileName, String mode) Opens an existing NIFTI2Image, with pixel data remaining on disk until requested. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Returns the common name for this type of image.static void
Run the self-test for the NIFTI2Image class.Methods inherited from class com.xinapse.multisliceimage.Analyze.NIFTIImage
addExtendedData, anonymise, appendAuditInfo, appendInfoList, appendInfoList, close, getBodyPart, getEchoTrainLength, getExtendedData, getFlipAngle, getFrameDWBMatrix, getFrameDWbValue, getFrameDWGradientVector, getFrameInfo, getFrameInfoList, getFrameTriggerDelayMS, getHTMLDescription, getImageOrientationPatient, getImagePositionPatient, getImageTypeName, getInfo, getInfo, getInfoList, getInfoList, getIntensityRescale, getIntent, getLaterality, getPatientDoB, getPatientID, getPatientName, getPatientPosition, getPatientSex, getPreferredCompressed, getPreferredNIFTIOneFile, getPreviewIcon, getPulseSequence, getQForm, getRescaleUnits, getSaturationFreqOffsetPPM, getSaturationFreqOffsetPPM, getScanDate, getScanningSequence, getScanTE, getScanTE, getScanTI, getScanTR, getSequenceVariant, getSeriesDescription, getSeriesNumber, getSForm, getSFormAffineTransform, getSliceDWBMatrix, getSliceDWbValue, getSliceDWGradientVector, getSliceInfo, getSliceInfoList, getSliceThickness, getSliceTriggerDelayMS, getStudyID, imageExists, putFrameInfo, putFrameInfo, putInfo, putInfo, putInfo, putInfo, putInfo, putInfo, putSliceInfo, putSliceInfo, removeExtendedData, removeInfo, removeInfo, savePreferredCompressed, savePreferredNIFTIOneFile, setBodyPart, setEchoTrainLength, setFlipAngle, setFrameDWBMatrix, setFrameDWbValue, setFrameDWGradientVector, setFrameInfoList, setFrameTriggerDelayMS, setImageOrientationPatient, setImagePositionPatient, setInfoList, setInfoList, setIntensityRescale, setIntent, setLaterality, setPatientDoB, setPatientID, setPatientName, setPatientPosition, setPatientSex, setPulseSequence, setQForm, setRescaleUnits, setSaturationFreqOffsetPPM, setSaturationFreqOffsetPPM, setScanDate, setScanningSequence, setScanTE, setScanTE, setScanTI, setScanTR, setSequenceVariant, setSeriesDescription, setSeriesNumber, setSForm, setSliceDWBMatrix, setSliceDWbValue, setSliceDWGradientVector, setSliceInfoList, setSliceThickness, setSliceTriggerDelayMS, setStudyID, stripExtension, supportsIntensityRescaling, write
Methods inherited from class com.xinapse.multisliceimage.Analyze.ANZImage
disposeImageData, getByteOrder, getCopy, getDataType, getDescription, getDescription, getDims, getFileDataOffset, getHeader, getHTMLDescription, getImageOrientationPatient, getImagePositionPatient, getMax, getMin, getNativeColourMapping, getNativeHeader, getNCols, getNDim, getNFrames, getNRows, getNSlices, getPixelXSize, getPixelYSize, getPixelZSize, getStoredPixelDataType, getTimeBetweenFrames, getTitle, getTotalNSlices, isCompressed, isOpen, setDBName, setDescription, setImageOrientationPositionPatient, setMinMax, setNativeColourMapping, setPixelSpacing, setPixelXSize, setPixelYSize, setPixelZSize, setTimeBetweenFrames, setTitle, toString
Methods inherited from class com.xinapse.multisliceimage.MultiSliceImage
clone, getDateFormat, getFrameDim, getFrameOfReferenceUID, getModality, getMostLikePlane, getPix, getPix, getPix, getPix, getPix, getPresentationPixelDataType, getROIs, getScanDateFormat, getSlice, getSlice, getSliceDim, getStoredPix, getSuggestedFileName, isModified, parseMultiValuedString, putPix, putPix, putPix, putPix, putSlice, setFrameOfReferenceUID, setIntensityRescale, setMinMax, setModality, setModified, setSeriesInstanceUID, setStudyInstanceUID, setSuggestedFileName
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.xinapse.multisliceimage.InfoStorer
appendInfoList, appendInfoList, getFrameInfo, getFrameInfoList, getInfo, getInfo, getInfoList, getInfoList, getSliceInfo, getSliceInfoList, putFrameInfo, putFrameInfo, putInfo, putInfo, putInfo, putInfo, putInfo, putInfo, putSliceInfo, putSliceInfo, removeInfo, removeInfo, setFrameInfoList, setInfoList, setInfoList, setSliceInfoList
Methods inherited from interface com.xinapse.image.ReadableImage
getAffineTransform, getAffineTransform, getNSliceLocations
Methods inherited from interface com.xinapse.image.WritableImage
appendToTitle
-
Constructor Details
-
NIFTI2Image
public NIFTI2Image()Creates an uninitialised instance of a NIFTI2Image. Needed so that newInstance() method can be called on the class. -
NIFTI2Image
public NIFTI2Image(long nCols, long nRows, long nSlices, long nFrames, ANZPixFormat dataType) throws ANZException, IOException Creates a new in-memory NIFTI2Image. This image exists in memory, and will only be written with an explicit write() method call.- Parameters:
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
- theANZPixFormat
for the image.- Throws:
ANZException
- if the image cannot be created.IOException
- if an I/O error occurs.
-
NIFTI2Image
Creates a new in-memory NIFTI2Image. This image exists in memory, and will only be written with an explicit write() method call.- Parameters:
dims
- the number of samples in each of the image dimensions. The number of arguments supplied determines the dimensionality of the image.dataType
- an ANZPixFormat.- Throws:
ANZException
- if the header cannot be created.IOException
- if an I/O error occurs.
-
NIFTI2Image
Creates a new in-memory NIFTI2Image, using information from an existing NIFTIHeader. This image exists in memory, and will only be written with an explicit write() method call. The supplied NIFTIHeader object is cloned and can therefore be re-used.- Parameters:
hdr
- the NIFTIHeader that will be used for dimensional information etc.- Throws:
ANZException
- if the image cannot be created.IOException
- if an I/O error occurs.
-
NIFTI2Image
public NIFTI2Image(String fileName, long nCols, long nRows, long nSlices, long nFrames, ANZPixFormat dataType) throws IOException, ANZException Creates a new disk-based NIFTI2Image. After manipulation, a call to the close() method is necessary for any changes to be reflected on disk.- Parameters:
fileName
- the root of the Analyze file name (i.e. without the ".img" or ".hdr" extension). If the fileName does have an extension, then 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
- theANZPixFormat
for the image.- Throws:
ANZException
- if the NIFTI2Image cannot be instantiated.IOException
- if an I/O error occurs.
-
NIFTI2Image
public NIFTI2Image(String fileName, ANZPixFormat dataType, Long... dims) throws IOException, ANZException Creates a new disk-based NIFTI2Image. After manipulation, a call to the close() method is necessary for any changes to be reflected on disk.- Parameters:
fileName
- the root of the NIFTI file name (i.e. without any ".img" ".hdr", ".nii", ".img.gz", ".hdr.gz" or ".nii.gz" extension). If the fileName does have an extension, then this will be handled gracefully.dataType
- an ANZPixFormat.dims
- the number of samples in each of the image dimensions. The number of arguments supplied determines the dimensionality of the image.- Throws:
ANZException
- if the header cannot be created.IOException
- if an I/O error occurs.
-
NIFTI2Image
Creates a new disk-based NIFTI2Image, using an existing header as a template for the new image. After manipulation, a call to the close() method is necessary for any changes to the header to be reflected on disk.- Parameters:
f
- the File object that will form the root of the Analyze file name (i.e. without the ".hdr" extension). If f's name does have an extension, then this will be handled.header
- the NIFTI2Header to use as the template.- Throws:
ANZException
- if the new image cannot be created on disk.IOException
- if an I/O error occurs.
-
NIFTI2Image
public NIFTI2Image(String fileName, String mode) throws InvalidImageException, IOException, FileNotFoundException Opens an existing NIFTI2Image, with pixel data remaining on disk until requested.- Parameters:
fileName
- the name of the image file.mode
- the open mode. Can be either "r" (read-only) or "rw" (read-write).- Throws:
InvalidImageException
- if the image cannot be opened or loaded, or if mode is invalid.FileNotFoundException
- if the image file doesn't exist.IOException
- if an I/O error occurs.
-
-
Method Details
-
getCommonName
Returns the common name for this type of image.- Returns:
- the
String
"NIFTI-2".
-
main
Run the self-test for the NIFTI2Image class.- Parameters:
args
- a list of images to try to open.
-