Class UNCImage
- All Implemented Interfaces:
ReadableImage,WritableImage,InfoStorer,AutoCloseable,Cloneable
UNCImage object may be either purely held in memory, or may have its pixel data
kept on disk.
Note that only big-endian byte ordering is implemented and supported.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.xinapse.image.ReadableImage
ReadableImage.Position -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe default setting for the whether UNC images can be overwritten.static final intThe maximum dimensionality of an image.static final intThe number of entries in an image histogramFields inherited from class com.xinapse.multisliceimage.MultiSliceImage
AUDIT_TRAIL_ACTION_TEXT, BIRTH_DATE_NAME, BODY_PART_NAME, COLOUR_MAPPING_NAME, DW_B_MATRIX_NAME, DW_B_VALUE_NAME, DW_GRADIENT_VECTOR_NAME, ECHO_TIME_NAME, ECHO_TRAIN_LENGTH_NAME, FLIP_ANGLE_NAME, FRAME_OF_REFERENCE_UID_NAME, IMAGE_ORIENTATION_PATIENT_NAME, IMAGE_POSITION_PATIENT_NAME, INTENSITY_RESCALE_INTERCEPT_NAME, INTENSITY_RESCALE_SLOPE_NAME, INTENSITY_RESCALE_UNITS_NAME, INVERSION_TIME_NAME, LATERALITY_NAME, MODALITY_NAME, mode, PATIENT_ID_NAME, PATIENT_NAME_NAME, PATIENT_POSITION_NAME, PATIENT_SEX_NAME, pixArray, PIXEL_SPACING_NAME, PIXEL_X_SIZE_NAME, PIXEL_Y_SIZE_NAME, PIXEL_Z_SIZE_NAME, PULSE_SEQUENCE_NAME, randomAccessFile, REPETITION_TIME_NAME, SAT_PULSE_FREQ_OFFSET_PPM_NAME, SCAN_DATE_NAME, SCANNING_SEQUENCE_NAME, SEQUENCE_VARIANT_NAME, SERIES_DESCRIPTION_NAME, SERIES_INSTANCE_UID_NAME, SERIES_NUMBER_NAME, SLICE_THICKNESS_NAME, STORAGE_CLASS_UID_NAME, STUDY_ID_NAME, STUDY_INSTANCE_UID_NAME, TIME_BETWEEN_FRAMES_NAME, TRIGGER_DELAY_NAME -
Constructor Summary
ConstructorsConstructorDescriptionUNCImage()Creates an uninitialised instance of a UNCImage.UNCImage(UNCPixFormat pixform, int dimc, int[] dimv) Creates an in-memoryUNCImagewith the given type of pixel and dimensions.UNCImage(DataInputStream s, boolean skipPixelData) Creates an in-memoryUNCImage, loading all information from the data input stream.UNCImage(File f, UNCPixFormat pixform, int dimc, int[] dimv) Creates a disk-basedUNCImagewith the given type of pixel and dimensions.UNCImage(String fileName, UNCPixFormat pixform, int dimc, int[] dimv) Creates a disk-basedUNCImagewith the given type of pixel and dimensions. -
Method Summary
Modifier and TypeMethodDescriptionvoidanonymise(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 list) Appends anInfoListto the existing general file info of this image.voidappendInfoList(InfoList list, int dim, int n) Appends anInfoListto that existing for a specific dimension of this image.voidclose()Closes aUNCImageand frees up resources.voidCopies all the info fields to another image.voidGives this image the option to free up resources by removing access to image data.com.xinapse.dicom.BodyPartBy default, body part recording is not supported, so this method always returnsnull.Returns the byte order for this image.intReturns the number of bytes per pixel for this image.static StringReturns the common name for this type of image.getCopy()Returns a copy of thisWritableImage.Returns a String description of this image.getDescription(int slice) Returns a String description of this one particular slice of this image.intgetDimc()Returns the dimensionality of this image.int[]getDims()Returns the dimensions (numbers of samples in each image dimension) of this image.int[]getDimv()Returns the dimensions of this image.Returns the scan echo train length for this image.intReturns the byte offset into the disk-based file format where pixel data begins.Returns the excitation pulse flip angle for 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 4-D image.org.jogamp.vecmath.Vector3fgetFrameDWGradientVector(int frame) Returns the diffusion-weighting gradient-vector for one frame of this image 4-D image.getFrameInfo(String name, int frame) Returns aStringrepresenting the value of this information item in a particular frame of this image.getFrameInfoList(int frame) Returns anInfoListobject applying to a particular frame of this image.getFrameTriggerDelayMS(int frame) Returns the trigger delay, in milliseconds, for one frame of this image.Returns a String description of this image in HTML format.getHTMLDescription(int slice) Returns a String description of a slice of this image in HTML format.org.jogamp.vecmath.Vector3f[]Returns the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient (L,P,S) coordinates.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.Point3fReturns the coordinates of the center of the first pixel of the image, in mm, 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 normal human readable name for this type of image.Returns a string representing the value of this information item in the general image information.Returns aStringrepresenting the value of this information item in a particular dimension of this image.Returns anInfoListobject which is the general info for this image.getInfoList(int dim, int n) Returns anInfoListobject applying to a particular dimension/element for this image.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.com.xinapse.dicom.LateralityBy default, laterality recording is not supported, so this method returnsLaterality.BOTH.getMax()Returns the maximum pixel intensity in the image.getMin()Returns the minimum pixel intensity in the image.Returns aColourMappingif this image has an associated colour mapping.Returns a String showing the 'native' header for this image.intgetNCols()Returns the number of image columns in this image.intgetNDim()Returns theMultiSliceImagedimensionality of this image.intReturns the number of frames in a multi-frame image.intgetNRows()Returns the number of image rows in this image.intReturns the number of physical slice locations in this image.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.floatReturns the pixel size in the x (horizontal) direction for this image.floatReturns the pixel size in the y (vertical) direction for this image.floatReturns the separation between the centres of image planes for this image.Returns the pixel format (pixformat) of this image.static booleanReturns whether the user prefers to overwrite UNC images.static PreviewIcongetPreviewIcon(File f, boolean withImagePreview) Returns thePreviewIconfor a UNC image, ornullif the suppliedFiledoes not represent a UNC image.Returns the name of the pulse sequence with which this image was collected.com.xinapse.dicom.RescaleUnitsReturns the output units of Intensity Rescale Slope and Intensity Rescale Intercept, retrieved bygetIntensityRescale().Returns the scan saturation frequency offset for this image if it has a single saturation frequency offset in parts-per-million.getSaturationFreqOffsetPPM(int index) Returns the scan saturation frequency offset for one dimension index of this image in parts-per-million.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.getScanTE(int index) Returns the scan echo time for one dimension index of this image.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.float[]getSliceDWBMatrix(int slice) Returns the diffusion-weighting b-matrix for one slice of this image.getSliceDWbValue(int slice) Returns the diffusion-weighting b-value for one slice of this image.org.jogamp.vecmath.Vector3fgetSliceDWGradientVector(int slice) Returns the diffusion-weighting gradient-vector for one slice of this image.getSliceInfo(String name, int slice) Returns aStringrepresenting the value of this information item in a particular slice of this image.getSliceInfoList(int slice) Returns anInfoListobject applying to a particular slice of this image.Returns the slice thickness (in mm).getSliceTriggerDelayMS(int slice) Returns the trigger delay, in milliseconds, for one slice of this image.Returns aPixelDataTyperepresenting the data type of this image, as the pixel values are stored on disk.Returns the study ID for this ReadableImage.floatReturns the time between frames in a 4- or higher dimensional image.getTitle()Returns the title of this image.intReturns the total number of slices in this image.booleanisOpen()Tests whether this image is still open.static booleanisUNCImage(File f) Returnstrueif theFileis a UNC Image File.static booleanisUNCImage(String fileName) Returnstrueif the fileName is the name of a UNC Image file.static booleanisUNCImage(URL url) static UNCImagenewInstance(File f, String mode) Opens an existing disk-based UNC image.static UNCImageCreates an in-memoryUNCImage, loading information from an input stream.static UNCImagenewInstance(InputStream s, boolean skipPixelData) Creates an in-memoryUNCImage, loading information from the input stream.static UNCImagenewInstance(String fileName, String mode) Opens an existing disk-based UNC image.static UNCImagenewInstance(URL url) static UNCImagenewInstance(URL url, boolean skipPixelData) 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.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.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.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 voidsavePreferredOverwrite(boolean b) Saves whether the user prefers to overwrite UNC images.voidsetBodyPart(com.xinapse.dicom.BodyPart bodyPart) By default, body part recording is not supported, so this method does nothing.voidSets the echo train length for this image.voidsetFlipAngle(Float flipAngle) Sets the excitation pulse flip angle for this image.voidsetFrameDWBMatrix(float[] bMatrix, int frame) Sets the diffusion-weighting B-matrix for one "frame" of this 4-D image.voidsetFrameDWbValue(float bValue, int frame) Sets the diffusion-weighting b-value for one "frame" of this 4-D image.voidsetFrameDWGradientVector(org.jogamp.vecmath.Vector3f gradVec, int frame) Sets the diffusion-weighting gradient vector for one "frame" of this 4-D image.voidsetFrameInfoList(InfoList list, int frame) Sets a newInfoLista specific frame of this image.voidsetFrameTriggerDelayMS(float delay, int frame) Sets the trigger delay (in milliseconds) for one "frame" of this 4-D 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.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.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 list) Sets a newInfoListto the general file info of this image.voidsetInfoList(InfoList list, int dim, int n) Sets a newInfoLista specific dimension of this image.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.voidsetLaterality(com.xinapse.dicom.Laterality laterality) By default, laterality recording is not supported, so this method does nothing.voidsetMinMax(int min, int max) Sets the min and max pixel intensity fields for thisUNCImage.voidsetNativeColourMapping(ColourMapping colourMapping) Sets theColourMappingfor this image.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.voidsetPixelSpacing(Float[] spacing) Sets the distance (in mm) between pixel centres in the row, column and slice directions of the image, and the time between movie frames (for 4-D images) in seconds.voidsetPixelXSize(float width) Sets the pixel size in the x (horizontal) direction for this image.voidsetPixelYSize(float height) Sets the pixel size in the y (vertical) direction for this image.voidsetPixelZSize(float thickness) Sets the pixel size in the z (slice) direction for this image.voidsetPulseSequence(String seqName) Sets the pulse sequence name for this image.voidsetRescaleUnits(com.xinapse.dicom.RescaleUnits units) Sets the rescale units.voidsetSaturationFreqOffsetPPM(Float freqOffset) Sets the saturation frequency offset in PPM for this image.voidsetSaturationFreqOffsetPPM(Float freqOffset, int index) Sets the saturation frequency offset for one dimension index of this image.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 echo time for one dimension index of 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 seriesDescription) Sets a short description of the series (scan).voidsetSeriesNumber(Integer seriesNumber) Sets the series number for this image.voidsetSliceDWBMatrix(float[] bMatrix, int slice) Sets the diffusion-weighting B-matrix for one slice of this image.voidsetSliceDWbValue(float bValue, int index) Sets the diffusion-weighting b-value for one slice of this image.voidsetSliceDWGradientVector(org.jogamp.vecmath.Vector3f gradVec, int index) Sets the diffusion-weighting gradient vector for one slice of this image.voidsetSliceInfoList(InfoList list, int slice) Sets a newInfoLista specific slice of this image.voidsetSliceThickness(Float thickness) Sets the slice thickness (in mm).voidsetSliceTriggerDelayMS(float delay, int index) Sets the trigger delay (in milliseconds) for one slice of this image.voidsetStudyID(String studyID) Sets the study ID for this image.voidsetTimeBetweenFrames(float deltaT) Sets the time between frames in a 4- or higher dimensional image.voidSets the title of this image.booleanReturnstruebecause UNC images support intensity rescaling.toHTML()Returns an HTML string describing this image.toString()Returns a string describing this image.voidWrites thisUNCImageto aDataOutputStream.Writes this WritableImage to a file (or possibly a pair of header/image files).Methods inherited from class com.xinapse.multisliceimage.MultiSliceImage
clone, getDateFormat, getFrameDim, getFrameOfReferenceUID, getModality, getMostLikePlane, getPix, getPix, getPix, getPix, getPix, getPresentationPixelDataType, getROIs, getScanDateFormat, getSlice, getSlice, getSliceDim, getStoredPix, getSuggestedFileName, isModified, main, parseMultiValuedString, putPix, putPix, setFrameOfReferenceUID, setIntensityRescale, setMinMax, setModality, setModified, setSeriesInstanceUID, setStudyInstanceUID, setSuggestedFileNameMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.xinapse.image.ReadableImage
getAffineTransform, getAffineTransform, getNSliceLocationsMethods inherited from interface com.xinapse.image.WritableImage
appendToTitle
-
Field Details
-
DEFAULT_OVERWRITE
public static final boolean DEFAULT_OVERWRITEThe default setting for the whether UNC images can be overwritten.- See Also:
-
N_DIMV
public static final int N_DIMVThe maximum dimensionality of an image.- See Also:
-
N_HISTOGRAM
public static final int N_HISTOGRAMThe number of entries in an image histogram- See Also:
-
-
Constructor Details
-
UNCImage
public UNCImage()Creates an uninitialised instance of a UNCImage. Needed so that newInstance() method can be called on the class. -
UNCImage
public UNCImage(String fileName, UNCPixFormat pixform, int dimc, int[] dimv) throws InvalidImageException, IOException Creates a disk-basedUNCImagewith the given type of pixel and dimensions. dimc should be greater that 1 and less than or equal tonDIMV.- Parameters:
fileName- the name of the file to be created.pixform- the type of image to be created (e.g.UNCPixFormat.GREY).dimc- the dimensionality of the image.dimv- an array of length at least dimc containing the number of picture elements in each dimension. For example, in a 3-dimensional image,dimv[0]is the number of slices,dimv[1]the number of rows, anddimv[2]the number of columns.- Throws:
InvalidImageException- if the image cannot be created.IOException- if an I/O error occurs.
-
UNCImage
public UNCImage(File f, UNCPixFormat pixform, int dimc, int[] dimv) throws InvalidImageException, IOException Creates a disk-basedUNCImagewith the given type of pixel and dimensions. dimc should be greater that 1 and less than or equal to nDIMV.- Parameters:
f- isFileObject representing the path of the file to be created.pixform- the type of image to be created (e.g.UNCPixFormat.GREY).dimc- the dimensionality of the image.dimv- an array of length at least dimc containing the number of picture elements in each dimension. For example, in a 3-dimensional image,dimv[0]is the number of slices,dimv[1]the number of rows, anddimv[2]the number of columns.- Throws:
InvalidImageException- if the image cannot be created.IOException- if an I/O error occurs.
-
UNCImage
Creates an in-memoryUNCImagewith the given type of pixel and dimensions. dimc should be greater that 1 and less than or equal to nDIMV.- Parameters:
pixform- the type of image to be created (e.g.UNCPixFormat.GREY).dimc- the dimensionality of the image.dimv- an array of length at least dimc containing the number of picture elements in each dimension. For example, in a 3-dimensional image,dimv[0]is the number of slices,dimv[1]the number of rows, anddimv[2]the number of columns.- Throws:
InvalidImageException- if the image cannot be created.
-
UNCImage
Creates an in-memoryUNCImage, loading all information from the data input stream. Optionally skips over loading of the pixel data.- Parameters:
s- theDataInputStream.skipPixelData- iftruethen pixel data is not loaded and cannot later be accessed.- Throws:
InvalidImageException- if the image cannot be loaded.
-
-
Method Details
-
newInstance
- Parameters:
url- theURLthat will give a UNC image data stream.- Returns:
- a new UNCImage loaded from a URL.
- Throws:
InvalidImageException- if the image cannot be loaded.UNCException- if the image cannot be loaded for UNC-specific reasons.IOException- if an I/O error occurs while loading the image.
-
newInstance
public static UNCImage newInstance(URL url, boolean skipPixelData) throws InvalidImageException, UNCException, IOException Creates an in-memoryUNCImage, loading information from aURL. Optionally skips loading of the pixel data into memory. IfskipPixelDatais true, then the pixel data will not be accessible.- Parameters:
url- theURLthat will give a UNC image data stream.skipPixelData- iftruethen pixel data is not loaded and cannot later be accessed.- Returns:
- a new UNCImage loaded from a URL.
- Throws:
InvalidImageException- if the image cannot be loaded.UNCException- if the image cannot be loaded for UNC-specific reasons.IOException- if an I/O error occurs while loading the image.
-
newInstance
public static UNCImage newInstance(String fileName, String mode) throws InvalidImageException, IOException, FileNotFoundException Opens an existing disk-based UNC image.- Parameters:
fileName- the name of the image file.mode- the open mode. Can be either"r"(read-only) or"rw"(read-write).- Returns:
- a new UNCImage, loaded from a disk file.
- Throws:
InvalidImageException- if the mode is invalid or the image cannot be read.FileNotFoundException- if the image file doesn't exist.IOException- if an I/O error occurs.
-
newInstance
public static UNCImage newInstance(File f, String mode) throws InvalidImageException, IOException, FileNotFoundException Opens an existing disk-based UNC image.- Parameters:
f- aFileobject representing the path to this image file.mode- the open mode. Can be either"r"(read-only) or"rw"(read-write).- Returns:
- a new UNCImage, loaded from a disk file.
- Throws:
InvalidImageException- if the mode is invalid or the image cannot be read.FileNotFoundException- if the image file doesn't exist.IOException- if an I/O error occurs.
-
newInstance
Creates an in-memoryUNCImage, loading information from an input stream.- Parameters:
s- theInputStream.- Returns:
- a new UNCImage, loaded from an input stream.
- Throws:
InvalidImageException- if the image cannot be loaded.
-
newInstance
public static UNCImage newInstance(InputStream s, boolean skipPixelData) throws InvalidImageException Creates an in-memoryUNCImage, loading information from the input stream. Optionally skips over loading of the pixel data.- Parameters:
s- theInputStream.skipPixelData- iftruethen pixel data is not loaded and cannot later be accessed.- Returns:
- a new UNCImage, loaded from an input stream.
- Throws:
InvalidImageException- if the image cannot be loaded.
-
getByteOrder
Description copied from class:MultiSliceImageReturns the byte order for this image.- Specified by:
getByteOrderin classMultiSliceImage- Returns:
- the byte oder for this image, or
nullif the byte order is not defined yet (in-memory images only).
-
isUNCImage
-
getPreviewIcon
Returns thePreviewIconfor a UNC image, ornullif the suppliedFiledoes not represent a UNC image.- Parameters:
f- theFileto be tested.withImagePreview- whether a image preview is to be generated. Generating an image preview will take longer than not generating one.- Returns:
- a
PreviewIconif the File produces aUNCImage;nullotherwise.
-
isUNCImage
Returnstrueif the fileName is the name of a UNC Image file. Returnsfalseotherwise.- Parameters:
fileName- the name of a file to be tested.- Returns:
trueif aUNCImagefile with the specified name exists on disk;falseotherwise.
-
isUNCImage
-
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
-
close
Closes aUNCImageand frees up resources. For in-memory UNCImages, this merely explicity frees resources so that the garbage collector can work more efficiently. However, for disk-based images it is essential to apply the close() method. Image data is written to disk during the put() methods, but other information - the title and the info fields are only written to disk by the close() method. If the close() method is not applied to a disk-based UNCImage, then any changes to the title and info fields will be lost. Any further operations to a closedUNCImageare not possible, and may cause an exception to be thrown.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceReadableImage- Throws:
IOException- if the file cannot be written or closed.
-
isOpen
public boolean isOpen()Description copied from interface:ReadableImageTests whether this image is still open.- Specified by:
isOpenin interfaceReadableImage- Returns:
trueif the image is still open for reading and (if opened read/write) writing;falseotherwise.
-
write
Description copied from interface:WritableImageWrites this WritableImage to a file (or possibly a pair of header/image files).- Specified by:
writein interfaceWritableImage- Parameters:
fileName- with which the image is to be written.- Returns:
- the actual file name to which the image was written.
- Throws:
InvalidImageException- if the image cannot be written.
-
getPreferredOverwrite
public static boolean getPreferredOverwrite()Returns whether the user prefers to overwrite UNC images.- Returns:
trueif the user prefers to overwrite existsing UNC images;falseif UNC will not be overwritten.
-
savePreferredOverwrite
public static void savePreferredOverwrite(boolean b) Saves whether the user prefers to overwrite UNC images.- Parameters:
b-trueif the user prefers to overwrite existsing UNC images;falseif UNC are not to be overwritten.
-
write
Writes thisUNCImageto aDataOutputStream.- Parameters:
s- theDataOutputStream.- Throws:
InvalidImageException- if the image cannot be written.
-
getBytesPerPixel
public int getBytesPerPixel()Returns the number of bytes per pixel for this image.- Returns:
- the number of bytes per pixel.
-
getNativeHeader
Description copied from interface:ReadableImageReturns a String showing the 'native' header for this image.- Specified by:
getNativeHeaderin interfaceReadableImage- Returns:
- a String describing the 'native' header for this image.
-
toString
Returns a string describing this image. -
toHTML
Returns an HTML string describing this image.- Returns:
- a
Stringthat describes the image in HTML format.
-
setMinMax
Sets the min and max pixel intensity fields for thisUNCImage. Also sets the valid flag to true.- Specified by:
setMinMaxin interfaceWritableImage- Specified by:
setMinMaxin classMultiSliceImage- Parameters:
min- the minimum pixel value in the image.max- the maximum pixel value in the image.- Throws:
InvalidImageException- if the image is read-only or if the supplied values are unsuitable for this image.
-
getDimc
public int getDimc()Returns the dimensionality of this image.- Returns:
- dimc, the dimensionality.
-
getNDim
public int getNDim()Returns theMultiSliceImagedimensionality of this image.- Specified by:
getNDimin interfaceReadableImage- Returns:
- the dimensionality.
-
getDimv
Returns the dimensions of this image. An integer array of lengthN_DIMVis returned with elements 0 to dimc-1 containing useful information about the numbers of pixels in each dimension of the image. The lowest array element contain the most slowly-varying image component. For example in a 3-dimensional image,dimv[0]is the number of slices,dimv[1]the number of rows, anddimv[2]the number of columns.- Returns:
dimcan array of image dimensions.- Throws:
IllegalStateException- if there is something strange about the dimensionality of this image.
-
getDims
Description copied from interface:ReadableImageReturns the dimensions (numbers of samples in each image dimension) of this image.- Specified by:
getDimsin interfaceReadableImage- Returns:
- an array with length equal to the image dimensionality, containing the
numbers of pixels (samples) in each dimension of the image.
By convention, element (nDim-1) contains the number of columns,
element (nDim-2) the number of rows, etc. For example, in a 4-dimensional image,
dims[0]is the number of frames,dims[1]the number of slices,dims[2]the number of rows anddims[3]the number of columns. - Throws:
IllegalStateException
-
getPixformat
Returns the pixel format (pixformat) of this image.- Returns:
- a
UNCPixFormatrepresenting a particular pixel format.
-
getStoredPixelDataType
Description copied from interface:ReadableImageReturns aPixelDataTyperepresenting the data type of this image, as the pixel values are stored on disk.- Specified by:
getStoredPixelDataTypein interfaceReadableImage- Returns:
- the
PixelDataTyperepresenting the data type of this image as stored on disk.
-
getFileDataOffset
public int getFileDataOffset()Returns the byte offset into the disk-based file format where pixel data begins.- Specified by:
getFileDataOffsetin classMultiSliceImage- Returns:
- the byte offset to the start of pixel data for images that are written to disk.
-
getTitle
Returns the title of this image.- Specified by:
getTitlein interfaceReadableImage- Returns:
- the title String.
-
setTitle
Sets the title of this image. If the new titleStringis longer than is allowed by the UNC format, then it is truncated before being applied. If the image is read-only, then this method does nothing.
N.B. For disk-based images, the changes in the title will not be reflected on disk unless theclose()method is called.- Specified by:
setTitlein interfaceWritableImage- Parameters:
newTitle- the new title to be assigned to this image.
-
putPix
Description copied from class:MultiSliceImagePut 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- Overrides:
putPixin classMultiSliceImage- 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.
-
putPix
Description copied from class:MultiSliceImagePuts a single pixel value to the image.- Specified by:
putPixin interfaceWritableImage- Overrides:
putPixin classMultiSliceImage- Parameters:
pix- 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.
-
putSlice
Description copied from class:MultiSliceImagePuts 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- Overrides:
putSlicein classMultiSliceImage- 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.
-
getInfo
Description copied from interface:InfoStorerReturns a string representing the value of this 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 this information field.- Returns:
- a
Stringrepresentation of the value of this information field. - Throws:
InfoNotFoundException- if the name is not found in the general info.
-
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 theReadableImage.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 this name in the general file information.- Throws:
IOException- if the information cannot be added because of an I/O error.
-
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 theReadableImage.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 this name in the general file information.- Throws:
IOException- if the information cannot be addded because of an I/O error.
-
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 theReadableImage.close()method is called.- Specified by:
putInfoin interfaceInfoStorer- Parameters:
name- the name of the information to put.value- aStringto be associated with this name in the general file information.- Throws:
IOException- if the information cannot be addded because of an I/O error.
-
getInfo
Description copied from interface:InfoStorerReturns aStringrepresenting the value of this information item in a particular dimension of this image. For example, if there is a item"pixel_x_size=0.91162"in the file info for this 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 this information item.dim- the dimension of this 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 this information. - Throws:
InfoNotFoundException- if the name is not found in this dimension/element info.
-
getSliceInfo
Description copied from interface:InfoStorerReturns aStringrepresenting the value of this information item in a particular slice of this image.The slice number is referenced from 0 to (number of slices - 1).
- Specified by:
getSliceInfoin interfaceInfoStorer- Parameters:
name- the name of this information item.slice- the slice number.- Returns:
- a
Stringrepresentation of the value of this information. - Throws:
InfoNotFoundException- if the name is not found for the specified slice.
-
getFrameInfo
Description copied from interface:InfoStorerReturns aStringrepresenting the value of this information item in a particular frame of this image.The frame number is referenced from 0 to (number of frames - 1).
- Specified by:
getFrameInfoin interfaceInfoStorer- Parameters:
name- the name of this information item.frame- the frame number.- Returns:
- a
Stringrepresentation of the value of this information. - Throws:
InfoNotFoundException- if the name is not found for the specified frame.
-
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 theReadableImage.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 this name in the general file information.dim- the dimension of this image to 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.- Throws:
IOException- if the information cannot be addded because of an I/O error.
-
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 this name in the dimension-specific information.dim- the dimension of this image to 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.- Throws:
IOException- if the information cannot be addded because of an I/O error.
-
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 this name in the dimension-specific information.dim- the dimension of this image to 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.- Throws:
IOException- if the information cannot be addded because of an I/O error.
-
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 theReadableImage.close()method is called.- Specified by:
putSliceInfoin interfaceInfoStorer- Parameters:
infoList- the list of InfoItems to put.slice- the slice number.- Throws:
IOException- if the information cannot be added because of an I/O error.
-
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 theReadableImage.close()method is called.- Specified by:
putFrameInfoin interfaceInfoStorer- Parameters:
infoList- the list of InfoItems to put.frame- the frame number.- Throws:
IOException- if the information cannot be added because of an I/O error.
-
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 theReadableImage.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 this name in the slice-specific info.slice- the slice number.- Throws:
IOException- if the information cannot be added because of an I/O error.
-
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 theReadableImage.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 this name in the frame-specific info.frame- the frame number.- Throws:
IOException- if the information cannot be added because of an I/O error.
-
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 theReadableImage.close()method is called.- Specified by:
removeInfoin interfaceInfoStorer- Parameters:
name- the name of the information item to be removed.- Throws:
IOException- if the information cannot 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 theReadableImage.close()method is called.- Specified by:
removeInfoin interfaceInfoStorer- Parameters:
name- the name of the information item to put.dim- the dimension of this image to 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.- Throws:
IOException- if the information cannot be removed.
-
copyInfo
Copies all the info fields to another image. The general info will be copied to the toImage, overwriting any pre-existing info. Depending on the dimensionality of the two images, the dimension-specific info may also be copied.- Parameters:
toImage- theUNCImageto which info will be copied.- Throws:
IllegalStateException- if the image is read-only.
-
getInfoList
Description copied from interface:InfoStorerReturns anInfoListobject which is the general info for this image.- Specified by:
getInfoListin interfaceInfoStorer- Returns:
- an
InfoListwhich is the general file info for thisInfoStorer.
-
getInfoList
Description copied from interface:InfoStorerReturns anInfoListobject applying to a particular dimension/element for this image.- 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 thisInfoStorer. - Throws:
IndexOutOfBoundsException- if the dimensions supplied do not match this image.
-
getSliceInfoList
Description copied from interface:InfoStorerReturns anInfoListobject applying to a particular slice of this image.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. - Throws:
IndexOutOfBoundsException- if the slice supplied is inappropriate for the dimensions of this image.
-
getFrameInfoList
Description copied from interface:InfoStorerReturns anInfoListobject applying to a particular frame of this image.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. - Throws:
IndexOutOfBoundsException- if the frame supplied is inappropriate for the dimensions of this image.
-
setInfoList
Description copied from interface:InfoStorerSets a newInfoListto the general file info of this image.- Specified by:
setInfoListin interfaceInfoStorer- Parameters:
list- theInfoListobject to set to the general file info for this image.- Throws:
IOException- if theInfoListcannot be set.
-
setInfoList
Description copied from interface:InfoStorerSets a newInfoLista specific dimension of this image.- Specified by:
setInfoListin interfaceInfoStorer- Parameters:
list- theInfoListto associate with this image/dimension.dim- the dimension to which to set the information list.n- the element to which to set the information list.- Throws:
IOException- if theInfoListcannot be set.
-
setSliceInfoList
Description copied from interface:InfoStorerSets a newInfoLista specific slice of this image.- Specified by:
setSliceInfoListin interfaceInfoStorer- Parameters:
list- theInfoListto associate with this image/slice.slice- the slice for which to set the information list.- Throws:
IOException- if theInfoListcannot be set.
-
setFrameInfoList
Description copied from interface:InfoStorerSets a newInfoLista specific frame of this image.- Specified by:
setFrameInfoListin interfaceInfoStorer- Parameters:
list- theInfoListto associate with this image/frame.frame- the frame for which to set the information list.- Throws:
IOException- if theInfoListcannot be set.
-
appendInfoList
Description copied from interface:InfoStorerAppends anInfoListto the existing general file info of this image.- Specified by:
appendInfoListin interfaceInfoStorer- Parameters:
list- theInfoListobject to append to the general file info for this image.- Throws:
IOException- if theInfoListcannot be appended because of an I/O error.
-
appendInfoList
Description copied from interface:InfoStorerAppends anInfoListto that existing for a specific dimension of this image.- Specified by:
appendInfoListin interfaceInfoStorer- Parameters:
list- theInfoListto append.dim- the dimension to which to append the information list.n- the element to which to append the information list.- Throws:
IllegalStateException
-
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) throws IOException Description copied from interface:WritableImageAnonymise this WritableImage.- Specified by:
anonymisein interfaceWritableImage- 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.- Throws:
IOException- if an I/O error occurs during anonymisation.
-
getTotalNSlices
public int getTotalNSlices()Description copied from interface:ReadableImageReturns the total number of slices in this image. If the image is less than 3-dimensional, this method returns 1; if it is 3-dimensional, it returns the number of slices; if it is 4- or more dimensional, it sums up the total number of planar slices in each dimension and returns the total. For example a 4-dimensional image with 4 slices and 10 frames, the total number of slices is 40.- Specified by:
getTotalNSlicesin interfaceReadableImage- Returns:
- the number of planar image slices.
-
getNCols
public int getNCols()Description copied from interface:ReadableImageReturns the number of image columns in this image.- Specified by:
getNColsin interfaceReadableImage- Returns:
- the number of image columns.
-
getNRows
public int getNRows()Description copied from interface:ReadableImageReturns the number of image rows in this image.- Specified by:
getNRowsin interfaceReadableImage- Returns:
- the number of image rows.
-
getNSlices
public int getNSlices()Description copied from interface:ReadableImageReturns the number of physical slice locations in this image. If the image dimensionality is greater than or equal to three, then this method returns the number of samples in the third dimension. If the dimensionality is less than 3 two, it returns 1.- Specified by:
getNSlicesin interfaceReadableImage- Returns:
- the number of physical slice locations.
-
getNFrames
public int getNFrames()Description copied from interface:ReadableImageReturns the number of frames in a multi-frame image. If the image dimensionality is greater than or equal to four, then this method returns the number of samples in the fourth dimension. If the dimensionality is less than 4, it returns 1.- Specified by:
getNFramesin interfaceReadableImage- Returns:
- the number of image (movie) frames.
-
getPixelXSize
Description copied from interface:ReadableImageReturns the pixel size in the x (horizontal) direction for this image.- Specified by:
getPixelXSizein interfaceReadableImage- Returns:
- the pixel size in the x (horizontal) direction in mm.
- Throws:
ParameterNotSetException- if the pixel size can't be found.
-
getPixelYSize
Description copied from interface:ReadableImageReturns the pixel size in the y (vertical) direction for this image.- Specified by:
getPixelYSizein interfaceReadableImage- Returns:
- the pixel size in the y (vertical) direction in mm.
- Throws:
ParameterNotSetException- if the pixel size can't be found.
-
getPixelZSize
Description copied from interface:ReadableImageReturns the separation between the centres of image planes for this image.- Specified by:
getPixelZSizein interfaceReadableImage- Returns:
- the pixel size in the z (slice) direction in mm.
- Throws:
ParameterNotSetException- if the pixel size can't be found.
-
getTimeBetweenFrames
Description copied from interface:ReadableImageReturns the time between frames in a 4- or higher dimensional image.- Specified by:
getTimeBetweenFramesin interfaceReadableImage- Returns:
- the time between frames in seconds.
- Throws:
ParameterNotSetException- if the time between frames is not set, or if this image doesn't have a dimensionality of at least 4.
-
setPixelXSize
Description copied from class:MultiSliceImageSets the pixel size in the x (horizontal) direction for this image.- Specified by:
setPixelXSizein classMultiSliceImage- Parameters:
width- the width of a pixel.- Throws:
IOException- if and I/O error occurs.
-
setPixelYSize
Description copied from class:MultiSliceImageSets the pixel size in the y (vertical) direction for this image.- Specified by:
setPixelYSizein classMultiSliceImage- Parameters:
height- the height of a pixel.- Throws:
IOException- if an I/O error occurs.
-
setPixelZSize
Description copied from class:MultiSliceImageSets the pixel size in the z (slice) direction for this image.- Specified by:
setPixelZSizein classMultiSliceImage- Parameters:
thickness- the thickness of a pixel.- Throws:
IOException- if an I/O error occurs.
-
setTimeBetweenFrames
Description copied from class:MultiSliceImageSets the time between frames in a 4- or higher dimensional image.- Specified by:
setTimeBetweenFramesin classMultiSliceImage- Parameters:
deltaT- the time between frames (in seconds).- Throws:
IOException- if an I/O error occurs.
-
getImagePositionPatient
public org.jogamp.vecmath.Point3f getImagePositionPatient()Description copied from interface:ReadableImageReturns the coordinates of the center of the first pixel of the image, in mm, in patient coordinates. This method will only return if the image pixels form a regular array of pixels with parallel image planes; otherwise a ParameterNotSetException is thrown.- Specified by:
getImagePositionPatientin interfaceReadableImage- Returns:
- the Left,Posterior,Superior (LPS) coordinates of the first pixel
in the image data matrix. Returns
nullif the position cannot be retrieved from this image.
-
getImagePositionPatient
public org.jogamp.vecmath.Point3f getImagePositionPatient(int slice) 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- 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.
-
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()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 (L,P,S) coordinates.- Specified by:
getImageOrientationPatientin interfaceReadableImage- 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.
-
getImageOrientationPatient
public org.jogamp.vecmath.Vector3f[] getImageOrientationPatient(int slice) 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- 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.
-
setImageOrientationPositionPatient
public void setImageOrientationPositionPatient(org.jogamp.vecmath.Vector3f[] orientation, org.jogamp.vecmath.Point3f position, boolean force) Description copied from class:MultiSliceImageSets 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- Specified by:
setImageOrientationPositionPatientin classMultiSliceImage- 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.
-
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.
-
setPixelSpacing
Description copied from interface:WritableImageSets the distance (in mm) between pixel centres in the row, column and slice directions of the image, and the time between movie frames (for 4-D images) in seconds. The distances and time should always be positive values.- Specified by:
setPixelSpacingin interfaceWritableImage- Parameters:
spacing- a Float[] of length up to 4, corresponding to the distance between pixel centres in the row, column, slice and time directions, respectively. Spacing values will only be set for image dimensions where the spacing array is long enough and the array element is non-null. The first element of the array indicates the horizontal pixel size; the second is the vertical pixel size; the third is the pixel depth; fourth is the time between frames.- Throws:
IOException- if the pixel spacing cannot be set for this image.
-
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.- Throws:
IOException- if the slice thickness cannot be set for 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.
N.B. For disk-based images, the changes in the study ID will not be reflected on disk unless the close() method is called.- Specified by:
setStudyIDin interfaceWritableImage- Parameters:
studyID- the new study ID to be assigned to this image.
-
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).
-
supportsIntensityRescaling
public boolean supportsIntensityRescaling()Returnstruebecause UNC 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
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.- Throws:
IOException- if an I/O error occurs.
-
getRescaleUnits
public com.xinapse.dicom.RescaleUnits getRescaleUnits()Description copied from interface:ReadableImageReturns the output units of Intensity Rescale Slope and Intensity Rescale Intercept, retrieved bygetIntensityRescale().- Specified by:
getRescaleUnitsin interfaceReadableImage- Returns:
- the RescaleUnits describing the physical meaning of the pixel intensity units. Returns the RescaleUnits.US if the physical meaning is unknown, or arbitrary.
-
setRescaleUnits
Description copied from interface:WritableImageSets the rescale units.- Specified by:
setRescaleUnitsin interfaceWritableImage- Parameters:
units- the rescale units.- Throws:
IOException- if the rescale units cannot be set.
-
appendAuditInfo
Description copied from interface:WritableImageAppends 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.
-
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.
N.B. For disk-based images, the changes in the patient name will not be reflected on disk unless the close() method is called.- Specified by:
setPatientNamein interfaceWritableImage- Parameters:
patientName- the new patient name to be assigned to this image.- Throws:
IOException- if the patient name cannot be set.
-
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.
N.B. For disk-based images, the changes in the patient ID will not be reflected on disk unless the close() method is called.- Specified by:
setPatientIDin interfaceWritableImage- Parameters:
patientID- the new patient ID to be assigned to this image.- Throws:
IOException- if the patient ID cannot be set.
-
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.
N.B. For disk-based images, the changes in the patient's birth date will not be reflected on disk unless the close() method is called.- Specified by:
setPatientDoBin interfaceWritableImage- Parameters:
patientDoB- the new patient date of birth to be assigned to this image.- Throws:
IOException- if the patient date of birth cannot be set.
-
setPatientSex
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.- Throws:
IOException- if the patient sex cannot be set.
-
setScanDate
Description copied from interface:WritableImageSets the scan date/time for this image.
N.B. For disk-based images, the changes in the scan date will not be reflected on disk unless the close() method is called.- Specified by:
setScanDatein interfaceWritableImage- Parameters:
scanDate- the new scan date/time to be assigned to this image.- Throws:
IOException- if the scan date cannot be set.
-
setPulseSequence
Description copied from interface:WritableImageSets the pulse sequence name for this image.
N.B. For disk-based images, the changes in the scanning sequence will not be reflected on disk unless the close() method is called.- Specified by:
setPulseSequencein interfaceWritableImage- Parameters:
seqName- the new name of the pulse sequence to be assigned to this image.- Throws:
IOException- if the pulse sequence name cannot be set.
-
setScanningSequence
Description copied from interface:WritableImageSets the DICOM scanning sequence for this image.
N.B. For disk-based images, the changes in the scanning sequence will not be reflected on disk unless the close() method is called.- Specified by:
setScanningSequencein interfaceWritableImage- Parameters:
seq- the new scanning sequence to be assigned to this image.- Throws:
IOException- if the scanning sequence cannot be set.
-
setSequenceVariant
Description copied from interface:WritableImageSets the DICOM scanning sequence variant for this image.
N.B. For disk-based images, the changes in the scanning sequence variant will not be reflected on disk unless the close() method is called.- Specified by:
setSequenceVariantin interfaceWritableImage- Parameters:
seqVar- the new scanning sequence variant to be assigned to this image.- Throws:
IOException- if the scanning sequence variant cannot be set.
-
setSeriesNumber
Description copied from interface:WritableImageSets the series number for this image.
N.B. For disk-based images, the changes in the series number will not be reflected on disk unless the close() method is called.- Specified by:
setSeriesNumberin interfaceWritableImage- Parameters:
seriesNumber- the new series number to be assigned to this image.- Throws:
IOException- if the series number cannot be set.
-
setSeriesDescription
Description copied from interface:WritableImageSets a short description of the series (scan).
N.B. For disk-based images, the changes in the series description will not be reflected on disk unless the close() method is called.- Specified by:
setSeriesDescriptionin interfaceWritableImage- Parameters:
seriesDescription- the new short description of the series, or null if none is available.- Throws:
IOException- if the description cannot be set.
-
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
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.- Throws:
IOException- if body part cannot be set.
-
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
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.- Throws:
IOException- if laterality cannot be set.
-
setScanTR
Description copied from interface:WritableImageSets the scan repetition time for this image. No exception occurs if the image format does not support scan TR recording.
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. If null, the TR should be unset.- Throws:
IOException- if the scan TR cannot be set.
-
setScanTI
Description copied from interface:WritableImageSets the scan inversion time for this image. No exception occurs if the image format does not support scan TI recording.
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. If null, the TI should be unset.- Throws:
IOException- if the scan TI cannot be set.
-
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.
N.B. For disk-based images, the changes in the scan TE will not be reflected on disk unless the close() method is called.- Specified by:
setScanTEin interfaceWritableImage- Parameters:
TE- the new scan TE to be assigned to this image. If null, the TE should be unset.- Throws:
IOException- if the scan TE cannot be set.
-
setScanTE
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.
N.B. For disk-based images, the changes in the scan TE will not be reflected on disk unless the close() method is called.- Specified by:
setScanTEin interfaceWritableImage- Parameters:
TE- the new scan TE to be assigned to this image.index- the slice number for which to set the echo time.- Throws:
IOException- if the scan TE cannot be set because of an I/O error.
-
setSaturationFreqOffsetPPM
Description copied from interface:WritableImageSets the saturation frequency offset in PPM for this image. No exception occurs if the image format does not support saturation frequency offset recording.
N.B. For disk-based images, the changes in the saturation frequency offset will not be reflected on disk unless the close() method is called.- Specified by:
setSaturationFreqOffsetPPMin interfaceWritableImage- Parameters:
freqOffset- the new saturation frequency offset to be assigned to this image. If null, the saturation frequency offset should be unset.- Throws:
IOException- if the saturation frequency offset cannot be set.
-
setSaturationFreqOffsetPPM
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.
N.B. For disk-based images, the changes in the saturation frequency offset will not be reflected on disk unless the close() method is called.- Specified by:
setSaturationFreqOffsetPPMin interfaceWritableImage- Parameters:
freqOffset- the new saturation frequency offset to be assigned to this image.index- the slice number for which to set the saturation frequency offset.- Throws:
IOException- if the saturation frequency offset cannot be set because of an I/O error.
-
setEchoTrainLength
Description copied from interface:WritableImageSets the echo train length for this image. No exception occurs if the image format does not support a echo train length recording.
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 scan echo train length to be assigned to this image. If null, the echo train length is unassigned.- Throws:
IOException- if the echo train length cannot be set because of an I/O error.
-
setFlipAngle
Description copied from interface:WritableImageSets the excitation pulse flip angle for this image. No exception occurs if the image format does not support flip angle recording.
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. If null, the flip angle should be unset.- Throws:
IOException- if the scan flip angle cannot be set.
-
getPatientName
Description copied from interface:ReadableImageReturns 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.
-
getPatientID
Description copied from interface:ReadableImageReturns the patient ID for this image.- Specified by:
getPatientIDin interfaceReadableImage- Returns:
- the patientID for this image, or
nullif the patientID can't be found.
-
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.
-
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.
-
getScanDate
Description copied from interface:ReadableImageReturns 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.
-
getScanTR
Description copied from interface:ReadableImageReturns the scan repetition time for this image.- Specified by:
getScanTRin interfaceReadableImage- Returns:
- the scan TR for this image, or null if not set for this image.
-
getScanTI
Description copied from interface:ReadableImageReturns the scan inversion time for this image.- Specified by:
getScanTIin interfaceReadableImage- Returns:
- the scan TI for this image, or null if not set for this image.
-
getScanTE
Description copied from interface:ReadableImageReturns 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, or null if not set for this image.
-
getScanTE
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:
getScanTEin interfaceReadableImage- Parameters:
index- the index for which to return the echo time.- 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.
-
getSaturationFreqOffsetPPM
Description copied from interface:ReadableImageReturns the scan saturation frequency offset for this image if it has a single saturation frequency offset in parts-per-million.- Specified by:
getSaturationFreqOffsetPPMin interfaceReadableImage- Returns:
- the scan saturation frequency offset for this image, or null if not set for this image.
-
getSaturationFreqOffsetPPM
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:
getSaturationFreqOffsetPPMin interfaceReadableImage- Parameters:
index- the index 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.
-
getEchoTrainLength
Description copied from interface:ReadableImageReturns the scan echo train length for this image.- Specified by:
getEchoTrainLengthin interfaceReadableImage- Returns:
- the echo train length for this image, or null if not set for this image.
-
getFlipAngle
Description copied from interface:ReadableImageReturns the excitation pulse flip angle for this image.- Specified by:
getFlipAnglein interfaceReadableImage- Returns:
- the excitation pulse flip angle for this image, or null if not set for this image.
-
getSliceDWbValue
Description copied from interface:ReadableImageReturns the diffusion-weighting b-value for one slice of this image.- Specified by:
getSliceDWbValuein interfaceReadableImage- Parameters:
slice- the slice number for which to return the b-value.- Returns:
- the diffusion-weighting b-value for the specified slice 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 slice number is bad for this image.
-
getFrameDWbValue
Description copied from interface:ReadableImageReturns the diffusion-weighting b-value for one frame of this 4-D 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, or it isn't a 4-D image.
-
setSliceDWbValue
Description copied from interface:WritableImageSets the diffusion-weighting b-value for one slice of this image. No exception occurs if the image format does not support recording the b-value.
N.B. For disk-based images, the changes in the b-value will not be reflected on disk unless the close() method is called.- Specified by:
setSliceDWbValuein interfaceWritableImage- Parameters:
bValue- the new b-value to be assigned to this image.index- the slice number for which to set the b-value.- Throws:
IOException- if the scan b-value cannot be set.
-
setFrameDWbValue
Description copied from interface:WritableImageSets the diffusion-weighting b-value for one "frame" of this 4-D image. No exception occurs if the image format does not support recording the b-value.
N.B. For disk-based images, the changes in the b-value will not be reflected on disk unless the close() method is called.- Specified by:
setFrameDWbValuein interfaceWritableImage- Parameters:
bValue- the new b-value to be assigned to this image.frame- the frame number for which to set the b-value.- Throws:
IOException- if the scan b-value cannot be set.
-
getSliceDWGradientVector
public org.jogamp.vecmath.Vector3f getSliceDWGradientVector(int slice) throws IndexOutOfBoundsException Description copied from interface:ReadableImageReturns the diffusion-weighting gradient-vector for one slice of this image.- Specified by:
getSliceDWGradientVectorin interfaceReadableImage- Parameters:
slice- the slice number for which to return the gradient-vector.- Returns:
- the diffusion-weighting gradient-vector for the specified slice 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 slice number is bad for this image.
-
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 4-D 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, or it isn't a 4-D image.
-
setSliceDWGradientVector
public void setSliceDWGradientVector(org.jogamp.vecmath.Vector3f gradVec, int index) throws IOException Description copied from interface:WritableImageSets the diffusion-weighting gradient vector for one slice of this image. No exception occurs if the image format does not support recording the gradient vector.
N.B. For disk-based images, the changes in the gradient vector will not be reflected on disk unless the close() method is called.- Specified by:
setSliceDWGradientVectorin interfaceWritableImage- Parameters:
gradVec- the new gradient vector to be assigned to this image.index- the slice number for which to set the gradient vector.- Throws:
IOException- if the scan gradient vector cannot be set.
-
setFrameDWGradientVector
public void setFrameDWGradientVector(org.jogamp.vecmath.Vector3f gradVec, int frame) throws IOException Description copied from interface:WritableImageSets the diffusion-weighting gradient vector for one "frame" of this 4-D image. No exception occurs if the image format does not support recording the gradient vector.
N.B. For disk-based images, the changes in the gradient vector will not be reflected on disk unless the close() method is called.- Specified by:
setFrameDWGradientVectorin interfaceWritableImage- Parameters:
gradVec- the new gradient vector to be assigned to this image.frame- the frame number for which to set the gradient vector.- Throws:
IOException- if the scan gradient vector cannot be set.
-
getSliceDWBMatrix
Description copied from interface:ReadableImageReturns the diffusion-weighting b-matrix for one slice of this image.- Specified by:
getSliceDWBMatrixin interfaceReadableImage- Parameters:
slice- the slice 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 slice number is bad for this image.
-
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, or it isn't a 4-D image.
-
setSliceDWBMatrix
Description copied from interface:WritableImageSets the diffusion-weighting B-matrix for one slice of this image. No exception occurs if the image format does not support recording the B-matrix.
N.B. For disk-based images, the changes in the B-matrix will not be reflected on disk unless the close() method is called.- Specified by:
setSliceDWBMatrixin interfaceWritableImage- Parameters:
bMatrix- the new B-matrix to be assigned to this image.slice- the slice number for which to set the B-matrix.- Throws:
IOException- if the scan B-matrix cannot be set.
-
setFrameDWBMatrix
public void setFrameDWBMatrix(float[] bMatrix, int frame) throws IOException, IndexOutOfBoundsException Description copied from interface:WritableImageSets the diffusion-weighting B-matrix for one "frame" of this 4-D image. No exception occurs if the image format does not support recording the B-matrix.
N.B. For disk-based images, the changes in the B-matrix will not be reflected on disk unless the close() method is called.- Specified by:
setFrameDWBMatrixin interfaceWritableImage- Parameters:
bMatrix- the new B-matrix to be assigned to this image.frame- the frame number for which to set the B-matrix.- Throws:
IOException- if the scan B-matrix cannot be set.IndexOutOfBoundsException- if this is not a 4-D image.
-
getSliceTriggerDelayMS
Description copied from interface:ReadableImageReturns the trigger delay, in milliseconds, for one slice of this image.- Specified by:
getSliceTriggerDelayMSin interfaceReadableImage- Parameters:
slice- the slice 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 slice number is bad for this image, or it isn't a 4-D image.
-
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, or it isn't a 4-D image.
-
setSliceTriggerDelayMS
Description copied from interface:WritableImageSets the trigger delay (in milliseconds) for one slice of this image. No exception occurs if the image format does not support recording the trigger delay.
N.B. For disk-based images, the changes in the trigger delay will not be reflected on disk unless the close() method is called.- Specified by:
setSliceTriggerDelayMSin interfaceWritableImage- Parameters:
delay- the new trigger delay (in milliseconds) to be assigned to this image slice.index- the slice number for which to set the trigger delay.- Throws:
IOException- if the trigger delay cannot be set.
-
setFrameTriggerDelayMS
Description copied from interface:WritableImageSets the trigger delay (in milliseconds) for one "frame" of this 4-D image. No exception occurs if the image format does not support recording the trigger delay.
N.B. For disk-based images, the changes in the trigger delay will not be reflected on disk unless the close() method is called.- Specified by:
setFrameTriggerDelayMSin interfaceWritableImage- Parameters:
delay- the new trigger delay to be assigned to this image.frame- the frame number for which to set the trigger delay.- Throws:
IOException- if the trigger delay cannot be set.
-
getDescription
Description copied from interface:ReadableImageReturns a String description of this image.- Specified by:
getDescriptionin interfaceReadableImage- Returns:
- a String describing this image.
-
getDescription
Description copied from interface:ReadableImageReturns a String description of this one particular slice of this image.- Specified by:
getDescriptionin interfaceReadableImage- Parameters:
slice- the slice to describe.- Returns:
- a String describing the given slice of this image.
- Throws:
IndexOutOfBoundsException
-
getHTMLDescription
Description copied from interface:ReadableImageReturns a String description of this image in HTML format.- Specified by:
getHTMLDescriptionin interfaceReadableImage- Returns:
- a String describing this image.
-
getHTMLDescription
Description copied from interface:ReadableImageReturns a String description of a slice of this image in HTML format.- Specified by:
getHTMLDescriptionin interfaceReadableImage- Parameters:
slice- the slice number.- Returns:
- a String describing this image slice.
- Throws:
IndexOutOfBoundsException- if the slice is bad for this image.
-
getNativeColourMapping
Description copied from interface:ReadableImageReturns aColourMappingif this image has an associated colour mapping.- Specified by:
getNativeColourMappingin interfaceReadableImage- Returns:
- a
ColourMappingif this image has an associated colour mapping. Returnsnullif it does not. - Throws:
InvalidColourMappingException- if this image has an associated ColourMapping, but the ColourMapping cannot be successfully retrieved.
-
setNativeColourMapping
Description copied from interface:WritableImageSets theColourMappingfor this image. No exception occurs if the image format does not support a colour mapping.
N.B. For disk-based images, the changes in the ColourMapping may not be reflected on disk unless the close() method is called.- Specified by:
setNativeColourMappingin interfaceWritableImage- Parameters:
colourMapping- the new ColourMapping to be assigned to this image.- Throws:
IOException- if the ColourMapping cannot be set for this image.
-
getMin
Description copied from interface:ReadableImageReturns the minimum pixel intensity in the image.- Specified by:
getMinin interfaceReadableImage- Returns:
- the maximum pixel intensity as a
Double, ornullif the intensity min hasn't been calculated for this image. - Throws:
InvalidImageException- if the intensity cannot be returned as a Double.
-
getMax
Description copied from interface:ReadableImageReturns the maximum pixel intensity in the image.- Specified by:
getMaxin interfaceReadableImage- Returns:
- the maximum pixel intensity as a
Double, ornullif the intensity max hasn't been calculated for this image. - Throws:
InvalidImageException- if the intensity cannot be returned as a Double.
-
getCommonName
Returns the common name for this type of image.- Returns:
- the
String"UNC".
-
getImageTypeName
Description copied from interface:WritableImageReturns the normal human readable name for this type of image.- Specified by:
getImageTypeNamein interfaceWritableImage- Returns:
- a
Stringwith a one-word description of this type of image.
-
getCopy
Description copied from interface:WritableImageReturns a copy of thisWritableImage.- Specified by:
getCopyin interfaceReadableImage- Specified by:
getCopyin interfaceWritableImage- Returns:
- a copy of this
ReadableImage. - Throws:
IOException- if the an I/O error occurs whilst copying.
-