Class MultiSliceImage
- All Implemented Interfaces:
ReadableImage, WritableImage, AutoCloseable
WritableImage.-
Nested Class Summary
Nested classes/interfaces inherited from interface ReadableImage
ReadableImage.Position -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe information field name that is written into image headers to indicate the accession number.static final StringA String used when composing audit trail information.static final StringThe information field name that is written into image headers to indicate the patient's birth date.static final StringThe information field name that is written into image headers to indicate the imaged body part.static final StringThe information field name that is written into image headers to indicate the colour mapping.static final StringThe information field name that is written into image headers to indicate the diffusion-weighting B-matrix.static final StringThe information field name that is written into image headers to indicate the diffusion-weighting b-value.static final StringThe information field name that is written into image headers to indicate the diffusion-weighting gradient vector.static final StringThe information field name that is written into image headers to indicate the scan echo time.static final StringThe information field name that is written into image headers to indicate the scan echo train length.static final StringThe information field name that is written into image headers to indicate the excitation pulse flip angle.static final StringThe information field name that is written into image headers to indicate the frame of reference UID for the image position/orientation.static final StringThe information field name that is written into image headers to indicate the orientation (direction cosines) of the matrix of image pixels, in patient coordinates.static final StringThe information field name that is written into image headers to indicate the location of the first pixel of the image, in patient coordinates.static final StringThe information field name that is written into image headers to indicate the image type.static final StringThe information field name that is written into image headers to indicate the intensity rescale intercept.static final StringThe information field name that is written into image headers to indicate the intensity rescale slope.static final StringThe information field name that is written into image headers to indicate the intensity rescale units.static final StringThe information field name that is written into image headers to indicate the scan inversion time.static final StringThe information field name that is written into image headers to indicate the image laterality.static final StringThe information field name that is written into image headers to indicate the imaging modality.static final StringThe information field name that is written into image headers to indicate the patient ID.static final StringThe information field name that is written into image headers to indicate the patient name.static final StringThe information field name that is written into image headers to indicate the way in which the patient is positioned in the scanner.static final StringThe information field name that is written into image headers to indicate the patient's sex.static final StringThe information field name that is written into image headers to indicate the physical distance in the patient between the center of each pixel.static final StringThe information field name that is written into image headers to indicate the width of an image pixel in mm.static final StringThe information field name that is written into image headers to indicate the height of an image pixel in mm.static final StringThe information field name that is written into image headers to indicate the thickness of an image pixel in mm.static final StringThe information field name that is written into image headers to indicate the pulse sequence name.static final StringThe information field name that is written into image headers to indicate the scan repetition time.static final StringThe information field name that is written into image headers to indicate the saturation pulse frequency offset.static final StringThe information field name that is written into image headers to indicate the scan date.static final StringThe information field name that is written into image headers to indicate the DICOM scanning sequence.static final StringThe information field name that is written into image headers to indicate the DICOM scanning sequence variant.static final StringThe information field name that is written into image headers to indicate the series (scan) description.static final StringThe information field name that is written into image headers to indicate the series instance UID.static final StringThe information field name that is written into image headers to indicate the series (scan) number.static final StringThe information field name that is written into image headers to indicate the thickness of an image slice.static final StringThe information field name that is written into image headers to indicate the imaging modality Storage Class UID.static final StringThe information field name that is written into image headers to indicate the study ID.static final StringThe information field name that is written into image headers to indicate the study instance UID.static final StringThe information field name that is written into image headers to indicate the time between frames of a multi-frame image.static final StringThe information field name that is written into image headers to indicate the trigger delay after the R-wave peak. -
Method Summary
Modifier and TypeMethodDescriptionvoidUnsets the "modified" flag for thisMultiSliceImageto indicate that it has been written since any changes were made.voidclose()Closes thisMultiSliceImageand frees up resources.voidGives this image the option to free up resources by removing access to image data.static ObjectdoRescale(ReadableImage image, Object pix) Rescale some pixel intensities from an image according to to the rescale slope and intercept set in the image.static ObjectdoUnRescale(ReadableImage image, Object pix) Undo the rescale some pixel intensities from an image according to to the rescale slope and intercept set in the image.Returns the accession number for this image.com.xinapse.dicom.BodyPartBy default, body part recording is not supported, so this method always returnsnull.static DateFormatReturns the DateFormat used when this class writes dates.com.xinapse.dicom.UidReturns the frame of reference UID that uniquely identifies the frame of reference for an image.com.xinapse.dicom.LateralityBy default, laterality recording is not supported, so this method returnsLaterality.BOTH.Returns the imaging modality with which this image was collected.Returns the imaging plane that this image is "most like".getPix(boolean radiological) Returns all the pixel values for this image, optionally returning them in the correct radiological order in which they will be presented, where the first pixel should be presented at the top left corner of the display device.getPix(int[] pixIdx) Returns a single pixel value from the image.getPix(int[] lowIdx, int[] highIdx) Returns pixel values from this image.Get pixel values from this image into a specified array.Returns aPixelDataTyperepresenting the data type of pixel values for this image, after any intensity scaling has taken place.Returns all pixel values from this image.getROIs()Returns a List of ROIs that are stored with the image.static DateFormatReturns theDateFormatwith which a scan date should be formatted.getSlice(int slice) Returns the pixel values for one slice of an n-dimensional image, where n > 1.Returns all the pixels for a two-dimensional slice of this image, as a 1-dimensional array of primitive values.com.xinapse.dicom.UidReturns the Study Instance UID that uniquely identifies the Study for an image.Returns the suggested file name for in-memory images that are to be saved to disk.booleanTests whether thisMultiSliceImagehas been modified since instantiation.static voidRun the self-test on theMultiSliceImageclass.voidPut pixel values from a specified array to this image.voidPut pixel values from a specified array to this image.voidPuts a single pixel value to the image.voidPut pixel values from a specified array to this image.voidPuts the pixel values to one slice of an n-dimensional image, where n > 1.voidsetAccessionNumber(String accessionNumber) Sets the accession number for this image.voidsetBodyPart(com.xinapse.dicom.BodyPart bodyPart) By default, body part recording is not supported, so this method does nothing.voidsetFrameOfReferenceUID(com.xinapse.dicom.Uid uid) Sets the frame of reference UID that uniquely identifies the frame of reference for an image.abstract 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.abstract voidsetImageOrientationPositionPatient(org.jogamp.vecmath.Vector3f[] orientation, org.jogamp.vecmath.Point3f position, boolean force) Sets the direction cosines of the row, column and slice directions of the image, the coordinates of the center of the first pixel of the image, in patient (LPS) coordinates.voidsetIntensityRescale(float[] rescaleSlopeIntercept) 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.voidsetLaterality(com.xinapse.dicom.Laterality laterality) By default, laterality recording is not supported, so this method does nothing.voidsetMinMax(int[] minmax) Sets the min and max pixel values for this image.voidsetModality(Modality modality) Sets the modality with which this image was acquired.voidSets the "modified" flag for thisMultiSliceImageto indicate that it has been modified since instantiation.abstract voidsetPixelXSize(float width) Sets the pixel size in the x (horizontal) direction for this image.abstract voidsetPixelYSize(float height) Sets the pixel size in the y (vertical) direction for this image.abstract voidsetPixelZSize(float thickness) Sets the pixel size in the z (slice) direction for this image.voidsetSeriesInstanceUID(com.xinapse.dicom.Uid uid) Sets the series instance UID for this image.voidsetStudyInstanceUID(com.xinapse.dicom.Uid uid) Sets the study instance UID for this image.voidsetSuggestedFileName(String name) Sets a suggested file name for images that might be saved to disk later.abstract voidsetTimeBetweenFrames(float deltaT) Sets the time between frames in a 4- or higher dimensional image.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ReadableImage
getAffineTransform, getAffineTransform, getDescription, getDescription, getDICOMImageType, getDims, getEchoTrainLength, getFlatSliceDescription, getFlatSliceDescription, getFlatSliceHTMLDescription, getFlipAngle, getFrameDICOMImageType, getFrameDWBMatrix, getFrameDWbValue, getFrameDWGradientVector, getFrameSaturationFreqOffsetPPM, getFrameTE, getFrameTriggerDelayMS, getHTMLDescription, getImageOrientationPatient, getImageOrientationPatient, getImagePositionPatient, getImagePositionPatient, getIntensityRescale, getMax, getMin, getNativeColourMapping, getNativeHeader, getNCols, getNDim, getNFrames, getNRows, getNSliceLocations, getNSlices, getPatientDoB, getPatientID, getPatientName, getPatientPosition, getPatientSex, getPixelSpacingOrDefaults, getPixelXSize, getPixelYSize, getPixelZSize, getPulseSequence, getRescaleUnits, getSaturationFreqOffsetPPM, getScanDate, getScanningSequence, getScanTE, getScanTI, getScanTR, getSequenceVariant, getSeriesDescription, getSeriesNumber, getSliceThickness, getStoredPixelDataType, getStudyID, getTimeBetweenFrames, getTitle, getTotalNSlices, isOpenMethods inherited from interface WritableImage
addBasicAudit, addBasicAudit, anonymise, appendAuditInfo, appendToTitle, getCopy, getImageTypeName, setDICOMImageType, setEchoTrainLength, setFlipAngle, setFrameDICOMImageType, setFrameDWBMatrix, setFrameDWbValue, setFrameDWGradientVector, setFrameSaturationFreqOffsetPPM, setFrameTE, setFrameTriggerDelayMS, setImagePositionPatient, setIntensityRescale, setMinMax, setNativeColourMapping, setPatientDoB, setPatientID, setPatientName, setPatientPosition, setPatientSex, setPixelSpacing, setPulseSequence, setRescaleUnits, setSaturationFreqOffsetPPM, setScanDate, setScanningSequence, setScanTE, setScanTI, setScanTR, setSequenceVariant, setSeriesDescription, setSeriesNumber, setSliceThickness, setStudyID, setTitle, supportsIntensityRescaling, write
-
Field Details
-
PATIENT_NAME_NAME
The information field name that is written into image headers to indicate the patient name.- See Also:
-
PATIENT_ID_NAME
The information field name that is written into image headers to indicate the patient ID.- See Also:
-
ACCESSION_NUMBER_NAME
The information field name that is written into image headers to indicate the accession number.- See Also:
-
BIRTH_DATE_NAME
The information field name that is written into image headers to indicate the patient's birth date.- See Also:
-
PATIENT_SEX_NAME
The information field name that is written into image headers to indicate the patient's sex.- See Also:
-
STUDY_ID_NAME
The information field name that is written into image headers to indicate the study ID.- See Also:
-
SCAN_DATE_NAME
The information field name that is written into image headers to indicate the scan date.- See Also:
-
STORAGE_CLASS_UID_NAME
The information field name that is written into image headers to indicate the imaging modality Storage Class UID.- See Also:
-
MODALITY_NAME
The information field name that is written into image headers to indicate the imaging modality.- See Also:
-
BODY_PART_NAME
The information field name that is written into image headers to indicate the imaged body part.- See Also:
-
LATERALITY_NAME
The information field name that is written into image headers to indicate the image laterality.- See Also:
-
PULSE_SEQUENCE_NAME
The information field name that is written into image headers to indicate the pulse sequence name.- See Also:
-
SCANNING_SEQUENCE_NAME
The information field name that is written into image headers to indicate the DICOM scanning sequence.- See Also:
-
SEQUENCE_VARIANT_NAME
The information field name that is written into image headers to indicate the DICOM scanning sequence variant.- See Also:
-
SERIES_NUMBER_NAME
The information field name that is written into image headers to indicate the series (scan) number.- See Also:
-
SERIES_DESCRIPTION_NAME
The information field name that is written into image headers to indicate the series (scan) description.- See Also:
-
REPETITION_TIME_NAME
The information field name that is written into image headers to indicate the scan repetition time.- See Also:
-
INVERSION_TIME_NAME
The information field name that is written into image headers to indicate the scan inversion time.- See Also:
-
ECHO_TIME_NAME
The information field name that is written into image headers to indicate the scan echo time.- See Also:
-
IMAGE_TYPE_NAME
The information field name that is written into image headers to indicate the image type.- See Also:
-
SAT_PULSE_FREQ_OFFSET_PPM_NAME
The information field name that is written into image headers to indicate the saturation pulse frequency offset.- See Also:
-
ECHO_TRAIN_LENGTH_NAME
The information field name that is written into image headers to indicate the scan echo train length.- See Also:
-
FLIP_ANGLE_NAME
The information field name that is written into image headers to indicate the excitation pulse flip angle.- See Also:
-
DW_B_VALUE_NAME
The information field name that is written into image headers to indicate the diffusion-weighting b-value.- See Also:
-
DW_GRADIENT_VECTOR_NAME
The information field name that is written into image headers to indicate the diffusion-weighting gradient vector.- See Also:
-
DW_B_MATRIX_NAME
The information field name that is written into image headers to indicate the diffusion-weighting B-matrix.- See Also:
-
TRIGGER_DELAY_NAME
The information field name that is written into image headers to indicate the trigger delay after the R-wave peak.- See Also:
-
COLOUR_MAPPING_NAME
The information field name that is written into image headers to indicate the colour mapping.- See Also:
-
PIXEL_X_SIZE_NAME
The information field name that is written into image headers to indicate the width of an image pixel in mm.- See Also:
-
PIXEL_Y_SIZE_NAME
The information field name that is written into image headers to indicate the height of an image pixel in mm.- See Also:
-
PIXEL_Z_SIZE_NAME
The information field name that is written into image headers to indicate the thickness of an image pixel in mm.- See Also:
-
TIME_BETWEEN_FRAMES_NAME
The information field name that is written into image headers to indicate the time between frames of a multi-frame image.- See Also:
-
STUDY_INSTANCE_UID_NAME
The information field name that is written into image headers to indicate the study instance UID.- See Also:
-
SERIES_INSTANCE_UID_NAME
The information field name that is written into image headers to indicate the series instance UID.- See Also:
-
FRAME_OF_REFERENCE_UID_NAME
The information field name that is written into image headers to indicate the frame of reference UID for the image position/orientation.- See Also:
-
IMAGE_POSITION_PATIENT_NAME
The information field name that is written into image headers to indicate the location of the first pixel of the image, in patient coordinates.- See Also:
-
IMAGE_ORIENTATION_PATIENT_NAME
The information field name that is written into image headers to indicate the orientation (direction cosines) of the matrix of image pixels, in patient coordinates.- See Also:
-
PIXEL_SPACING_NAME
The information field name that is written into image headers to indicate the physical distance in the patient between the center of each pixel.- See Also:
-
PATIENT_POSITION_NAME
The information field name that is written into image headers to indicate the way in which the patient is positioned in the scanner.- See Also:
-
SLICE_THICKNESS_NAME
The information field name that is written into image headers to indicate the thickness of an image slice.- See Also:
-
INTENSITY_RESCALE_SLOPE_NAME
The information field name that is written into image headers to indicate the intensity rescale slope.- See Also:
-
INTENSITY_RESCALE_INTERCEPT_NAME
The information field name that is written into image headers to indicate the intensity rescale intercept.- See Also:
-
INTENSITY_RESCALE_UNITS_NAME
The information field name that is written into image headers to indicate the intensity rescale units.- See Also:
-
AUDIT_TRAIL_ACTION_TEXT
A String used when composing audit trail information.- See Also:
-
-
Method Details
-
isModified
public boolean isModified()Tests whether thisMultiSliceImagehas been modified since instantiation.- Returns:
trueif the image has been modified;falseotherwise.
-
setModified
public void setModified()Sets the "modified" flag for thisMultiSliceImageto indicate that it has been modified since instantiation. -
clearModified
public void clearModified()Unsets the "modified" flag for thisMultiSliceImageto indicate that it has been written since any changes were made. -
setSuggestedFileName
Sets a suggested file name for images that might be saved to disk later.- Specified by:
setSuggestedFileNamein interfaceWritableImage- Parameters:
name- the suggested file name.
-
getSuggestedFileName
Description copied from interface:ReadableImageReturns the suggested file name for in-memory images that are to be saved to disk.- Specified by:
getSuggestedFileNamein interfaceReadableImage- Returns:
- the suggested file name, or
nullif not set.
-
setPixelXSize
Sets the pixel size in the x (horizontal) direction for this image.- Parameters:
width- the width of a pixel.- Throws:
IllegalArgumentException- if the pixel width is not positive.IOException- if and I/O error occurs.
-
setPixelYSize
Sets the pixel size in the y (vertical) direction for this image.- Parameters:
height- the height of a pixel.- Throws:
IllegalArgumentException- ifheightis not positive.IOException- if an I/O error occurs.IndexOutOfBoundsException- if the image doesn't have a dimensionality of at least 2.
-
setPixelZSize
Sets the pixel size in the z (slice) direction for this image.- Parameters:
thickness- the thickness of a pixel.- Throws:
IllegalArgumentException- ifthicknessis not positive.IOException- if an I/O error occurs.IndexOutOfBoundsException- if the image doesn't have a dimensionality of at least 3.
-
setTimeBetweenFrames
public abstract void setTimeBetweenFrames(float deltaT) throws IllegalArgumentException, IOException Sets the time between frames in a 4- or higher dimensional image.- Parameters:
deltaT- the time between frames (in seconds).- Throws:
IllegalArgumentException- ifdeltaTis negative.IOException- if an I/O error occurs.IndexOutOfBoundsException- if the image doesn't have a dimensionality of at least 4.
-
setImageOrientationPositionPatient
public abstract void setImageOrientationPositionPatient(org.jogamp.vecmath.Vector3f[] orientation, org.jogamp.vecmath.Point3f position, boolean force) throws IndexOutOfBoundsException Sets the direction cosines of the row, column and slice directions of the image, the coordinates of the center of the first pixel of the image, in patient (LPS) coordinates.N.B. the actual position and orientation set by this method may not be those specified. For example, for NIFTI-1 images, the actual orientation and position may depend on the user
Preferencesfor whether to put pixel values in an order that is compatible with SPM. After using this method, you should use theReadableImage.getImageOrientationPatient()andReadableImage.getImagePositionPatient()methods to obtain the real orientation and positions set.If the orientation or position cannot be set for this image, this method does not report an error.
- Specified by:
setImageOrientationPositionPatientin interfaceWritableImage- Parameters:
orientation- the direction cosines of the image row, column and (optionally) slice directions respectively in Left,Posterior,Superior (LPS) coordinates. If orientation isnull, this method will attempt to clear any orientation information, if that is supported by the image format.position- the Left,Posterior,Superior (LPS) coordinates of the centre of the first pixel in the image data matrix. If position isnull, this method will attempt to clear any positional information, if that is supported by the image format.force- iftrue, this method will force the orientation and position to be set as requested, regardless of the userPreferences. This can be useful if you read the orientation from an existing image, and you want to set the orientation exactly the same in a new image.- Throws:
IndexOutOfBoundsException- if theorientationarray does not have the correct length.
-
getMostLikePlane
Description copied from interface:ReadableImageReturns the imaging plane that this image is "most like".- Specified by:
getMostLikePlanein interfaceReadableImage- Returns:
- the plane that is "most" like the imaging plane for this image. Returns
MostLikePlane.UNKNOWNif the imaging plane cannot be determined, or if the image does not contain a set of parallel slices.
-
setImageOrientationPatient
public abstract void setImageOrientationPatient(org.jogamp.vecmath.Vector3f[] orientation, int slice) throws IndexOutOfBoundsException Sets 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- 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.
-
setIntensityRescale
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:
rescaleSlopeIntercept- an array of length 2, containing the values ofmandbin the expression above, in that order.- Throws:
InvalidImageException- if rescaling cannot be set for this image.
-
getAccessionNumber
Description copied from interface:ReadableImageReturns the accession number for this image.- Specified by:
getAccessionNumberin interfaceReadableImage- Returns:
- the accession number for this image, or
nullif the accession number can't be found.
-
setAccessionNumber
Description copied from interface:WritableImageSets the accession number for this image. If the new accession number 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 accession number recording.- Specified by:
setAccessionNumberin interfaceWritableImage- Parameters:
accessionNumber- the new accession number to be assigned to this image.
-
getModality
Description copied from interface:ReadableImageReturns the imaging modality with which this image was collected.- Specified by:
getModalityin interfaceReadableImage- Returns:
- the
Modalityused to collect this image.
-
setModality
Description copied from interface:WritableImageSets the modality with which this image was acquired. No exception occurs if the image format does not support modality recording.- Specified by:
setModalityin interfaceWritableImage- Parameters:
modality- the new imaging modality to be assigned to this image.
-
getFrameOfReferenceUID
public com.xinapse.dicom.Uid getFrameOfReferenceUID()Description copied from interface:ReadableImageReturns the frame of reference UID that uniquely identifies the frame of reference for an image.- Specified by:
getFrameOfReferenceUIDin interfaceReadableImage- Returns:
- the frame of reference UID, or
nullif this image does not have frame of reference UID.
-
getStudyInstanceUID
public com.xinapse.dicom.Uid getStudyInstanceUID()Description copied from interface:ReadableImageReturns the Study Instance UID that uniquely identifies the Study for an image.- Specified by:
getStudyInstanceUIDin interfaceReadableImage- Returns:
- the Study Instance UID, or
nullif this image does not have a Study Instance UID.
-
setStudyInstanceUID
public void setStudyInstanceUID(com.xinapse.dicom.Uid uid) Description copied from interface:WritableImageSets the study instance UID for this image.- Specified by:
setStudyInstanceUIDin interfaceWritableImage- Parameters:
uid- the new study instance UID to be assigned to this image.
-
setSeriesInstanceUID
public void setSeriesInstanceUID(com.xinapse.dicom.Uid uid) Description copied from interface:WritableImageSets the series instance UID for this image.- Specified by:
setSeriesInstanceUIDin interfaceWritableImage- Parameters:
uid- the new series instance UID to be assigned to this image.
-
setFrameOfReferenceUID
public void setFrameOfReferenceUID(com.xinapse.dicom.Uid uid) Description copied from interface:WritableImageSets the frame of reference UID that uniquely identifies the frame of reference for an image.- Specified by:
setFrameOfReferenceUIDin interfaceWritableImage- Parameters:
uid- the frame of reference UID. If uid is null, the frame of reference Uid is removed from the image header.
-
getDateFormat
Returns the DateFormat used when this class writes dates.- Returns:
- the DateFormat used when this class writes dates.
-
getScanDateFormat
Returns theDateFormatwith which a scan date should be formatted.- Returns:
- the
DateFormatwith which a scan date should be formatted.
-
getBodyPart
public com.xinapse.dicom.BodyPart getBodyPart()By default, body part recording is not supported, so this method always returnsnull.- Specified by:
getBodyPartin interfaceReadableImage- Returns:
null.
-
setBodyPart
public void setBodyPart(com.xinapse.dicom.BodyPart bodyPart) By default, body part recording is not supported, so this method does nothing.- Specified by:
setBodyPartin interfaceWritableImage- Parameters:
bodyPart- body the imaged body part.
-
getLaterality
public com.xinapse.dicom.Laterality getLaterality()By default, laterality recording is not supported, so this method returnsLaterality.BOTH.- Specified by:
getLateralityin interfaceReadableImage- Returns:
Laterality.BOTH.
-
setLaterality
public void setLaterality(com.xinapse.dicom.Laterality laterality) By default, laterality recording is not supported, so this method does nothing.- Specified by:
setLateralityin interfaceWritableImage- Parameters:
laterality- the image laterality.
-
getRawPix
Returns all pixel values from this image. The pixel values are returned in the order in which they are stored internally.- Specified by:
getRawPixin interfaceReadableImage- Returns:
- a one-dimensional array of pixel values of the correct type for this image.
- Throws:
IllegalStateException- if an error occurs while accessing the pixel values.
-
getPix
Description copied from interface:ReadableImageReturns all the pixel values for this image, optionally returning them in the correct radiological order in which they will be presented, where the first pixel should be presented at the top left corner of the display device.- Specified by:
getPixin interfaceReadableImage- Parameters:
radiological-trueif the pixels are to be returned in the correct order for presentation, where the first returned pixel is to be presented at the top left, and the last at the bottom right of the display device;falseif the are to be return in the order in which they are stored internally.- Returns:
- all the pixel values for this image.
- Throws:
IllegalStateException
-
getPix
Description copied from interface:ReadableImageReturns pixel values from this image. ThelowIdxandhighIdxarrays should have at least a number of elements at least equal to the dimensionality of the image, and the elements specifing the pixel number range for each dimension (the upper range index is exclusive). For example, if an image has 3 dimensions, and dimensions of {5, 256, 256}, then pixels for the middle three slices will be returned by setting lowIdx to {1, 0, 0} and highIdx to {4, 256, 256}.- Specified by:
getPixin interfaceReadableImage- Parameters:
lowIdx- an array ofintspecifying the low index of pixel values to get.highIdx- an array ofintspecifying the high index of pixel values to get. The high index is exclusive.- Returns:
- a one-dimensional array of pixel values of the correct type for this image, cast to an Object.
- Throws:
IllegalStateException
-
getPix
public Object getPix(Object array, int[] lowIdx, int[] highIdx) throws IllegalStateException, IllegalArgumentException Description copied from interface:ReadableImageGet pixel values from this image into a specified array. array is a 1-dimensional array of the correct type of element for this image into which pixel values will be copied; it must be cast to anObjectand must have enough elements to contain all the pixel values requested. ThelowIdxandhighIdxint arrays should have at least a number of elements at least equal to the dimensionality of the image, and the elements specifing the pixel number range for each dimension. For example, if an image has 3 dimensions, and dimensions of {5, 256, 256}, then pixels for the middle three slices will be returned by setting lowIdx to {1, 0, 0} and highIdx to {4, 256, 256}.- Specified by:
getPixin interfaceReadableImage- Parameters:
array- a 1-dimensional array of length at least enough to contain all the pixel values, and of the correct java primitive data type.lowIdx- an array ofintspecifying the low index of pixel values to get.highIdx- an array ofintspecifying the high index of pixel values to get.- Returns:
- a one-dimensional array of pixel values of the correct type for this image, cast to an Object.
- Throws:
IllegalArgumentException- if the indices supplied extend beyond the image, if the supplied array is of the wrong primitive data type, or if the pixel values cannot be gotten for other reasons.IllegalStateException
-
putPix
Put pixel values from a specified array to this image. array is an array of the correct type of element for this image from which pixel values will be copied; it must be cast to anObjectand must have the correct number of elements. The pixel values are set in the order in which they are stored internally.- Parameters:
array- a 1-dimensional array of pixel values of the correct java primitive data type to put to the image.- Throws:
IllegalStateException- if an I/O error occurs while accessing the pixel values.IllegalArgumentException- if the pixel values are of the wrong primitive data type, or cannot be put for other reasons.
-
putPix
Put pixel values from a specified array to this image. array is an array of the correct type of element for this image from which pixel values will be copied; it must be cast to anObjectand must have the correct number of elements.- Specified by:
putPixin interfaceWritableImage- Parameters:
array- a 1-dimensional array of pixel values of the correct java primitive data type to put to the image.radiological-trueif the pixels have a standard radiological orientation Standard radiological orientation is:- For axial images, increasing left coordinate with column number, and increasing posterior coordinate with row number.
- For coronal images, increasing left coordinate with column number, and increasing inferior coordinate with row number.
- For sagittal images, increasing posterior coordinate with column number, and increasing inferior coordinate with row number.
false, the pixels are put without any consideration of the orientation.- Throws:
IllegalStateException- if an I/O error occurs while accessing the pixel values.IllegalArgumentException- if the pixel values are of the wrong primitive data type, or cannot be put for other reasons.
-
putPix
Put pixel values from a specified array to this image. array is an array of the correct type of element for this image from which pixel values will be copied; it must be cast to anObjectand must have the right number of elements to copy to the pixel values requested. ThelowIdxandhighIdxint arrays should have at least nDim elements, and the elements specify the pixel number range for each dimension. For example, if an image hasnDim= 3, anddims[] = {5, 256, 256}, then pixels for the middle 3 slices will be returned by setting lowIdx to {1, 0, 0} and highIdx to {4, 256, 256}.- Specified by:
putPixin interfaceWritableImage- Parameters:
array- a 1-dimensional array of pixel values of the correct java primitive data type to put to the image.lowIdx- an array ofintspecifying the low index of pixel values to put.highIdx- an array ofintspecifying the high index of pixel values to put.- Throws:
IllegalStateException- if an error occurs while accessing the pixel values.IllegalArgumentException- if the indices supplied extend beyond the image, the pixel values are of the wrong primitive data type or cannot be put for other reasons.
-
getPix
Returns a single pixel value from the image.- Specified by:
getPixin interfaceReadableImage- Parameters:
pixIdx- an int[] of length at least equal tonDimfor this image where each element corresponds to an index to the pixel in each dimension. The first element ofpixIdxrefers to the slowest-varying dimension, and the last relevant element refers to the fastest-varying dimension. For example, for a 3-D image,pixIdx[0]refers to the slice dimension, andpixIdx[2]refers to the column dimension.- Returns:
- the pixel value as a java Object cast from the appropriate class. For example, for a short int image, the pixel will be a Short cast to Object.
- Throws:
IllegalStateException- if the pixel data cannot be retrieved.
-
putPix
Puts a single pixel value to the image.- Specified by:
putPixin interfaceWritableImage- Parameters:
pixValue- the pixel value to put, as a suitable Object.pixIdx- an int[] of length at least equal tonDimfor this image where each element corresponds to an index to the pixel in each dimension. The first element ofpixIdxrefers to the slowest-varying dimension, and the last relevant element refers to the fastest-varying dimension. For example, for a 3-D image,pixIdx[0]refers to the slice dimension, andpixIdx[2]refers to the column dimension.- Throws:
IllegalStateException- if the image was opened read-only.IllegalArgumentException- if the indices are inappropriate for this image, if the supplied pixel is of the wrong Class, or if the pixel value cannot be put to the image.
-
getSlice
Description copied from interface:ReadableImageReturns the pixel values for one slice of an n-dimensional image, where n > 1.N.B.The pixel values are always returned in a standard radiological orientation. Standard radiological orientation is:
- For axial images, increasing left coordinate with column number, and increasing posterior coordinate with row number.
- For coronal images, increasing left coordinate with column number, and increasing inferior coordinate with row number.
- For sagittal images, increasing posterior coordinate with column number, and increasing inferior coordinate with row number.
- Specified by:
getSlicein interfaceReadableImage- Parameters:
slice- the slice number. Must be 0 for a 2-dimensional image or from 0 to dims[0]-1 for a 3-dimensional image. For images of higher dimensionality, each extra dimension multiplies the number of available slices by the size in that dimension, so all images of higher dimensionality that 1 look like multi-slice images.- Returns:
- a 1-dimensional array of the primitive java type appropriate for this image, and of size [nRows * nCols]. This array is cast to an Object before return.
- Throws:
IllegalStateException
-
getSlice
public Object getSlice(Object array, int slice) throws IllegalStateException, IndexOutOfBoundsException Description copied from interface:ReadableImageReturns all the pixels for a two-dimensional slice of this image, as a 1-dimensional array of primitive values. The pixels values are ordered so that the first pixel in the returned array should be displayed at the top left corner of the 2-D image array, when viewed in standard radiological orientation.If the supplied array is null, a new array will be created and returned.
- Specified by:
getSlicein interfaceReadableImage- Parameters:
array- an array of suitable length and of a suitable primitive data type for this image.slice- the slice number. Slices numbered from zero up to one less than the total number of slices in this image, regardless of the dimensionality of the image.- Returns:
- an array of the correct primitive data type for this image.
- Throws:
IndexOutOfBoundsException- if the slice number is invalid for this image,IllegalStateException
-
putSlice
Puts the pixel values to one slice of an n-dimensional image, where n > 1.N.B.Whenever the radiological orientation of the image can be determined, this method sets pixel values such that when the slice is viewed on-screen, the first pixel in the array belongs at the top left of the screen, and the last pixel in the array belongs at the bottom right of the screen. This is regardless of the sub-class of image (for example, the flipping of Analyze images is taken care of by this method).
- Specified by:
putSlicein interfaceWritableImage- Parameters:
array- a 1-dimensional array of the correct primitive java data type for this image, with dimensions [nRows * nCols] containing the pixel values to put.slice- the slice number. Must be 0 for a 2-dimensional image or from 0 to dims[0]-1 for a 3-dimensional image.- Throws:
IllegalStateException- if an I/O error occurs while putting the pixel values, or if the array is not of the correct primitive data type for this image.ArrayIndexOutOfBoundsException- if the image does not have the right dimensionality, if the slice number is inappropriate for this image.
-
getPresentationPixelDataType
Description copied from interface:ReadableImageReturns aPixelDataTyperepresenting the data type of pixel values for this image, after any intensity scaling has taken place.- Specified by:
getPresentationPixelDataTypein interfaceReadableImage- Returns:
- the
PixelDataTyperepresenting the data type of this image after any remapping of intensity values (rescaling and adding an intensity offset) has taken place.
-
setMinMax
Sets the min and max pixel values for this image. It is up to the caller to ensure that the values supplied are correct at the time they are written to the image. Any subsequent changes to the image pixel values may cause either the values returned by getMin() and getMax() to be incorrect, or cause these methods to throw a InvalidImageException.- Parameters:
minmax- an int array of length at least 2, where the first element is the minimum pixel value in the image, and second element is the maximum pixel value in the image.- Throws:
InvalidImageException- if the values supplied are unsuitable, or the values cannot be set.
-
getROIs
Description copied from interface:ReadableImageReturns a List of ROIs that are stored with the image.- Specified by:
getROIsin interfaceReadableImage- Returns:
- a List of ROIs that are stored with the image, or
nullif there are no ROIs stored with the image.
-
close
Closes thisMultiSliceImageand frees up resources. If the image has been read from disk, has been modified, and is writable, then any changes are written to the disk file by this method. Any further operations to a closedMultiSliceImageare not possible, and may cause an exception to be thrown.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceReadableImage- Throws:
InvalidImageException- if the image not valid and needs to be written.IOException- if the file cannot be written or closed.
-
disposeImageData
public void disposeImageData()Description copied from interface:ReadableImageGives this image the option to free up resources by removing access to image data. After this method is called, image data may no longer be accessible, and method calls to access it may result in an Exception being thrown.- Specified by:
disposeImageDatain interfaceReadableImage
-
doRescale
Rescale some pixel intensities from an image according to to the rescale slope and intercept set in the image.- Parameters:
image- the image from which to get the rescale slope and intercept.pix- the pixel values to rescale.- Returns:
- the rescaled pixel intensities, which may be a new Object or the original one supplied.
-
doUnRescale
Undo the rescale some pixel intensities from an image according to to the rescale slope and intercept set in the image.- Parameters:
image- the image from which to get the rescale slope and intercept.pix- the pixel values to undo the rescaling.- Returns:
- the un-rescaled pixel intensities, which may be a new Object or the original one supplied.
-
main
Run the self-test on theMultiSliceImageclass.- Parameters:
args- ignored.
-