Class MultiSliceImage
- All Implemented Interfaces:
ReadableImage,WritableImage,AutoCloseable,Cloneable
WritableImage.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.xinapse.image.ReadableImage
ReadableImage.Position -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic 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 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.protected StringThe "mode" with which the image was opened, if a disk-file: either "r" or "rw".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.protected PixArrayIf non-null, pixel data held in this PixArray object.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.protected RandomAccessFileIf non-null, pixel data kept on disk and accessed via this RandomAccessFile.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. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor forMultiSliceImagefor use by sub-classes. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a copy of thisMultiSliceImage.com.xinapse.dicom.BodyPartBy default, body part recording is not supported, so this method always returnsnull.protected abstract ByteOrderReturns the byte order for this image.static DateFormatReturns the DateFormat used when this class writes dates.protected abstract intReturns the byte offset into the disk-based file format where pixel data begins.protected intReturns the index number to the "frame" dimension of the image.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()Returns all pixel values from this image.getPix(boolean radiological) Returns all pixel values from this image.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.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.protected intReturns the index number to the "slice" dimension of the image.Returns all the pixel values for this image in the order in which they are stored internally, and in the format they are stored internally.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.protected static double[]parseMultiValuedString(String s, int nValues) Convenience method to parse Strings of the form "value1\value2\value3\…\valueN", where value1 to valueN are numerical values.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.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.abstract voidsetMinMax(int min, int max) 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 in-memory 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 java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.xinapse.image.ReadableImage
close, disposeImageData, getAffineTransform, getAffineTransform, getDescription, getDescription, getDims, getEchoTrainLength, getFlipAngle, getFrameDWBMatrix, getFrameDWbValue, getFrameDWGradientVector, getFrameTriggerDelayMS, getHTMLDescription, getHTMLDescription, getImageOrientationPatient, getImageOrientationPatient, getImagePositionPatient, getImagePositionPatient, getIntensityRescale, getMax, getMin, getNativeColourMapping, getNativeHeader, getNCols, getNDim, getNFrames, getNRows, getNSliceLocations, getNSlices, getPatientDoB, getPatientID, getPatientName, getPatientPosition, getPatientSex, getPixelXSize, getPixelYSize, getPixelZSize, getPulseSequence, getRescaleUnits, getSaturationFreqOffsetPPM, getSaturationFreqOffsetPPM, getScanDate, getScanningSequence, getScanTE, getScanTE, getScanTI, getScanTR, getSequenceVariant, getSeriesDescription, getSeriesNumber, getSliceDWBMatrix, getSliceDWbValue, getSliceDWGradientVector, getSliceThickness, getSliceTriggerDelayMS, getStoredPixelDataType, getStudyID, getTimeBetweenFrames, getTitle, getTotalNSlices, isOpenMethods inherited from interface com.xinapse.image.WritableImage
anonymise, appendAuditInfo, appendToTitle, getCopy, getImageTypeName, setEchoTrainLength, setFlipAngle, setFrameDWBMatrix, setFrameDWbValue, setFrameDWGradientVector, setFrameTriggerDelayMS, setImagePositionPatient, setIntensityRescale, setNativeColourMapping, setPatientDoB, setPatientID, setPatientName, setPatientPosition, setPatientSex, setPixelSpacing, setPulseSequence, setRescaleUnits, setSaturationFreqOffsetPPM, setSaturationFreqOffsetPPM, setScanDate, setScanningSequence, setScanTE, setScanTE, setScanTI, setScanTR, setSequenceVariant, setSeriesDescription, setSeriesNumber, setSliceDWBMatrix, setSliceDWbValue, setSliceDWGradientVector, setSliceThickness, setSliceTriggerDelayMS, 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:
-
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:
-
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:
-
pixArray
If non-null, pixel data held in this PixArray object. -
randomAccessFile
If non-null, pixel data kept on disk and accessed via this RandomAccessFile. However, it isn't compulory to have access to the pixel data: if all the user wants is the image header info, both could be null. -
mode
The "mode" with which the image was opened, if a disk-file: either "r" or "rw".
-
-
Constructor Details
-
MultiSliceImage
protected MultiSliceImage()Default constructor forMultiSliceImagefor use by sub-classes.MultiSliceImageObjects cannot be directly instantiated.
-
-
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. -
getSliceDim
Returns the index number to the "slice" dimension of the image.- Returns:
- the index number to the "slicee" dimension of the image.
- Throws:
IndexOutOfBoundsException- if this not a 3- (or higher) dimensional image.
-
getFrameDim
Returns the index number to the "frame" dimension of the image.- Returns:
- the index number to the "frame" dimension of the image.
- Throws:
IndexOutOfBoundsException- if this not a 4- (or higher) dimensional image.
-
setSuggestedFileName
Sets a suggested file name for in-memory 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.
-
getByteOrder
Returns the byte order for this image.- Returns:
- the byte oder for this image, or
nullif the byte order is not defined yet (in-memory images only).
-
getFileDataOffset
protected abstract int getFileDataOffset()Returns the byte offset into the disk-based file format where pixel data begins.- Returns:
- the byte offset to the start of pixel data for images that are written to disk.
-
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 IOException, 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.IOException- if an I/O error occurs.
-
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
public void setIntensityRescale(float[] rescaleSlopeIntercept) throws InvalidImageException, IOException 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.IOException- if an I/O error occurs.
-
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.
N.B. For disk-based images, the changes in the modality will not be reflected on disk unless the close() method is called.- Specified by:
setModalityin interfaceWritableImage- Parameters:
modality- the new imaging modality to be assigned to this image.- Throws:
IOException- if modality cannot be set.
-
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.
-
setStudyInstanceUID
public void setStudyInstanceUID(com.xinapse.dicom.Uid uid) Description copied from interface:WritableImageSets the study instance UID for this image.
N.B. For disk-based images, the changes in the study instance UID will not be reflected on disk unless the close() method is called.- 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.
N.B. For disk-based images, the changes in the series instance UID will not be reflected on disk unless the close() method is called.- 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
By default, body part recording is not supported, so this method does nothing.- Specified by:
setBodyPartin interfaceWritableImage- Parameters:
bodyPart- body the imaged body part.- Throws:
IOException- if body part cannot be set.
-
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
By default, laterality recording is not supported, so this method does nothing.- Specified by:
setLateralityin interfaceWritableImage- Parameters:
laterality- the image laterality.- Throws:
IOException- if laterality cannot be set.
-
getPix
Returns all pixel values from this image. The pixel values are returned in the order in which they are stored internally.- Specified by:
getPixin interfaceReadableImage- Returns:
- a one-dimensional array of pixel values of the correct type for this image, cast to an Object.
- Throws:
IllegalStateException- if an error occurs while accessing the pixel values.
-
getPix
Returns all pixel values from this image.- Specified by:
getPixin interfaceReadableImage- Parameters:
radiological-trueif a standard radiological orientation of the array of pixels is required. 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 returned without any consideration of the orientation.- Returns:
- a one-dimensional array of pixel values of the correct type for this image, cast to an Object.
- Throws:
IllegalStateException- if an error occurs while accessing the pixel values.
-
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. 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, 255, 255}.- 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.- Returns:
- a one-dimensional array of pixel values of the correct type for this image, cast to an Object.
- Throws:
IllegalStateException
-
getPix
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, 255, 255}.- 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.
-
getStoredPix
Description copied from interface:ReadableImageReturns all the pixel values for this image in the order in which they are stored internally, and in the format they are stored internally.- Specified by:
getStoredPixin interfaceReadableImage- Returns:
- all the pixel values for this image.
-
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 slices 4 will be returned by setting lowIdx to {1, 0, 0} and highIdx to {4, 255, 255}.- 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:
IOException- if an I/O error occurs while accessing the pixel values.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 written 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.
-
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.- Specified by:
setMinMaxin interfaceWritableImage- Parameters:
min- the minimum pixel value in the image.max- the maximum pixel value in the image.- Throws:
InvalidImageException- if the array supplied is 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.
-
clone
Returns a copy of thisMultiSliceImage. The copy will always be an in-memory image, regardless of whether the original is in-memory or on disk.- Overrides:
clonein classObject- Returns:
- a clone of this
MultiSliceImageinstance.
-
parseMultiValuedString
Convenience method to parse Strings of the form "value1\value2\value3\…\valueN", where value1 to valueN are numerical values.- Parameters:
s- theStringto be parsed.nValues- the number of values expected ins.- Returns:
- the multiple values in s as a double[].
- Throws:
ParseException- if nValues numerical values cannot be parsed from String s.
-
main
Run the self-test on theMultiSliceImageclass.- Parameters:
args- ignored.
-