com.pixelmed.display

## Class SourceImage

- java.lang.Object
- - com.pixelmed.display.SourceImage

Direct Known Subclasses:
  SourceImageSubset

    public class SourceImage
    extends java.lang.Object

A class that encapsulates the pixel data and features and values from an image source (such as a DICOM image), usually for the purpose of displaying it.

See Also:
  `SingleImagePanel`

### Field Summary

Fields
`protected com.pixelmed.display.SourceImage.BufferedImageSource` `bufferedImageSource`
`protected java.nio.MappedByteBuffer` `memoryMappedByteBuffer`
`protected java.nio.channels.FileChannel` `memoryMappedFileChannel`
`protected java.io.FileInputStream` `memoryMappedFileInputStream`
`protected static int` `memoryMapperNumberOfRetries`
`protected static int` `memoryMapperRetriesBeforeSleeping`
`protected static int` `memoryMapperSleepTimeBetweenRetries`

### Constructor Summary

Constructors
`protected` `SourceImage()` Allow subclasses to have their own constructors.
`` `SourceImage(AttributeList list)` Construct an image from a single or multi-frame DICOM image from a list of DICOM attributes.
`` `SourceImage(DicomInputStream i)` Construct an image from a single or multi-frame DICOM image from an input stream (such as from a file or the network).
`` `SourceImage(java.io.InputStream i, int w, int h, int depth)` Construct a single-frame image from an unsigned raw image (no header) on an input stream with the specified width, height and bit depth.
`` `SourceImage(java.io.InputStream i, int w, int h, int depth, int frames)` Construct a multi-frame image from an unsigned raw image (no header) on an input stream with the specified width, height and bit depth.
`` `SourceImage(java.lang.String filename)` Construct an image from a single or multi-frame DICOM image from a file.

### Method Summary

Methods
`protected static void` `clean(java.lang.Object object)`
`void` `close()`
`protected void` `finalize()`
`int` `getBackgroundValue()`
`java.awt.image.BufferedImage` `getBufferedImage()`
`java.awt.image.BufferedImage` `getBufferedImage(int i)`
`protected java.nio.ByteBuffer` `getByteBufferFromOtherAttributeOnDisk(OtherAttributeOnDisk oad)` Get a memory mapped file buffer for value of the specified attribute.
`java.awt.Dimension` `getDimension()`
`DisplayShutter` `getDisplayShutter()`
`int` `getHeight()`
`int` `getMaskValue()`
`double` `getMaximum()`
`double` `getMinimum()`
`ModalityTransform` `getModalityTransform()`
`int` `getNumberOfBufferedImages()`
`int` `getNumberOfFrames()`
`Overlay` `getOverlay()`
`int` `getPadRangeLimit()`
`int` `getPadValue()`
`int` `getPaletteColorBitsPerEntry()`
`short[]` `getPaletteColorBlueTable()`
`int` `getPaletteColorFirstValueMapped()`
`short[]` `getPaletteColorGreenTable()`
`int` `getPaletteColorLargestGray()`
`int` `getPaletteColorNumberOfEntries()`
`short[]` `getPaletteColorRedTable()`
`RealWorldValueTransform` `getRealWorldValueTransform()`
`protected java.nio.ShortBuffer` `getShortBufferFromOtherWordAttributeOnDisk(OtherWordAttributeOnDisk oad)` Get a memory mapped file buffer for value of the specified attribute.
`SUVTransform` `getSUVTransform()`
`java.lang.String` `getTitle()`
`VOITransform` `getVOITransform()`
`int` `getWidth()`
`boolean` `isGrayscale()`
`boolean` `isInverted()`
`boolean` `isPadded()`
`boolean` `isSigned()`
`boolean` `isYBR()`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### bufferedImageSource

    protected com.pixelmed.display.SourceImage.BufferedImageSource bufferedImageSource

#### memoryMappedFileInputStream

    protected java.io.FileInputStream memoryMappedFileInputStream

#### memoryMappedFileChannel

    protected java.nio.channels.FileChannel memoryMappedFileChannel

#### memoryMappedByteBuffer

    protected java.nio.MappedByteBuffer memoryMappedByteBuffer

#### memoryMapperNumberOfRetries

    protected static int memoryMapperNumberOfRetries

#### memoryMapperSleepTimeBetweenRetries

    protected static int memoryMapperSleepTimeBetweenRetries

#### memoryMapperRetriesBeforeSleeping

    protected static int memoryMapperRetriesBeforeSleeping

### Constructor Detail

#### SourceImage

    protected SourceImage()

Allow subclasses to have their own constructors.

#### SourceImage

    public SourceImage(java.io.InputStream i,
               int w,
               int h,
               int depth)
                throws java.io.IOException

Construct a single-frame image from an unsigned raw image (no header) on an input stream with the specified width, height and bit depth.

Parameters:
  `i` - the input stream
  `w` - image width
  `h` - image height
  `depth` - bit depth
Throws:
  `java.io.IOException`

#### SourceImage

    public SourceImage(java.io.InputStream i,
               int w,
               int h,
               int depth,
               int frames)
                throws java.io.IOException

Construct a multi-frame image from an unsigned raw image (no header) on an input stream with the specified width, height and bit depth.

Parameters:
  `i` - the input stream
  `w` - image width
  `h` - image height
  `depth` - bit depth
  `frames` - number of frames
Throws:
  `java.io.IOException`

#### SourceImage

    public SourceImage(java.lang.String filename)
                throws java.io.IOException,
                       DicomException

Construct an image from a single or multi-frame DICOM image from a file.

Parameters:
  `filename` -
Throws:
  `java.io.IOException`
  `DicomException`

#### SourceImage

    public SourceImage(DicomInputStream i)
                throws java.io.IOException,
                       DicomException

Construct an image from a single or multi-frame DICOM image from an input stream (such as from a file or the network).

Parameters:
  `i` - the input stream
Throws:
  `java.io.IOException`
  `DicomException`

#### SourceImage

    public SourceImage(AttributeList list)
                throws DicomException

Construct an image from a single or multi-frame DICOM image from a list of DICOM attributes.

Parameters:
  `list` - the list of attributes that include the description and values of the pixel data
Throws:
  `DicomException`

### Method Detail

#### clean

    protected static void clean(java.lang.Object object)
                         throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### close

    public void close()
               throws java.lang.Throwable

Throws:
  `java.lang.Throwable`

#### finalize

    protected void finalize()
                     throws java.lang.Throwable

Overrides:
  `finalize` in class `java.lang.Object`
Throws:
  `java.lang.Throwable`

#### getByteBufferFromOtherAttributeOnDisk

    protected java.nio.ByteBuffer getByteBufferFromOtherAttributeOnDisk(OtherAttributeOnDisk oad)
                                                                 throws DicomException,
                                                                        java.io.IOException

Get a memory mapped file buffer for value of the specified attribute.

Parameters:
  `oad` - the attribute on disk to memory map
Throws:
  `DicomException`
  `java.io.IOException`

#### getShortBufferFromOtherWordAttributeOnDisk

    protected java.nio.ShortBuffer getShortBufferFromOtherWordAttributeOnDisk(OtherWordAttributeOnDisk oad)
                                                                       throws DicomException,
                                                                              java.io.IOException

Get a memory mapped file buffer for value of the specified attribute.

Parameters:
  `oad` - the attribute on disk to memory map
Throws:
  `DicomException`
  `java.io.IOException`

#### getBufferedImage

    public java.awt.image.BufferedImage getBufferedImage()

#### getBufferedImage

    public java.awt.image.BufferedImage getBufferedImage(int i)

#### getNumberOfBufferedImages

    public int getNumberOfBufferedImages()

#### getWidth

    public int getWidth()

#### getHeight

    public int getHeight()

#### getDimension

    public java.awt.Dimension getDimension()

#### getMinimum

    public double getMinimum()

Returns:
  the minimum pixel value, excluding any pixels in the padding value range

#### getMaximum

    public double getMaximum()

Returns:
  the maximum pixel value, excluding any pixels in the padding value range

#### getMaskValue

    public int getMaskValue()

#### isSigned

    public boolean isSigned()

#### isInverted

    public boolean isInverted()

#### isPadded

    public boolean isPadded()

#### getPadValue

    public int getPadValue()

#### getPadRangeLimit

    public int getPadRangeLimit()

#### getBackgroundValue

    public int getBackgroundValue()

#### isGrayscale

    public boolean isGrayscale()

#### isYBR

    public boolean isYBR()

#### getTitle

    public java.lang.String getTitle()

#### getNumberOfFrames

    public int getNumberOfFrames()

#### getPaletteColorLargestGray

    public int getPaletteColorLargestGray()

#### getPaletteColorFirstValueMapped

    public int getPaletteColorFirstValueMapped()

#### getPaletteColorNumberOfEntries

    public int getPaletteColorNumberOfEntries()

#### getPaletteColorBitsPerEntry

    public int getPaletteColorBitsPerEntry()

#### getPaletteColorRedTable

    public short[] getPaletteColorRedTable()

#### getPaletteColorGreenTable

    public short[] getPaletteColorGreenTable()

#### getPaletteColorBlueTable

    public short[] getPaletteColorBlueTable()

#### getSUVTransform

    public SUVTransform getSUVTransform()

#### getRealWorldValueTransform

    public RealWorldValueTransform getRealWorldValueTransform()

#### getModalityTransform

    public ModalityTransform getModalityTransform()

#### getVOITransform

    public VOITransform getVOITransform()

#### getDisplayShutter

    public DisplayShutter getDisplayShutter()

#### getOverlay

    public Overlay getOverlay()