Class NIFTIImage
- All Implemented Interfaces:
ReadableImage, WritableImage, InfoStorer, AutoCloseable
- Direct Known Subclasses:
NIFTI2Image
Both big-endian and little-endian byte ordering are implemented and supported. When reading existing images, the byte order is auto detected. 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 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, ensure that a multi-slice/multi-frame images have slices with a number of pixels that is a multiple of 8 (bits).
N.B. When the pixel values are returned by methods such as
MultiSliceImage.getPix(boolean) and
MultiSliceImage.getSlice(int), the intensities are scaled according to the intensity rescaling
factors that are part of the NIFTI-1 standard.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ReadableImage
ReadableImage.Position -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe file extension for compressed NIFTI image files.static final booleanWhether to store NIFTI images compressed by default.static final booleanWhether to store NIFTI images in one file (.nii) by default.static final StringThe file extension for NIFTI image files.static final StringThe file extension for compressed NIFTI image files in upper case form.static final StringThe file extension for NIFTI image files in upper case form.Fields inherited from class ANZImage
COMPRESSED_UPPERCASE_EXTENSIONFields inherited from class MultiSliceImage
ACCESSION_NUMBER_NAME, 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, IMAGE_TYPE_NAME, INTENSITY_RESCALE_INTERCEPT_NAME, INTENSITY_RESCALE_SLOPE_NAME, INTENSITY_RESCALE_UNITS_NAME, INVERSION_TIME_NAME, LATERALITY_NAME, MODALITY_NAME, PATIENT_ID_NAME, PATIENT_NAME_NAME, PATIENT_POSITION_NAME, PATIENT_SEX_NAME, PIXEL_SPACING_NAME, PIXEL_X_SIZE_NAME, PIXEL_Y_SIZE_NAME, PIXEL_Z_SIZE_NAME, PULSE_SEQUENCE_NAME, 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
ConstructorsConstructorDescriptionCreates an uninitialised instance of a NIFTIImage.NIFTIImage(short nCols, short nRows, short nSlices, short nFrames, ANZPixFormat dataType) Creates a newNIFTIImage.NIFTIImage(ANZPixFormat dataType, Short... dims) Creates a newNIFTIImage.NIFTIImage(NIFTIImage im) Creates a new NIFTIImage, copying it from an existing one.NIFTIImage(String fileName, FileAccessMode mode) Opens an existing NIFTIImage, with pixel data remaining on disk until requested. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtendedData(ExtendedData extendedData) Adds a block ofExtendedDatato thisNIFTIImage.voidanonymise(String patientName, String patientID, Date birthDate, boolean patSex, String patAddr, String patInsurancePlanID, String accessionNumber, boolean patOther, String physicianName, String physicianAddr, String institutionName, String institutionAddr, String deptName, String stationName, String telNumber, boolean removePrivateElements) Anonymise this WritableImage.voidappendAuditInfo(String name, String value) Appends audit trail information to this image.voidappendInfoList(InfoList infoList) Appends anInfoListto the existing general file info of thisInfoStorer.voidappendInfoList(InfoList infoList, int dim, int n) Appends anInfoListto that for a particular dimension of this image.com.xinapse.dicom.BodyPartBy default, body part recording is not supported, so this method always returnsnull.static StringReturns the common name for this type of image.getCopy()Creates a copy of thisNIFTIImage.String[]Returns the DICOM image type this image.Returns the echo train length for this image.getFlatSliceDescription(int index, boolean html) Returns a String description of a slice of this image in HTML format.Returns the excitation pulse flip angle for this image.String[]getFrameDICOMImageType(int index) Returns the DICOM image type for one dimension index of this image.float[]getFrameDWBMatrix(int frame) Returns the diffusion-weighting b-matrix for one frame of this image.getFrameDWbValue(int frame) Returns the diffusion-weighting b-value for one frame of this image.org.jogamp.vecmath.Vector3fgetFrameDWGradientVector(int frame) Returns the diffusion-weighting gradient-vector for one frame of this image.getFrameInfo(String name, int frame) Returns aStringrepresenting the value of the information item in a particular frame of thisInfoStorer.getFrameInfoList(int frame) Returns anInfoListobject applying to a particular frame of thisInfoStorer.getFrameSaturationFreqOffsetPPM(int index) Returns the scan saturation frequency offset for one dimension index of this image in parts-per-million.getFrameTE(int frame) Returns the scan echo time for one dimension index of this image.getFrameTriggerDelayMS(int frame) Returns the trigger delay, in milliseconds, for one frame of this image.org.jogamp.vecmath.Vector3f[]getImageOrientationPatient(int slice) Returns the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient coordinates.org.jogamp.vecmath.Point3fgetImagePositionPatient(int slice) Returns the coordinates of the center of the first pixel of the specified slice of this image, in mm, in patient coordinates.Returns the human readable name for this type of image.Returns a string representing the value of an information item in the general image information.Returns aStringrepresenting the value of an information item in a particular dimension of thisInfoStorer.Returns anInfoListobject which is the general info for thisInfoStorer.getInfoList(int dim, int n) Returns anInfoListobject applying to a particular dimension/element for thisInfoStorer.float[]Returns the valuesmandbin the relationship between pixel intensity (I) values and the output units specified ingetRescaleUnits()in the expression:
Output units = m*I + b.Returns theNIFTIIntentin thisNIFTIImage.com.xinapse.dicom.LateralityBy default, laterality recording is not supported, so this method returnsLaterality.BOTH.static booleanReturns whether NIFTI images should be stored in two separate files (.hdr and .hdr) or one (.nii).Returns the patient date of birth for this image.Returns the patient ID for this image.Returns the patient name for this image.Returns the position in which the patient is lying in the scanning equipment.com.xinapse.dicom.SexReturns the patient sex for this image.static booleanReturns the user's preference about whether NIFTI images should be stored compressed.static booleanReturns the user's preference about whether NIFTI images should be stored in two separate files (.hdr and .hdr) or one (.nii).static PreviewIcongetPreviewIcon(File f, boolean withImageIcon) Returns thePreviewIconfor an NIFTIImage, ornullif the suppliedFiledoes not represent a NIFTI image.Returns the name of the pulse sequence with which this image was collected.getQForm()Returns the qForm in thisNIFTIImage.com.xinapse.dicom.RescaleUnitsReturns RescaleUnits.US.Returns the saturation pulse frequency offset for this image if it has a single saturation pulse frequency offset.static booleanReturns whether Analyze 7.5 images should be stored compressed.Returns the scan date for this image.Returns the DICOM Scanning Sequence with which this image was collected.Returns the scan echo time for this image if it has a single echo-time.Returns the scan inversion time for this image.Returns the scan repetition time for this image.Returns the DICOM Scanning Sequence Variant with which this image was collected.Returns a short description of the series (scan), such as is provided by the DICOM series description.Returns the series number for this ReadableImage.getSForm()Returns the sForm in thisNIFTIImage.Returns the general (sForm)AffineTransform3Dthat will transform the pixel indices (colIdx, rowIdx, sliceIdx) to a position in space in a patient-centric coordinate system.getSliceInfo(String name, int slice) Returns aStringrepresenting the value of the information item in a particular slice of thisInfoStorer.getSliceInfoList(int slice) Returns anInfoListobject applying to a particular slice of thisInfoStorer.Returns the slice thickness (in mm).Returns the study ID for this ReadableImage.static booleanimageExists(String fileName) Tests whether aNIFTIImagewith the given name already exists on disk.static voidRun the self-test for the NIFTIImage class.voidputFrameInfo(InfoList infoList, int frame) Adds all the items in an InfoList to the frame-specific information.voidputFrameInfo(String name, String value, int frame) Adds an item to the frame-specific information.voidAdds an item to the general file info.voidAdds an item to the dimension-specific information.voidAdds an item to the general file info.voidAdds an item to the dimension-specific information.voidAdds an item to the general file info.voidAdds an item to the dimension-specific information.voidputSliceInfo(InfoList infoList, int slice) Adds all the items in an InfoList to the slice-specific information.voidputSliceInfo(String name, String value, int slice) Adds an item to the slice-specific information.voidremoveExtendedData(ExtendedData extendedData) Removes a block ofExtendedDatafrom thisNIFTIImage.voidremoveInfo(String name) Removes an item from the general file information.voidremoveInfo(String name, int dim, int n) Removes an item from the dimension-specific information.static voidsavePreferredCompressed(boolean compressed) Sets the user's preference about whether NIFTI images should be stored compressed.static voidsavePreferredNIFTIOneFile(boolean oneFile) Sets the user's preference about whether NIFTI images should be stored in two separate files (.hdr and .hdr) or one (.nii).voidsetBodyPart(com.xinapse.dicom.BodyPart bodyPart) By default, body part recording is not supported, so this method does nothing.voidsetDICOMImageType(String[] imageTypes) Sets the type of image, in the same way that a DICOM Element with Tag <0x0008, 0x0008> does.voidSets the echo train length for this image.voidsetFlipAngle(Float flipAngle) Sets the excitation pulse flip angle for this image.voidsetFrameDICOMImageType(String[] imageTypes, int index) Sets the type of image for one for one dimension index of this image, in the same way that a DICOM Element with Tag <0x0008, 0x0008> does.voidsetFrameDWBMatrix(float[] bMatrix, int frame) Sets the diffusion-weighting B-matrix for one "frame" of this image.voidsetFrameDWbValue(float bValue, int frame) Sets the diffusion-weighting b-value for one "frame" of this image.voidsetFrameDWGradientVector(org.jogamp.vecmath.Vector3f gradVec, int frame) Sets the diffusion-weighting gradient vector for one "frame" of this image.voidsetFrameInfoList(InfoList infoList, int frame) Sets a newInfoLista specific frame of thisInfoStorer.voidsetFrameSaturationFreqOffsetPPM(Float freqOffset, int index) Sets the saturation frequency offset for one dimension index of this image.voidsetFrameTE(Float TE, int frame) Sets the scan echo time for one dimension index of this image.voidsetFrameTriggerDelayMS(float delay, int frame) Sets the trigger delay (in milliseconds) for one "frame" of this image.voidsetImageOrientationPatient(org.jogamp.vecmath.Vector3f[] orientation, int slice) Sets the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient (LPS) coordinates.voidsetImagePositionPatient(org.jogamp.vecmath.Point3f position, int slice) Sets the coordinates of the center of the first pixel of the image, in mm, in patient (LPS) coordinates, for one slice of this image.voidsetInfoList(InfoList infoList) Sets a newInfoListto the general file info of thisInfoStorer.voidsetInfoList(InfoList infoList, int dim, int n) Sets a newInfoLista specific dimension of thisInfoStorer.voidsetIntensityRescale(float rescaleSlope, float rescaleIntercept) Sets the valuesmandbin the relationship between pixel intensity (I) values and the output units specified inWritableImage.setRescaleUnits(com.xinapse.dicom.RescaleUnits)in the expression:
Output units = m*I + b.voidsetIntent(NIFTIIntent intent) Sets theNIFTIIntentin thisNIFTIImage.voidsetLaterality(com.xinapse.dicom.Laterality laterality) By default, laterality recording is not supported, so this method does nothing.voidsetPatientDoB(Date patientDoB) Sets the patient's date of birth for this image.voidsetPatientID(String patientID) Sets the patient ID for this image.voidsetPatientName(String patientName) Attempts to set the patient name for this image.voidsetPatientPosition(PatientPosition position) Sets the position in which the patient is lying in the scanning equipment for thisWritableImage.voidsetPatientSex(com.xinapse.dicom.Sex sex) Sets the patient sex for this image.voidsetPulseSequence(String seqName) Sets the pulse sequence name for this image.voidsetQForm(NIFTIXForm qForm) Sets the qForm code in thisNIFTIImage.voidsetRescaleUnits(com.xinapse.dicom.RescaleUnits units) Sets the rescale units.voidsetSaturationFreqOffsetPPM(Float freqOffset) Sets the saturation pulse frequency offset for this image, for images with a single saturation pulse frequency offset.voidsetScanDate(Date scanDate) Sets the scan date/time for this image.voidSets the DICOM scanning sequence for this image.voidSets the scan echo time for this image.voidSets the scan inversion time for this image.voidSets the scan repetition time for this image.voidSets the DICOM scanning sequence variant for this image.voidsetSeriesDescription(String description) Sets a short description of the series (scan).voidsetSeriesNumber(Integer seriesNumber) Sets the series number for this image.voidsetSForm(NIFTIXForm sForm) Sets the sForm code in thisNIFTIImage.voidSets the NIFTI sForm affine transform parameters to locate the image volume in patient-centred 3-dimensional space.voidsetSliceInfoList(InfoList infoList, int slice) Sets a newInfoLista specific slice of thisInfoStorer.voidsetSliceThickness(Float thickness) Sets the slice thickness (in mm).voidsetStudyID(String studyID) Sets the study ID for this image.static StringstripExtension(String fileName) Strips any ".img", ".img.gz", ".hdr", ".hdr.gz", ".nii", or ".nii.gz" extension (in upper or lowe case) from a file name.booleanReturnstruebecause NIFTI-1 images support intensity rescaling.Writes this NIFTIImage to disk.Methods inherited from class ANZImage
close, getByteOrder, getDataType, getDescription, getDims, getFileDataOffset, getHeader, 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, toStringMethods inherited from class MultiSliceImage
clearModified, disposeImageData, doRescale, doUnRescale, getAccessionNumber, getDateFormat, getFrameOfReferenceUID, getModality, getMostLikePlane, getPix, getPix, getPix, getPix, getPresentationPixelDataType, getRawPix, getROIs, getScanDateFormat, getSlice, getSlice, getStudyInstanceUID, getSuggestedFileName, isModified, putPix, putPix, putPix, putPix, putSlice, setAccessionNumber, setFrameOfReferenceUID, setIntensityRescale, setMinMax, setModality, setModified, setSeriesInstanceUID, setStudyInstanceUID, setSuggestedFileNameMethods inherited from interface InfoStorer
getFloatInfo, getFloatInfo, getIntegerInfo, getVectorInfoMethods inherited from interface ReadableImage
getAffineTransform, getAffineTransform, getDescription, getFlatSliceDescription, getFlatSliceHTMLDescription, getHTMLDescription, getNSliceLocations, getPixelSpacingOrDefaultsMethods inherited from interface WritableImage
addBasicAudit, addBasicAudit, appendToTitle
-
Field Details
-
DEFAULT_NIFTI_ONE_FILE
public static final boolean DEFAULT_NIFTI_ONE_FILEWhether to store NIFTI images in one file (.nii) by default.- See Also:
-
DEFAULT_COMPRESSED
public static final boolean DEFAULT_COMPRESSEDWhether to store NIFTI images compressed by default.- See Also:
-
EXTENSION
-
UPPERCASE_EXTENSION
The file extension for NIFTI image files in upper case form. -
COMPRESSED_EXTENSION
The file extension for compressed NIFTI image files.- See Also:
-
UPPERCASE_COMPRESSED_EXTENSION
The file extension for compressed NIFTI image files in upper case form.
-
-
Constructor Details
-
NIFTIImage
public NIFTIImage()Creates an uninitialised instance of a NIFTIImage. Needed so that newInstance() method can be called on the class. -
NIFTIImage
public NIFTIImage(short nCols, short nRows, short nSlices, short nFrames, ANZPixFormat dataType) throws ANZException Creates a newNIFTIImage. 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- theANZPixFormatfor the image.- Throws:
ANZException- if the image cannot be created.
-
NIFTIImage
Creates a newNIFTIImage. This image exists in memory, and will only be written with an explicit write() method call.- Parameters:
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.
-
NIFTIImage
Creates a new NIFTIImage, copying it from an existing one.- Parameters:
im- the image to copy.
-
NIFTIImage
Opens an existing NIFTIImage, with pixel data remaining on disk until requested.- Parameters:
fileName- the name of the image file.mode- the access mode for the image.- 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
-
getNIFTIOneFile
public static boolean getNIFTIOneFile()Returns whether NIFTI images should be stored in two separate files (.hdr and .hdr) or one (.nii).If the system property
"nifti.onefile"exists, and the property value is either"true"or"false", then the user's preference is overridden by the property value.- Returns:
trueif NIFTI-compliant images are to be stored in one .nii file;falseotherwise.
-
getPreferredNIFTIOneFile
public static boolean getPreferredNIFTIOneFile()Returns the user's preference about whether NIFTI images should be stored in two separate files (.hdr and .hdr) or one (.nii).- Returns:
trueif the user prefers to store NIFTI-compliant images in one .nii file;falseotherwise.
-
savePreferredNIFTIOneFile
public static void savePreferredNIFTIOneFile(boolean oneFile) Sets the user's preference about whether NIFTI images should be stored in two separate files (.hdr and .hdr) or one (.nii).- Parameters:
oneFile-trueif the user prefers to store NIFTI-compliant images in one .nii file;falseotherwise.
-
getSaveCompressed
public static boolean getSaveCompressed()Returns whether Analyze 7.5 images should be stored compressed. The value is obtained either from the System Property"analyze.compressed"(preferentially) or the user's preference.- Returns:
trueif the Analyze 7.5 images should be stored compressed;falseotherwise.
-
getPreferredCompressed
public static boolean getPreferredCompressed()Returns the user's preference about whether NIFTI images should be stored compressed.If the system property
"nifti.compressed"exists, and the property value is either"true"or"false", then the user's preference is overridden by the property value.- Returns:
trueif the user prefers to store NIFTI-compliant images compressed;falseotherwise.
-
savePreferredCompressed
public static void savePreferredCompressed(boolean compressed) Sets the user's preference about whether NIFTI images should be stored compressed.- Parameters:
compressed-trueif the user prefers to store NIFTI-compliant images compressed.
-
getCopy
Creates a copy of thisNIFTIImage.- Specified by:
getCopyin interfaceReadableImage- Specified by:
getCopyin interfaceWritableImage- Returns:
- a copy of this
NIFTIImage.
-
imageExists
Tests whether aNIFTIImagewith the given name already exists on disk. File extensions are handled in a smart and case-insensitive way.- Parameters:
fileName- the name of the image file to test for existence.- Returns:
trueif either:- a pair of NIFTIImages .img and .hdr with the specified name exist on disk;
- a single NIFTIImage with extension .nii exists on disk.
falseotherwise.
-
getPreviewIcon
Returns thePreviewIconfor an NIFTIImage, ornullif the suppliedFiledoes not represent a NIFTI image.- Parameters:
f- theFileto be tested.withImageIcon- whether a image preview is to be generated. Generating an image preview will take longer than not generating one.- Returns:
PreviewIconif the File produces anNIFTIImage;nullotherwise.
-
write
Writes this NIFTIImage to disk. This method will either:- write that header to a .hdr file, and the image data to a .img file, or
- write the image data to the same file as the header information in a .nii file.
- Specified by:
writein interfaceWritableImage- Overrides:
writein classANZImage- Parameters:
root- the root of the NIFTI fileName. Will be appended with ".hdr", ".img", ".nii", ".hdr.gz", ".img.gz" or ".nii.gz" as appropriate to create the full file name(s).- Returns:
- the actual file name used to write the image, including any added extension.
- Throws:
InvalidImageException- if the image cannot be written.IOException- if an I/O error occurs.
-
getImagePositionPatient
public org.jogamp.vecmath.Point3f getImagePositionPatient(int slice) throws IndexOutOfBoundsException Description copied from interface:ReadableImageReturns the coordinates of the center of the first pixel of the specified slice of this image, in mm, in patient coordinates.- Specified by:
getImagePositionPatientin interfaceReadableImage- Overrides:
getImagePositionPatientin classANZImage- Parameters:
slice- the slice number (indexed from 0) for which to return the pixel coordinates.- Returns:
- the Left,Posterior,Superior (LPS) coordinates of the first pixel
in the specified slice of this image. Returns
nullif the position cannot be retrieved from this image. - Throws:
IndexOutOfBoundsException- if the slice number is bad for this image.
-
setImagePositionPatient
public void setImagePositionPatient(org.jogamp.vecmath.Point3f position, int slice) Description copied from interface:WritableImageSets the coordinates of the center of the first pixel of the image, in mm, in patient (LPS) coordinates, for one slice of this image.- Specified by:
setImagePositionPatientin interfaceWritableImage- Parameters:
position- the Left,Posterior,Superior (LPS) coordinates of the first pixel of this specified slice in the image data matrix.slice- the slice for which to set the position.
-
getImageOrientationPatient
public org.jogamp.vecmath.Vector3f[] getImageOrientationPatient(int slice) throws IndexOutOfBoundsException Description copied from interface:ReadableImageReturns the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient coordinates.- Specified by:
getImageOrientationPatientin interfaceReadableImage- Overrides:
getImageOrientationPatientin classANZImage- Parameters:
slice- the slice for which to return the image orientation.- Returns:
- a
Vector3f[], corresponding to the direction cosines of the image row, column and slice directions in Left,Posterior,Superior (LPS) coordinates. Returnsnullif the direction cosines cannot be retrieved from this image. - Throws:
IndexOutOfBoundsException- if the image does not have the right dimensionality or the slice number is inappropriate for this image.
-
setImageOrientationPatient
public void setImageOrientationPatient(org.jogamp.vecmath.Vector3f[] orientation, int slice) throws IndexOutOfBoundsException Description copied from class:MultiSliceImageSets the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient (LPS) coordinates.If the orientation cannot be set for this image, this method does nothing.
- Specified by:
setImageOrientationPatientin interfaceWritableImage- Specified by:
setImageOrientationPatientin classMultiSliceImage- Parameters:
orientation- the direction cosines of the image row, column and (optionally) slice directions respectively in Left,Posterior,Superior (LPS) coordinates.slice- the slice for which to set the orientation.- Throws:
IndexOutOfBoundsException- if thecosinesarray does not have the correct dimensions.
-
supportsIntensityRescaling
public boolean supportsIntensityRescaling()Returnstruebecause NIFTI-1 images support intensity rescaling.- Specified by:
supportsIntensityRescalingin interfaceWritableImage- Returns:
true.
-
getIntensityRescale
public float[] getIntensityRescale()Description copied from interface:ReadableImageReturns the valuesmandbin the relationship between pixel intensity (I) values and the output units specified ingetRescaleUnits()in the expression:
Output units = m*I + b.- Specified by:
getIntensityRescalein interfaceReadableImage- Returns:
- an array will be of length 2 where the first element is
mand the second isb.
-
setIntensityRescale
public void setIntensityRescale(float rescaleSlope, float rescaleIntercept) Description copied from interface:WritableImageSets the valuesmandbin the relationship between pixel intensity (I) values and the output units specified inWritableImage.setRescaleUnits(com.xinapse.dicom.RescaleUnits)in the expression:
Output units = m*I + b.- Specified by:
setIntensityRescalein interfaceWritableImage- Parameters:
rescaleSlope- the value ofmin the expression above.rescaleIntercept- the value ofbin the expression above.
-
getRescaleUnits
public com.xinapse.dicom.RescaleUnits getRescaleUnits()Returns RescaleUnits.US.- Specified by:
getRescaleUnitsin interfaceReadableImage- Overrides:
getRescaleUnitsin classANZImage- Returns:
- com.xinapse.dicom.RescaleUnits.US.
-
setRescaleUnits
public void setRescaleUnits(com.xinapse.dicom.RescaleUnits units) Description copied from interface:WritableImageSets the rescale units.- Specified by:
setRescaleUnitsin interfaceWritableImage- Parameters:
units- the rescale units.
-
getCommonName
-
getImageTypeName
Returns the human readable name for this type of image.- Specified by:
getImageTypeNamein interfaceWritableImage- Returns:
- a
Stringlike "NIFTI-1" or "NIFTI-2".
-
getQForm
Returns the qForm in thisNIFTIImage.- Returns:
- the
qFormset in thisNIFTIImage.
-
setQForm
Sets the qForm code in thisNIFTIImage.- Parameters:
qForm- theqFormto set in thisNIFTIImage.- Throws:
ANZException- if the qForm cannot be set.
-
getSForm
Returns the sForm in thisNIFTIImage.- Returns:
- the
sFormin thisNIFTIImage.
-
setSForm
Sets the sForm code in thisNIFTIImage.- Parameters:
sForm- thesFormto set in thisNIFTIImage.- Throws:
ANZException- if the sForm cannot be set.
-
getSFormAffineTransform
Returns the general (sForm)AffineTransform3Dthat will transform the pixel indices (colIdx, rowIdx, sliceIdx) to a position in space in a patient-centric coordinate system.
N.B. Note: the patient-centric coordinate system is different from that defined in the NIFTI-1 standard. Jim's coordinate system is a left-handed system, with:- The first coordinate increasing to the patient left (L).
- The second coordinate increasing to the patient posterior (P).
- The third coordinate increasing to the patient superior (S).
- Returns:
- the
AffineTransform3Dthat will transform the pixel indices (colIdx, rowIdx, sliceIdx) to a position in space in the patient-centric coordinate system. The pixel indices can be transformed to the (L,P,S) coordinate by applying:// Create a point for the pixel indices. Point3f ijk = new Point3f(i, j, k); Point3f lps = new Point3f(); // The lps coordinate of the point is returned. Point3f lps = header.getAffineTransform().transform(ijk, lps);
- Throws:
ParameterNotSetException- if the AffineTransform cannot be retrieved.
-
setSFormAffineTransform
Sets the NIFTI sForm affine transform parameters to locate the image volume in patient-centred 3-dimensional space. The user supplies theAffineTransform3Dthat will transform the pixel indices (colIdx, rowIdx, sliceIdx) to a position in space in the patient-centric coordinate system.
N.B. Note: the patient-centric coordinate system is different from that defined in the NIFTI-1 standard. Jim's coordinate system is a left-handed system, with:- The first coordinate increasing to the patient left (L).
- The second coordinate increasing to the patient posterior (P).
- The third coordinate increasing to the patient superior (S).
NIFTIHeaderwill be correct according to the NIFTI-1 standard, ensuring compatibility with other NIFTI-aware that use the images.- Parameters:
tX- theAffineTransform3Dthat will transform pixel indices to patient-centred 3-dimensional (L,P,S) space.- Throws:
ANZException- if the transform cannot be set.
-
getIntent
Returns theNIFTIIntentin thisNIFTIImage.- Returns:
- the
NIFTIIntentset in thisNIFTIImage.
-
setIntent
Sets theNIFTIIntentin thisNIFTIImage.- Parameters:
intent- theNIFTIIntentto set in thisNIFTIImage.- Throws:
ANZException- if the intent cannot be set.
-
getPatientPosition
Description copied from interface:ReadableImageReturns the position in which the patient is lying in the scanning equipment. For example,PatientPosition.HFS(head-first supine).- Specified by:
getPatientPositionin interfaceReadableImage- Returns:
- the position in which the patient is lying in the scanning equipment, or
nullif the patient position cannot be determined.
-
setPatientPosition
Description copied from interface:WritableImageSets the position in which the patient is lying in the scanning equipment for thisWritableImage.- Specified by:
setPatientPositionin interfaceWritableImage- Parameters:
position- the position in which the patient is lying in the scanning equipment. e.g.PatientPosition.HFS(head-first supine).
-
setScanDate
Description copied from interface:WritableImageSets the scan date/time for this image.- Specified by:
setScanDatein interfaceWritableImage- Parameters:
scanDate- the new scan date/time to be assigned to this image.
-
setPulseSequence
Description copied from interface:WritableImageSets the pulse sequence name for this image.- Specified by:
setPulseSequencein interfaceWritableImage- Parameters:
seqName- the new name of the pulse sequence to be assigned to this image.
-
setScanningSequence
Description copied from interface:WritableImageSets the DICOM scanning sequence for this image.- Specified by:
setScanningSequencein interfaceWritableImage- Parameters:
seq- the new scanning sequence to be assigned to this image.
-
setSequenceVariant
Description copied from interface:WritableImageSets the DICOM scanning sequence variant for this image.- Specified by:
setSequenceVariantin interfaceWritableImage- Parameters:
seqVar- the new scanning sequence variant to be assigned to this image.
-
setSeriesNumber
Description copied from interface:WritableImageSets the series number for this image.- Specified by:
setSeriesNumberin interfaceWritableImage- Parameters:
seriesNumber- the new series number to be assigned to this image.
-
setSeriesDescription
Description copied from interface:WritableImageSets a short description of the series (scan).- Specified by:
setSeriesDescriptionin interfaceWritableImage- Parameters:
description- the new short description of the series, or null if none is available.
-
getSliceThickness
Description copied from interface:ReadableImageReturns the slice thickness (in mm). This method is necessary because the slice thickness may not be the same as the inter-slice pixel spacing, if there is a gap between slices.- Specified by:
getSliceThicknessin interfaceReadableImage- Returns:
- the slice thickness in mm, or null if the slice thickness is not set, or its value is corrupt.
-
setSliceThickness
Description copied from interface:WritableImageSets the slice thickness (in mm). This method is necessary because the slice thickness may not be the same as the inter-slice pixel spacing, if there is a gap between slices.- Specified by:
setSliceThicknessin interfaceWritableImage- Parameters:
thickness- the slice thickness in mm, or null to remove the slice thickness information.
-
getBodyPart
public com.xinapse.dicom.BodyPart getBodyPart()Description copied from class:MultiSliceImageBy default, body part recording is not supported, so this method always returnsnull.- Specified by:
getBodyPartin interfaceReadableImage- Overrides:
getBodyPartin classMultiSliceImage- Returns:
null.
-
setBodyPart
public void setBodyPart(com.xinapse.dicom.BodyPart bodyPart) Description copied from class:MultiSliceImageBy default, body part recording is not supported, so this method does nothing.- Specified by:
setBodyPartin interfaceWritableImage- Overrides:
setBodyPartin classMultiSliceImage- Parameters:
bodyPart- body the imaged body part.
-
getLaterality
public com.xinapse.dicom.Laterality getLaterality()Description copied from class:MultiSliceImageBy default, laterality recording is not supported, so this method returnsLaterality.BOTH.- Specified by:
getLateralityin interfaceReadableImage- Overrides:
getLateralityin classMultiSliceImage- Returns:
Laterality.BOTH.
-
setLaterality
public void setLaterality(com.xinapse.dicom.Laterality laterality) Description copied from class:MultiSliceImageBy default, laterality recording is not supported, so this method does nothing.- Specified by:
setLateralityin interfaceWritableImage- Overrides:
setLateralityin classMultiSliceImage- Parameters:
laterality- the image laterality.
-
getScanTR
Returns the scan repetition time for this image.- Specified by:
getScanTRin interfaceReadableImage- Returns:
- the scan TR for this image.
-
setScanTR
Sets the scan repetition time for this image. N.B. For disk-based images, the changes in the scan TR will not be reflected on disk unless the close() method is called.- Specified by:
setScanTRin interfaceWritableImage- Parameters:
TR- the new scan TR to be assigned to this image.
-
getScanTI
Returns the scan inversion time for this image.- Specified by:
getScanTIin interfaceReadableImage- Returns:
- the scan TI for this image.
-
setScanTI
Sets the scan inversion time for this image. N.B. For disk-based images, the changes in the scan TI will not be reflected on disk unless the close() method is called.- Specified by:
setScanTIin interfaceWritableImage- Parameters:
TI- the new scan TI to be assigned to this image.
-
getScanTE
Returns the scan echo time for this image if it has a single echo-time.- Specified by:
getScanTEin interfaceReadableImage- Returns:
- the scan TE for this image.
-
setScanTE
Description copied from interface:WritableImageSets the scan echo time for this image. No exception occurs if the image format does not support scan TE recording.- Specified by:
setScanTEin interfaceWritableImage- Parameters:
TE- the new scan TE to be assigned to this image. If null, the TE should be unset.
-
getFrameTE
Description copied from interface:ReadableImageReturns the scan echo time for one dimension index of this image. For 3-D images, the dimension index is the slice dimension. For 4-D (or higher dimensionality) images, the dimension index is the frame dimension.- Specified by:
getFrameTEin interfaceReadableImage- Parameters:
frame- the index for which to return the echo time.- Returns:
- the TE for the specified frame of this image, or null if not set for this image.
- Throws:
IndexOutOfBoundsException- if the index is bad for this image.
-
setFrameTE
Description copied from interface:WritableImageSets the scan echo time for one dimension index of this image. For 3-D images, the dimension index is the slice dimension. For 4-D (or higher dimensionality) images, the dimension index is the frame dimension. No exception occurs if the image format does not support a scan TE recording.- Specified by:
setFrameTEin interfaceWritableImage- Parameters:
TE- the new scan TE to be assigned to this image.frame- the index to the image frame for which to set the echo time. For 3-D images, this is the slice number; for 4-D images it is the frame number.
-
getDICOMImageType
Description copied from interface:ReadableImageReturns the DICOM image type this image.- Specified by:
getDICOMImageTypein interfaceReadableImage- Returns:
- the DICOM image type for this image, or null if not set for this image.
-
setDICOMImageType
Description copied from interface:WritableImageSets the type of image, in the same way that a DICOM Element with Tag <0x0008, 0x0008> does. No exception occurs if the image format does not support setting of the image type.- Specified by:
setDICOMImageTypein interfaceWritableImage- Parameters:
imageTypes- aString[] with the important image identification characteristics. If null, the image type should be unset.
-
getFrameDICOMImageType
Description copied from interface:ReadableImageReturns the DICOM image type for one dimension index of this image. For 3-D images, the dimension index is the slice dimension. For 4-D (or higher dimensionality) images, the dimension index is the frame dimension.- Specified by:
getFrameDICOMImageTypein interfaceReadableImage- Parameters:
index- the frame for which to return the image type.- Returns:
- the image type for the specified index of this image, or null if not set for this image.
- Throws:
IndexOutOfBoundsException- if the index is bad for this image.
-
setFrameDICOMImageType
Description copied from interface:WritableImageSets the type of image for one for one dimension index of this image, in the same way that a DICOM Element with Tag <0x0008, 0x0008> does. For 3-D images, the dimension index is the slice dimension. For 4-D (or higher dimensionality) images, the dimension index is the frame dimension. No exception occurs if the image format does not support setting of the image type.- Specified by:
setFrameDICOMImageTypein interfaceWritableImage- Parameters:
imageTypes- a {link String}[] with the important image identification characteristics for the given farme. If null, the image type should be unset.index- the index to the image frame for which to set the image type. For 3-D images, this is the slice number; for 4-D images it is the frame number.
-
getSaturationFreqOffsetPPM
Returns the saturation pulse frequency offset for this image if it has a single saturation pulse frequency offset.- Specified by:
getSaturationFreqOffsetPPMin interfaceReadableImage- Returns:
- the saturation pulse frequency offset for this image, in PPM.
-
setSaturationFreqOffsetPPM
Sets the saturation pulse frequency offset for this image, for images with a single saturation pulse frequency offset.
N.B. For disk-based images, the changes in the saturation pulse frequency offset will not be reflected on disk unless the close() method is called.- Specified by:
setSaturationFreqOffsetPPMin interfaceWritableImage- Parameters:
freqOffset- the new saturation pulse frequency offset to be assigned to this image.
-
getFrameSaturationFreqOffsetPPM
Description copied from interface:ReadableImageReturns the scan saturation frequency offset for one dimension index of this image in parts-per-million. For 3-D images, the dimension index is the slice dimension. For 4-D (or higher dimensionality) images, the dimension index is the frame dimension.- Specified by:
getFrameSaturationFreqOffsetPPMin interfaceReadableImage- Parameters:
index- the frame for which to return the saturation frequency offset.- Returns:
- the scan TE for the specified index of this image, or null if not set for this image.
- Throws:
IndexOutOfBoundsException- if the index is bad for this image.
-
setFrameSaturationFreqOffsetPPM
Description copied from interface:WritableImageSets the saturation frequency offset for one dimension index of this image. For 3-D images, the dimension index is the slice dimension. For 4-D (or higher dimensionality) images, the dimension index is the frame dimension. No exception occurs if the image format does not support saturation frequency offset recording.- Specified by:
setFrameSaturationFreqOffsetPPMin interfaceWritableImage- Parameters:
freqOffset- the new saturation frequency offset to be assigned to this image.index- the index to the image frame for which to set the saturation frequency offset. For 3-D images, this is the slice number; for 4-D images it is the frame number.
-
getEchoTrainLength
Returns the echo train length for this image.- Specified by:
getEchoTrainLengthin interfaceReadableImage- Returns:
- the echo train length for this image.
-
setEchoTrainLength
Sets the echo train length for this image. N.B. For disk-based images, the changes in the echo train length will not be reflected on disk unless the close() method is called.- Specified by:
setEchoTrainLengthin interfaceWritableImage- Parameters:
etl- the new echo train length to be assigned to this image; null if the echo train length is to be unassigned.
-
getFlipAngle
Returns the excitation pulse flip angle for this image.- Specified by:
getFlipAnglein interfaceReadableImage- Returns:
- the excitation pulse flip angle for this image.
-
setFlipAngle
Sets the excitation pulse flip angle for this image.
N.B. For disk-based images, the changes in the scan flip angle will not be reflected on disk unless the close() method is called.- Specified by:
setFlipAnglein interfaceWritableImage- Parameters:
flipAngle- the new scan flip angle to be assigned to this image.
-
getFrameDWbValue
Description copied from interface:ReadableImageReturns the diffusion-weighting b-value for one frame of this image.- Specified by:
getFrameDWbValuein interfaceReadableImage- Parameters:
frame- the frame number for which to return the b-value.- Returns:
- the diffusion-weighting b-value for the specified frame of this image, or
nullif the b-value cannot be found, or if the modality used to collect the image doesn't have a b-value defined - Throws:
IndexOutOfBoundsException- if the frame number is bad for this image.
-
setFrameDWbValue
public void setFrameDWbValue(float bValue, int frame) Description copied from interface:WritableImageSets the diffusion-weighting b-value for one "frame" of this image. No exception occurs if the image format does not support recording the b-value.- Specified by:
setFrameDWbValuein interfaceWritableImage- Parameters:
bValue- the new b-value to be assigned to this image.frame- the index to the image frame for which to set the b-value. For 3-D images, this is the slice number; for 4-D images it is the frame number.
-
getFrameDWGradientVector
public org.jogamp.vecmath.Vector3f getFrameDWGradientVector(int frame) throws IndexOutOfBoundsException Description copied from interface:ReadableImageReturns the diffusion-weighting gradient-vector for one frame of this image.- Specified by:
getFrameDWGradientVectorin interfaceReadableImage- Parameters:
frame- the frame number for which to return the gradient-vector.- Returns:
- the diffusion-weighting gradient-vector for the specified frame of this image, or
nullif the gradient vector cannot be found, or if the modality used to collect the image doesn't have a gradient vector defined. - Throws:
IndexOutOfBoundsException- if the frame number is bad for this image.
-
setFrameDWGradientVector
public void setFrameDWGradientVector(org.jogamp.vecmath.Vector3f gradVec, int frame) Description copied from interface:WritableImageSets the diffusion-weighting gradient vector for one "frame" of this image. No exception occurs if the image format does not support recording the gradient vector.- Specified by:
setFrameDWGradientVectorin interfaceWritableImage- Parameters:
gradVec- the new gradient vector to be assigned to this image.frame- the index to the image frame for which to set the gradient vector. For 3-D images, this is the slice number; for 4-D images it is the frame number.
-
getFrameDWBMatrix
Description copied from interface:ReadableImageReturns the diffusion-weighting b-matrix for one frame of this image.- Specified by:
getFrameDWBMatrixin interfaceReadableImage- Parameters:
frame- the frame number for which to get the b-matrix.- Returns:
- the diffusion-weighting b-matrix for this image if it is a
magnetic resonance image, or
nullif the B-matrix cannot be found, or if the modality used to collect the image doesn't have a B-matrix defined. The 6 unique matrix elements are returned as a float[] with elements in the order bXX, bXY, bXZ, bYY, bYZ, bZZ. - Throws:
IndexOutOfBoundsException- if the frame number is bad for this image.
-
setFrameDWBMatrix
public void setFrameDWBMatrix(float[] bMatrix, int frame) Description copied from interface:WritableImageSets the diffusion-weighting B-matrix for one "frame" of this image. No exception occurs if the image format does not support recording the B-matrix.- Specified by:
setFrameDWBMatrixin interfaceWritableImage- Parameters:
bMatrix- the new B-matrix to be assigned to this image.frame- the index to the image frame for which to set the B-matrix. For 3-D images, this is the slice number; for 4-D images it is the frame number.
-
getFrameTriggerDelayMS
Description copied from interface:ReadableImageReturns the trigger delay, in milliseconds, for one frame of this image.- Specified by:
getFrameTriggerDelayMSin interfaceReadableImage- Parameters:
frame- the frame number for which to get the trigger delay.- Returns:
- the trigger delay (in milliseconds) for this image, or
nullif the trigger delay cannot be found. - Throws:
IndexOutOfBoundsException- if the frame number is bad for this image.
-
setFrameTriggerDelayMS
public void setFrameTriggerDelayMS(float delay, int frame) Description copied from interface:WritableImageSets the trigger delay (in milliseconds) for one "frame" of this image. No exception occurs if the image format does not support recording the trigger delay.- Specified by:
setFrameTriggerDelayMSin interfaceWritableImage- Parameters:
delay- the new trigger delay to be assigned to this image.frame- the index to the image frame for which to set the trigger delay. For 3-D images, this is the slice number; for 4-D images it is the frame number.
-
getPatientName
Returns the patient name for this image.- Specified by:
getPatientNamein interfaceReadableImage- Returns:
- the patient name for this image, or
nullif the patient name can't be found.
-
setPatientName
Description copied from interface:WritableImageAttempts to set the patient name for this image. If new patient name String is longer than is allowed by the image format, then it is truncated before being applied. No exception occurs if the image format does not support patient name recording.- Specified by:
setPatientNamein interfaceWritableImage- Parameters:
patientName- the new patient name to be assigned to this image.
-
getPatientID
Returns the patient ID for this image.- Specified by:
getPatientIDin interfaceReadableImage- Returns:
- the patientID for this image, or
nullif the patientID can't be found.
-
setPatientID
Description copied from interface:WritableImageSets the patient ID for this image. If the new patient ID String is longer than is allowed by the image format, then it is truncated before being applied. No exception occurs if the image format does not support patient ID recording.- Specified by:
setPatientIDin interfaceWritableImage- Parameters:
patientID- the new patient ID to be assigned to this image.
-
getPatientDoB
Description copied from interface:ReadableImageReturns the patient date of birth for this image.- Specified by:
getPatientDoBin interfaceReadableImage- Returns:
- the patient's date of birth for this image, or
nullif the patient's dob can't be found.
-
setPatientDoB
Description copied from interface:WritableImageSets the patient's date of birth for this image. No exception occurs if the image format does not support patient date of birth recording.- Specified by:
setPatientDoBin interfaceWritableImage- Parameters:
patientDoB- the new patient date of birth to be assigned to this image.
-
getPatientSex
public com.xinapse.dicom.Sex getPatientSex()Description copied from interface:ReadableImageReturns the patient sex for this image.- Specified by:
getPatientSexin interfaceReadableImage- Returns:
- the patient's sex image, or
Sex.OTHERif the patient's sex can't be found.
-
setPatientSex
public void setPatientSex(com.xinapse.dicom.Sex sex) Description copied from interface:WritableImageSets the patient sex for this image.- Specified by:
setPatientSexin interfaceWritableImage- Parameters:
sex- the patient sex to be assigned to this image.
-
getStudyID
Description copied from interface:ReadableImageReturns the study ID for this ReadableImage.- Specified by:
getStudyIDin interfaceReadableImage- Returns:
- the study ID. Returns
nullif the study ID can't be found.
-
setStudyID
Description copied from interface:WritableImageSets the study ID for this image.- Specified by:
setStudyIDin interfaceWritableImage- Parameters:
studyID- the new study ID to be assigned to this image.
-
getScanDate
Returns the scan date for this image.- Specified by:
getScanDatein interfaceReadableImage- Returns:
- the date/time at which this scan was performed, or
nullif the scan date can't be found.
-
getPulseSequence
Description copied from interface:ReadableImageReturns the name of the pulse sequence with which this image was collected.- Specified by:
getPulseSequencein interfaceReadableImage- Returns:
- the name of the pulse sequence used to collect this image.
-
getScanningSequence
Description copied from interface:ReadableImageReturns the DICOM Scanning Sequence with which this image was collected.- Specified by:
getScanningSequencein interfaceReadableImage- Returns:
- the DICOM Scanning Sequence used to collect this image, or
nullif the scanning sequence isn't available.
-
getSequenceVariant
Description copied from interface:ReadableImageReturns the DICOM Scanning Sequence Variant with which this image was collected.- Specified by:
getSequenceVariantin interfaceReadableImage- Returns:
- the DICOM Scanning Sequence Variant used to collect this image, or
nullif the sequence variant isn't available.
-
getSeriesNumber
Description copied from interface:ReadableImageReturns the series number for this ReadableImage.- Specified by:
getSeriesNumberin interfaceReadableImage- Returns:
- the series number. Returns
nullif the series number can't be found.
-
getSeriesDescription
Description copied from interface:ReadableImageReturns a short description of the series (scan), such as is provided by the DICOM series description.- Specified by:
getSeriesDescriptionin interfaceReadableImage- Returns:
- a short description of the series, or null if none is available.
-
anonymise
public void anonymise(String patientName, String patientID, Date birthDate, boolean patSex, String patAddr, String patInsurancePlanID, String accessionNumber, boolean patOther, String physicianName, String physicianAddr, String institutionName, String institutionAddr, String deptName, String stationName, String telNumber, boolean removePrivateElements) Description copied from interface:WritableImageAnonymise this WritableImage.- Specified by:
anonymisein interfaceWritableImage- Overrides:
anonymisein classANZImage- Parameters:
patientName- if non-null, the patient name to substitute.patientID- if non-null, the patient ID to substitute.birthDate- if non-null, the birth date to substitute.patSex- if true, set the sex to "OTHER".patAddr- if non-null, the address to substitute.patInsurancePlanID- if non-null, the insurance plan ID to substitute.accessionNumber- if non-null, the accession number to substitute.patOther- if true, other patient-related items will be anonymised.physicianName- if non-null, the physician name to substitute.physicianAddr- if non-null, the physician's address to substitute.institutionName- if non-null, the institution name to substitute.institutionAddr- if non-null, the institution address to substitute.deptName- if non-null, the department name to substitute.stationName- if non-null, the station name to substitute.telNumber- if non-null, the telephone number to substitute for all telephone numbers.removePrivateElements- if true, all private DICOM elements will be removed.
-
appendAuditInfo
Appends audit trail information to this image.- Specified by:
appendAuditInfoin interfaceWritableImage- Parameters:
name- a String describing the name of the action that was performed on this image.value- a String describing the value of the action that was performed on this image.
-
putInfo
Description copied from interface:InfoStorerAdds an item to the general file info.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
putInfoin interfaceInfoStorer- Parameters:
name- the name of the information field to put.value- an integer value to be associated with the name in the general file information.
-
putInfo
Description copied from interface:InfoStorerAdds an item to the general file info. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
putInfoin interfaceInfoStorer- Parameters:
name- the name of the information to put.value- a floating point value to be associated with the name in the general file information.
-
putInfo
Description copied from interface:InfoStorerAdds an item to the general file info. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
putInfoin interfaceInfoStorer- Parameters:
name- the name of the information to put.value- aStringto be associated with the name in the general file information.- Throws:
IllegalStateException
-
putInfo
Description copied from interface:InfoStorerAdds an item to the dimension-specific information. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
putInfoin interfaceInfoStorer- Parameters:
name- the name of the information item to put.value- an integer value to be associated with the name in the general file information.dim- the dimension of thisInfoStorerto put the information item. For example in a 3-dimensional image you would put to dimension 0 for slice-specific info.n- the element to put to. For example in a 3-dimensional image you would put to slicento info that applied only to slicen.
-
putInfo
Description copied from interface:InfoStorerAdds an item to the dimension-specific information. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.- Specified by:
putInfoin interfaceInfoStorer- Parameters:
name- the name of the information item to put.value- an floating-point value to be associated with the name in the dimension-specific information.dim- the dimension of thisInfoStorerto put the information. For example in a 3-dimensional image you would put to dimension 0 for slice-specific info.n- the element to put to. For example in a 3-dimensional image you would put to slicento info that applied only to slicen.
-
putInfo
Description copied from interface:InfoStorerAdds an item to the dimension-specific information. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.- Specified by:
putInfoin interfaceInfoStorer- Parameters:
name- the name of the information item to put.value- a String value to be associated with the name in the dimension-specific information.dim- the dimension of thisInfoStorerto put the information. For example in a 3-dimensional image you would put to dimension 0 for slice-specific info.n- the element to put to. For example in a 3-dimensional image you would put to slicento info that applied only to slicen.
-
putSliceInfo
Description copied from interface:InfoStorerAdds all the items in an InfoList to the slice-specific information. If an info item with the same name exists, then then value will be overwritten.The slice number is referenced from 0 to (number of slices - 1).
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
putSliceInfoin interfaceInfoStorer- Parameters:
infoList- the list of InfoItems to put.slice- the slice number.
-
putFrameInfo
Description copied from interface:InfoStorerAdds all the items in an InfoList to the frame-specific information. If an info item with the same name exists, then the value will be overwritten.The frame number is referenced from 0 to (number of frames - 1).
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
putFrameInfoin interfaceInfoStorer- Parameters:
infoList- the list of InfoItems to put.frame- the frame number.
-
putSliceInfo
Description copied from interface:InfoStorerAdds an item to the slice-specific information. If an info item with the same name exists, then then value will be overwritten.The slice number is referenced from 0 to (number of slices - 1).
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
putSliceInfoin interfaceInfoStorer- Parameters:
name- the name of the information item to put.value- a String to be associated with the name in the slice-specific info.slice- the slice number.
-
putFrameInfo
Description copied from interface:InfoStorerAdds an item to the frame-specific information. If an info item with the same name exists, then then value will be overwritten.The frame number is referenced from 0 to (number of frames).
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
putFrameInfoin interfaceInfoStorer- Parameters:
name- the name of the information item to put.value- a String to be associated with the name in the frame-specific info.frame- the frame number.
-
getInfo
Description copied from interface:InfoStorerReturns a string representing the value of an information item in the general image information.For example, if there is a item with a name
"pixel_x_size"and a value"0.91162"in the general info, and name"pixel_x_size"is supplied, then this method will return"0.91162".- Specified by:
getInfoin interfaceInfoStorer- Parameters:
name- the name of an information field.- Returns:
- a
Stringrepresentation of the value of an information field, or null if the name is not found in the general info.
-
getInfo
Description copied from interface:InfoStorerReturns aStringrepresenting the value of an information item in a particular dimension of thisInfoStorer. For example, if there is a item"pixel_x_size=0.91162"in the info for the dimension, and a name"pixel_x_size"is supplied, then this method will return"0.91162".- Specified by:
getInfoin interfaceInfoStorer- Parameters:
name- the name of the information item.dim- the dimension of the image to look for the information. For example in a 3-dimensional image you would look in dimension 0 for slice-specific info.n- the element to look in. For example in a 3-dimensional image you would look in slicento info that applied only to slicen.- Returns:
- a
Stringrepresentation of the value of the information, or null if the name is not found in the dimension/element info.
-
getSliceInfo
Description copied from interface:InfoStorerReturns aStringrepresenting the value of the information item in a particular slice of thisInfoStorer.The slice number is referenced from 0 to (number of slices - 1).
- Specified by:
getSliceInfoin interfaceInfoStorer- Parameters:
name- the name of the information item.slice- the slice number.- Returns:
- a
Stringrepresentation of the value of the information, or null if the name is not found for the specified slice.
-
getFrameInfo
Description copied from interface:InfoStorerReturns aStringrepresenting the value of the information item in a particular frame of thisInfoStorer.The frame number is referenced from 0 to (number of frames - 1).
- Specified by:
getFrameInfoin interfaceInfoStorer- Parameters:
name- the name of the information item.frame- the frame number.- Returns:
- a
Stringrepresentation of the value of the information, or null if the name is not found for the specified frame.
-
removeInfo
Description copied from interface:InfoStorerRemoves an item from the general file information. If an info item with the given name is not present in the general info, then this method does nothing.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
removeInfoin interfaceInfoStorer- Parameters:
name- the name of the information item to be removed.
-
removeInfo
Description copied from interface:InfoStorerRemoves an item from the dimension-specific information. If an info item with the given name is not present in the dimension-specific, then this method does nothing.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless theMultiSliceImage.close()method is called.- Specified by:
removeInfoin interfaceInfoStorer- Parameters:
name- the name of the information item to put.dim- the dimension of thisInfoStorerto from which to remove the information. For example in a 3-dimensional image you would put to dimension 0 for slice-specific info.n- the element to from which to remove the info item. For example in a 3-dimensional image you would put to slicento info that applied only to slicen.
-
getInfoList
Description copied from interface:InfoStorerReturns anInfoListobject which is the general info for thisInfoStorer.- Specified by:
getInfoListin interfaceInfoStorer- Returns:
- an
InfoListwhich is the general file info for thisInfoStorer.
-
setInfoList
Description copied from interface:InfoStorerSets a newInfoListto the general file info of thisInfoStorer.- Specified by:
setInfoListin interfaceInfoStorer- Parameters:
infoList- theInfoListobject to set to the general file info for thisInfoStorer.
-
getInfoList
Description copied from interface:InfoStorerReturns anInfoListobject applying to a particular dimension/element for thisInfoStorer.- Specified by:
getInfoListin interfaceInfoStorer- Parameters:
dim- the dimension for which to get the information list.n- the element for which to get the information list.- Returns:
- an
InfoListobject from a particular dimension of theInfoStorer.
-
getSliceInfoList
Description copied from interface:InfoStorerReturns anInfoListobject applying to a particular slice of thisInfoStorer.The slice number is referenced from 0 to (number of slices - 1).
- Specified by:
getSliceInfoListin interfaceInfoStorer- Parameters:
slice- the slice number.- Returns:
- an
InfoListobject from a particular slice of thisInfoStorer.
-
getFrameInfoList
Description copied from interface:InfoStorerReturns anInfoListobject applying to a particular frame of thisInfoStorer.The frame number is referenced from 0 to (number of frames - 1).
- Specified by:
getFrameInfoListin interfaceInfoStorer- Parameters:
frame- the frame number.- Returns:
- an
InfoListobject from a particular frame of thisInfoStorer.
-
setInfoList
Description copied from interface:InfoStorerSets a newInfoLista specific dimension of thisInfoStorer.- Specified by:
setInfoListin interfaceInfoStorer- Parameters:
infoList- theInfoListto associate with thisInfoStorer/dimension.dim- the dimension to which to set the information list.n- the element to which to set the information list.
-
setSliceInfoList
Description copied from interface:InfoStorerSets a newInfoLista specific slice of thisInfoStorer.- Specified by:
setSliceInfoListin interfaceInfoStorer- Parameters:
infoList- theInfoListto associate with thisInfoStorer/slice.slice- the slice for which to set the information list.
-
setFrameInfoList
Description copied from interface:InfoStorerSets a newInfoLista specific frame of thisInfoStorer.- Specified by:
setFrameInfoListin interfaceInfoStorer- Parameters:
infoList- theInfoListto associate with thisInfoStorer/frame.frame- the frame for which to set the information list.
-
appendInfoList
Description copied from interface:InfoStorerAppends anInfoListto the existing general file info of thisInfoStorer.- Specified by:
appendInfoListin interfaceInfoStorer- Parameters:
infoList- theInfoListobject to append to the general file info for thisInfoStorer.
-
appendInfoList
Appends anInfoListto that for a particular dimension of this image.- Specified by:
appendInfoListin interfaceInfoStorer- Parameters:
infoList- ths list to append.dim- the diemension for which theInfoListwill be appended.n- the element of that dimension for which theInfoListwill be appended.- Throws:
InvalidImageException- if theInfoListcannot be appended.
-
addExtendedData
Adds a block ofExtendedDatato thisNIFTIImage.- Parameters:
extendedData- theExtendedDatato add.- Throws:
ANZException- if theExtendedDatacannot be added.
-
getExtendedData
- Returns:
- a
ListofExtendedData, ornullif there is noExtendedData.
-
removeExtendedData
Removes a block ofExtendedDatafrom thisNIFTIImage. This method does nothing if the suppliedExtendedDatais not present.- Parameters:
extendedData- theExtendedDatato remove.- Throws:
ANZException- if the extended data cannot be removed.
-
stripExtension
-
getFlatSliceDescription
Description copied from interface:ReadableImageReturns a String description of a slice of this image in HTML format.- Specified by:
getFlatSliceDescriptionin interfaceReadableImage- Overrides:
getFlatSliceDescriptionin classANZImage- Parameters:
index- the flat slice number to describe. The flat slice number is (frame * nSlices) + slice.For single-frame images, the flat slice number is just the slice number.html- whether in HTML format.- Returns:
- a String describing this image slice.
-
main
Run the self-test for the NIFTIImage class.- Parameters:
args- a list of images to try to open.
-