Interface WritableImage

All Superinterfaces:
AutoCloseable, ReadableImage
All Known Implementing Classes:
Analyze75Image, ANZImage, MultiSliceImage, NIFTI2Image, NIFTIImage, UNCImage

public interface WritableImage extends ReadableImage
Interface implemented by classes that ensure an image of that class can be written.
  • Method Details

    • getImageTypeName

      String getImageTypeName()
      Returns the normal human readable name for this type of image.
      Returns:
      a String with a one-word description of this type of image.
    • appendAuditInfo

      void appendAuditInfo(String name, String value) throws IOException
      Appends audit trail information to this image.
      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.
      Throws:
      IOException - if an I/O error occurs.
    • setNativeColourMapping

      void setNativeColourMapping(ColourMapping colourMapping) throws IOException
      Sets the ColourMapping for 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.
      Parameters:
      colourMapping - the new ColourMapping to be assigned to this image.
      Throws:
      IOException - if the ColourMapping cannot be set for this image.
    • setTitle

      void setTitle(String title) throws IOException
      Sets the title for this WritableImage, if the image format can handle titles.
      Parameters:
      title - the new title.
      Throws:
      IOException - if an error occurs writing the title.
    • appendToTitle

      default void appendToTitle(String toAppend) throws IOException
      Append some text to the title of this WritableImage, if the image format can handle titles.
      Parameters:
      toAppend - the text to append to the title.
      Throws:
      IOException - if an error occurs writing the title.
    • setModality

      void setModality(Modality modality) throws IOException
      Sets the modality with which this image was acquired. No exception occurs if the image format does not support modality recording.
      N.B. For disk-based images, the changes in the modality will not be reflected on disk unless the close() method is called.
      Parameters:
      modality - the new imaging modality to be assigned to this image.
      Throws:
      IOException - if modality cannot be set.
    • setBodyPart

      void setBodyPart(com.xinapse.dicom.BodyPart bodyPart) throws IOException
      Sets the body part imaged. No exception occurs if the image format does not support body part recording.
      N.B. For disk-based images, the changes in the body part will not be reflected on disk unless the close() method is called.
      Parameters:
      bodyPart - the new imaged body part.
      Throws:
      IOException - if body part cannot be set.
    • setLaterality

      void setLaterality(com.xinapse.dicom.Laterality laterality) throws IOException
      Sets the anatomical laterality of the image. No exception occurs if the image format does not support laterality recording.
      N.B. For disk-based images, the changes in the laterality will not be reflected on disk unless the close() method is called.
      Parameters:
      laterality - the new image laterality.
      Throws:
      IOException - if laterality cannot be set.
    • setPulseSequence

      void setPulseSequence(String seqName) throws IOException
      Sets 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.
      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

      void setScanningSequence(PulseSequenceType sequenceType) throws IOException
      Sets 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.
      Parameters:
      sequenceType - the new scanning sequence to be assigned to this image.
      Throws:
      IOException - if the scanning sequence cannot be set.
    • setSequenceVariant

      void setSequenceVariant(PulseSequenceVariant seqVariant) throws IOException
      Sets 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.
      Parameters:
      seqVariant - the new scanning sequence variant to be assigned to this image.
      Throws:
      IOException - if the scanning sequence variant cannot be set.
    • setFlipAngle

      void setFlipAngle(Float flipAngle) throws IOException
      Sets 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.
      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.
    • setScanTR

      void setScanTR(Float tr) throws IOException
      Sets 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.
      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

      void setScanTI(Float ti) throws IOException
      Sets 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.
      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

      void setScanTE(Float te) throws IOException
      Sets 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.
      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

      void setScanTE(Float te, int slice) throws IOException
      Sets 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.
      Parameters:
      te - the new scan TE to be assigned to this image.
      slice - the slice number for which to set the echo time.
      Throws:
      IndexOutOfBoundsException - if the index is bad for this image.
      IOException - if the scan TE cannot be set because of an I/O error.
    • setSaturationFreqOffsetPPM

      void setSaturationFreqOffsetPPM(Float freqOffset) throws IOException
      Sets 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.
      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

      void setSaturationFreqOffsetPPM(Float freqOffset, int slice) throws IOException
      Sets 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.
      Parameters:
      freqOffset - the new saturation frequency offset to be assigned to this image.
      slice - the slice number for which to set the saturation frequency offset.
      Throws:
      IndexOutOfBoundsException - if the index is bad for this image.
      IOException - if the saturation frequency offset cannot be set because of an I/O error.
    • setEchoTrainLength

      void setEchoTrainLength(Integer etl) throws IOException
      Sets 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.
      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.
    • setSliceDWbValue

      void setSliceDWbValue(float bValue, int slice) throws IOException, IndexOutOfBoundsException
      Sets 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.
      Parameters:
      bValue - the new b-value to be assigned to this image.
      slice - the slice number for which to set the b-value.
      Throws:
      IOException - if the scan b-value cannot be set.
      IndexOutOfBoundsException
    • setFrameDWbValue

      void setFrameDWbValue(float bValue, int frame) throws IOException, IndexOutOfBoundsException
      Sets 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.
      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.
      IndexOutOfBoundsException - if this is not a 4-D image.
    • setSliceDWGradientVector

      void setSliceDWGradientVector(org.jogamp.vecmath.Vector3f gVector, int slice) throws IOException, IndexOutOfBoundsException
      Sets 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.
      Parameters:
      gVector - the new gradient vector to be assigned to this image.
      slice - the slice number for which to set the gradient vector.
      Throws:
      IOException - if the scan gradient vector cannot be set.
      IndexOutOfBoundsException
    • setFrameDWGradientVector

      void setFrameDWGradientVector(org.jogamp.vecmath.Vector3f gVector, int frame) throws IOException, IndexOutOfBoundsException
      Sets 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.
      Parameters:
      gVector - 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.
      IndexOutOfBoundsException - if this is not a 4-D image.
    • setSliceDWBMatrix

      void setSliceDWBMatrix(float[] bMatrix, int slice) throws IOException, IndexOutOfBoundsException
      Sets 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.
      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.
      IndexOutOfBoundsException
    • setFrameDWBMatrix

      void setFrameDWBMatrix(float[] bMatrix, int frame) throws IOException, IndexOutOfBoundsException
      Sets 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.
      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.
    • setSliceTriggerDelayMS

      void setSliceTriggerDelayMS(float delay, int slice) throws IOException, IndexOutOfBoundsException
      Sets 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.
      Parameters:
      delay - the new trigger delay (in milliseconds) to be assigned to this image slice.
      slice - the slice number for which to set the trigger delay.
      Throws:
      IOException - if the trigger delay cannot be set.
      IndexOutOfBoundsException
    • setFrameTriggerDelayMS

      void setFrameTriggerDelayMS(float delay, int frame) throws IOException, IndexOutOfBoundsException
      Sets 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.
      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.
      IndexOutOfBoundsException - if this is not a 4-D image.
    • setPatientName

      void setPatientName(String name) throws IOException
      Attempts 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.
      Parameters:
      name - the new patient name to be assigned to this image.
      Throws:
      IOException - if the patient name cannot be set.
    • setPatientID

      void setPatientID(String id) throws IOException
      Sets 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.
      Parameters:
      id - the new patient ID to be assigned to this image.
      Throws:
      IOException - if the patient ID cannot be set.
    • setPatientDoB

      void setPatientDoB(Date dob) throws IOException
      Sets 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.
      Parameters:
      dob - the new patient date of birth to be assigned to this image.
      Throws:
      IOException - if the patient date of birth cannot be set.
    • setPatientSex

      void setPatientSex(com.xinapse.dicom.Sex sex) throws IOException
      Sets the patient sex for this image.
      Parameters:
      sex - the patient sex to be assigned to this image.
      Throws:
      IOException - if the patient sex cannot be set.
    • setScanDate

      void setScanDate(Date scanDate) throws IOException
      Sets 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.
      Parameters:
      scanDate - the new scan date/time to be assigned to this image.
      Throws:
      IOException - if the scan date cannot be set.
    • setPatientPosition

      void setPatientPosition(PatientPosition position) throws IOException
      Sets the position in which the patient is lying in the scanning equipment for this WritableImage.
      Parameters:
      position - the position in which the patient is lying in the scanning equipment. e.g. PatientPosition.HFS (head-first supine).
      Throws:
      IOException - if the patient position cannot be set for this image.
    • setStudyID

      void setStudyID(String studyID) throws IOException
      Sets 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.
      Parameters:
      studyID - the new study ID to be assigned to this image.
      Throws:
      IOException - if the study ID cannot be set.
    • setStudyInstanceUID

      void setStudyInstanceUID(com.xinapse.dicom.Uid uid) throws IOException
      Sets the study instance UID for this image.
      N.B. For disk-based images, the changes in the study instance UID will not be reflected on disk unless the close() method is called.
      Parameters:
      uid - the new study instance UID to be assigned to this image.
      Throws:
      IOException - if the study instance UID cannot be set.
    • setSeriesNumber

      void setSeriesNumber(Integer seriesNumber) throws IOException
      Sets 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.
      Parameters:
      seriesNumber - the new series number to be assigned to this image.
      Throws:
      IOException - if the series number cannot be set.
    • setSeriesInstanceUID

      void setSeriesInstanceUID(com.xinapse.dicom.Uid uid) throws IOException
      Sets the series instance UID for this image.
      N.B. For disk-based images, the changes in the series instance UID will not be reflected on disk unless the close() method is called.
      Parameters:
      uid - the new series instance UID to be assigned to this image.
      Throws:
      IOException - if the series instance UID cannot be set.
    • setSeriesDescription

      void setSeriesDescription(String description) throws IOException
      Sets 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.
      Parameters:
      description - the new short description of the series, or null if none is available.
      Throws:
      IOException - if the description cannot be set.
    • supportsIntensityRescaling

      boolean supportsIntensityRescaling()
      Tests whether this WritableImage format supports intensity rescaling.
      Returns:
      true if this WritableImage format supports intensity rescaling; false otherwise.
    • setIntensityRescale

      void setIntensityRescale(float rescaleSlope, float rescaleIntercept) throws InvalidImageException, IOException
      Sets the values m and b in the relationship between pixel intensity (I) values and the output units specified in setRescaleUnits(com.xinapse.dicom.RescaleUnits) in the expression:
      Output units = m*I + b.
      Parameters:
      rescaleSlope - the value of m in the expression above.
      rescaleIntercept - the value of b in the expression above.
      Throws:
      InvalidImageException - if rescaling cannot be set for this image.
      IOException - if an I/O error occurs.
    • setIntensityRescale

      void setIntensityRescale(float[] rescaleSlopeIntercept) throws InvalidImageException, IOException
      Sets the values m and b in the relationship between pixel intensity (I) values and the output units specified in setRescaleUnits(com.xinapse.dicom.RescaleUnits) in the expression:
      Output units = m*I + b.
      Parameters:
      rescaleSlopeIntercept - an array of length 2, containing the values of m and b in the expression above, in that order.
      Throws:
      InvalidImageException - if rescaling cannot be set for this image.
      IOException - if an I/O error occurs.
    • setRescaleUnits

      void setRescaleUnits(com.xinapse.dicom.RescaleUnits units) throws IOException
      Sets the rescale units.
      Parameters:
      units - the rescale units.
      Throws:
      IOException - if the rescale units cannot be set.
    • setFrameOfReferenceUID

      void setFrameOfReferenceUID(com.xinapse.dicom.Uid uid)
      Sets the frame of reference UID that uniquely identifies the frame of reference for an image.
      Parameters:
      uid - the frame of reference UID. If uid is null, the frame of reference Uid is removed from the image header.
    • putSlice

      void putSlice(Object slicePix, int slice) throws IOException, InvalidImageException
      Puts the pixel values to one slice of an n-dimensional image, where n > 1.

      N.B.Whenever the radiological orientation of the image can be determined, this method sets pixel values such that when the slice is viewed on-screen, the first pixel in the array belongs at the top left of the screen, and the last pixel in the array belongs at the bottom right of the screen. This must be regardless of the sub-class of image.

      Parameters:
      slicePix - 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:
      IOException - if an error occurs during the writing of the pixel data.
      InvalidImageException - if the image does not have the right dimensionality, if the slice number is inappropriate for this image, if the array is not of the correct primitive data type for this image, or if there is a problem accessing the pixel values.
    • putPix

      void putPix(Object pixels, boolean radiological) throws IOException, InvalidImageException
      Put pixel values from a specified array to this image. array is an array of the correct type of element for this image from which pixel values will be copied; it must be cast to an Object and must have the correct number of elements.
      Parameters:
      pixels - a 1-dimensional array of pixel values of the correct java primitive data type to put to the image.
      radiological - true if the pixels have a standard radiological orientation Standard radiological orientation is:
      • For axial images, increasing left coordinate with column number, and increasing posterior coordinate with row number.
      • For coronal images, increasing left coordinate with column number, and increasing inferior coordinate with row number.
      • For sagittal images, increasing posterior coordinate with column number, and increasing inferior coordinate with row number.
      If false, the pixels are put without any consideration of the orientation.
      Throws:
      InvalidImageException - if an I/O error occurs while accessing the pixel values.
      IOException - if an error occurs during the writing of the pixel data.
    • putPix

      void putPix(Object pix, int[] pixIdx) throws IOException, InvalidImageException
      Puts a single pixel value to the image.
      Parameters:
      pix - the pixel value to put, as a suitable Object.
      pixIdx - an int[] of length at least equal to nDim for this image where each element corresponds to an index to the pixel in each dimension. The first element of pixIdx refers 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, and pixIdx[2] refers to the column dimension.
      Throws:
      IOException - if an I/O error occurs while accessing the pixel values.
      InvalidImageException - if the indices are inappropriate for this image, if the supplied pixel is of the wrong Class, or if the pixel value cannot be written to the image.
    • putPix

      void putPix(Object pixels, int[] lowIdx, int[] highIdx) throws IOException, InvalidImageException
      Put pixel values from a specified array to this image. array is an array of the correct type of element for this image from which pixel values will be copied; it must be cast to an Object and must have the right number of elements to copy to the pixel values requested. The lowIdx and highIdx int arrays should have at least nDim elements, and the elements specify the pixel number range for each dimension. For example, if an image has nDim = 3, and dims[] = {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}.
      Parameters:
      pixels - a 1-dimensional array of pixel values of the correct java primitive data type to put to the image.
      lowIdx - an array of int specifying the low index of pixel values to put.
      highIdx - an array of int specifying the high index of pixel values to put.
      Throws:
      IOException - if an I/O error occurs while writing the pixel values.
      InvalidImageException - if the indices supplied extend beyond the image, the pixel values are of the wrong primitive data type or cannot be put for other reasons.
    • setPixelSpacing

      void setPixelSpacing(Float[] pixelSpacing) throws IOException, IndexOutOfBoundsException
      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. The distances and time should always be positive values.
      Parameters:
      pixelSpacing - 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.
      IndexOutOfBoundsException - if spacing does not have the correct dimensions.
    • setSliceThickness

      void setSliceThickness(Float thickness) throws IOException
      Sets 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.
      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.
    • setImageOrientationPositionPatient

      void setImageOrientationPositionPatient(org.jogamp.vecmath.Vector3f[] orientation, org.jogamp.vecmath.Point3f position, boolean force) throws IOException
      Sets the direction cosines of the row, column and slice directions of the image, the coordinates of the center of the first pixel of the image, in patient (LPS) coordinates.

      N.B. the actual position and orientation set by this method may not be those specified. For example, for NIFTI-1 images, the actual orientation and position may depend on the user Preferences for whether to put pixel values in an order that is compatible with SPM. After using this method, you should use the ReadableImage.getImageOrientationPatient() and ReadableImage.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.

      Parameters:
      orientation - the direction cosines of the image row, column and (optionally) slice directions respectively in Left,Posterior,Superior (LPS) coordinates. If orientation is null, 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 is null, this method will attempt to clear any positional information, if that is supported by the image format.
      force - if true, this method will force the orientation and position to be set as requested, regardless of the user Preferences. This can be useful if you read the orientation from an existing image, and you want to set the orientation exactly the same in a new image.
      Throws:
      IndexOutOfBoundsException - if the orientation array does not have the correct length.
      IOException - if an I/O error occurs.
    • setImageOrientationPatient

      void setImageOrientationPatient(org.jogamp.vecmath.Vector3f[] orientation, int slice) throws IOException
      Sets the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient (LPS) coordinates.

      If the orientation cannot be set for this image, this method does nothing.

      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 the cosines array does not have the correct dimensions.
      IOException - if an I/O error occurs.
    • setImagePositionPatient

      void setImagePositionPatient(org.jogamp.vecmath.Point3f position, int slice) throws IOException
      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.
      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.
      Throws:
      IOException - if the position cannot be set for this image, if position does not have the correct dimensions, or if the slice number is out of range.
    • setMinMax

      void setMinMax(int min, int max) throws InvalidImageException
      Sets the min and max pixel values for this WritableImage. It is up to the caller to ensure that the values supplied are correct at the time they are written to the image. Any subsequent changes to the image pixel values may cause either the values returned by getMin() and getMax() to be incorrect, or cause these methods to throw a InvalidImageException.
      Parameters:
      min - the minimum pixel value in the image.
      max - the maximum pixel value in the image.
      Throws:
      InvalidImageException - if the values supplied are unsuitable, or the values cannot be set.
    • setSuggestedFileName

      void setSuggestedFileName(String name)
      Sets a suggested file name for this WritableImage that might be used when saving to disk later.
      Parameters:
      name - the suggested file name.
    • write

      Writes this WritableImage to a file (or possibly a pair of header/image files).
      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.
      IOException - if an I/O error occurs.
    • getCopy

      WritableImage getCopy() throws IOException
      Returns a copy of this WritableImage.
      Specified by:
      getCopy in interface ReadableImage
      Returns:
      a copy of this ReadableImage.
      Throws:
      IOException - if the an I/O error occurs whilst copying.
    • anonymise

      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
      Anonymise this WritableImage.
      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.