Package com.idrsolutions.image.dicom
Class DicomDecoder
java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.dicom.DicomDecoder
- All Implemented Interfaces:
com.idrsolutions.image.Decoder
public class DicomDecoder
extends com.idrsolutions.image.JDeliImage
implements com.idrsolutions.image.Decoder
Class reads DICOM images as BufferedImage // Make NO assumptions about the BufferedImage type returned as this may
change
Example 1 (Using raw byte data):
DicomDecoder decoder = new DicomDecoder();
BufferedImage decodedImage = decoder.read(dicomBytes);
Example 2 (Using a File):
File dicomFile = new File("C:\\path\\to\\file\\image.dcm");
DicomDecoder decoder = new DicomDecoder();
BufferedImage decodedImage = decoder.read(dicomFile);
Example 3 (multi-page Dicom)
DicomDecoder decoder = new DicomDecoder();
final int imageCount = decoder.getImageCount(file);
for (int i = 0; i< imageCount; i++) {
BufferedImage decodedImage = decoder.readImageAt(i, file);
// Insert BufferedImage handling code here
}
-
Field Summary
Fields inherited from class com.idrsolutions.image.JDeliImage
bb
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getFrameCount
(byte[] dicomData) Returns the number of frames in the DICOM data.int
getFrameCount
(File dicomFile) Returns the number of frames in the DICOM data.int
getImageCount
(byte[] dicomData) Returns the number of frames in the DICOM data.int
getImageCount
(File dicomFile) Returns the number of frames in the DICOM data.read
(byte[] dicomData) Make NO assumptions about type of BufferedImage type returned as this may changeread
(int frameNumber, byte[] dicomData) Please Note: frameNumber should start from 1Please Note: frameNumber should start from 1Make NO assumptions about type of BufferedImage type returned as this may changereadDimension
(byte[] dicomData) Decodes and returns the width and height of dicom imagereadDimension
(File file) Decodes and returns the width and height of dicom imagereadImageAt
(int imageNumber, byte[] dicomData) Please Note: imageNumber should start from 0readImageAt
(int imageNumber, File dicomFile) Please Note: imageNumber should start from 0Methods inherited from class com.idrsolutions.image.JDeliImage
optimiseImage
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.idrsolutions.image.Decoder
readEmbeddedThumbnail, readEmbeddedThumbnail, readImageSpecificMetaData, readImageSpecificMetaData, setMetadata
-
Constructor Details
-
DicomDecoder
public DicomDecoder()
-
-
Method Details
-
read
Make NO assumptions about type of BufferedImage type returned as this may changeDecodes and returns the DICOM image as a BufferedImage from bytes
- Specified by:
read
in interfacecom.idrsolutions.image.Decoder
- Parameters:
dicomData
- byte[] containing the DICOM data to be decoded- Returns:
- BufferedImage The decoded image
- Throws:
Exception
- if an error occurs in reading image
-
read
Make NO assumptions about type of BufferedImage type returned as this may changeDecodes and returns the DICOM image as a BufferedImage from a File
- Specified by:
read
in interfacecom.idrsolutions.image.Decoder
- Parameters:
dicomFile
- DICOM File to be decoded into a BufferedImage- Returns:
- BufferedImage The decoded image
- Throws:
Exception
- if an error occurs in reading image
-
readDimension
Decodes and returns the width and height of dicom image- Specified by:
readDimension
in interfacecom.idrsolutions.image.Decoder
- Parameters:
file
- image image contained in raw data if present- Returns:
- width and height of image
- Throws:
IOException
- if problem reading imageException
-
readDimension
Decodes and returns the width and height of dicom image- Specified by:
readDimension
in interfacecom.idrsolutions.image.Decoder
- Parameters:
dicomData
- image image contained in raw data if present- Returns:
- Rectangle width and height of image
- Throws:
IOException
- if problem reading imageException
-
readImageAt
Please Note: imageNumber should start from 0Decodes and returns the requested DICOM frame image as a BufferedImage from a multi-frame DICOM file.
- Specified by:
readImageAt
in interfacecom.idrsolutions.image.Decoder
- Parameters:
imageNumber
- image number to be decoded and returned (starting from 0)dicomFile
- DICOM File to be decoded into a BufferedImage- Returns:
- BufferedImage The decoded image at the given page number
- Throws:
Exception
- if an error occurs in reading image
-
readImageAt
Please Note: imageNumber should start from 0Decodes and returns the requested DICOM frame image as a BufferedImage from multi-frame DICOM data.
- Specified by:
readImageAt
in interfacecom.idrsolutions.image.Decoder
- Parameters:
imageNumber
- Frame number to be decoded and returned (starting from 0)dicomData
- byte[] containing the DICOM data to be decoded into a BufferedImage- Returns:
- BufferedImage The decoded image at given page number
- Throws:
Exception
- if an error occurs in reading image
-
read
Please Note: frameNumber should start from 1Decodes and returns the requested DICOM frame image as a BufferedImage from a multi-frame DICOM file.
- Parameters:
frameNumber
- Frame number to be decoded and returned (starting from 1)dicomFile
- DICOM File to be decoded into a BufferedImage- Returns:
- BufferedImage The decoded image at the given page number
- Throws:
Exception
- if an error occurs in reading image
-
read
Please Note: frameNumber should start from 1Decodes and returns the requested DICOM frame image as a BufferedImage from multi-frame DICOM data.
- Parameters:
frameNumber
- Frame number to be decoded and returned (starting from 1)dicomData
- byte[] containing the DICOM data to be decoded into a BufferedImage- Returns:
- BufferedImage The decoded image at given page number
- Throws:
Exception
- if an error occurs in reading image
-
getFrameCount
Returns the number of frames in the DICOM data.- Parameters:
dicomData
- byte[] containing the DICOM data- Returns:
- The number of frames in DICOM data.
- Throws:
IOException
- if an error occurs in reading image
-
getFrameCount
Returns the number of frames in the DICOM data.- Parameters:
dicomFile
- File containing the DICOM data- Returns:
- The number of frames in DICOM data.
- Throws:
IOException
- if an error occurs in reading image
-
getImageCount
Returns the number of frames in the DICOM data.- Specified by:
getImageCount
in interfacecom.idrsolutions.image.Decoder
- Parameters:
dicomData
- byte[] containing the DICOM data- Returns:
- The number of frames in DICOM data.
- Throws:
IOException
- if an error occurs in reading image
-
getImageCount
Returns the number of frames in the DICOM data.- Specified by:
getImageCount
in interfacecom.idrsolutions.image.Decoder
- Parameters:
dicomFile
- File containing the DICOM data- Returns:
- The number of frames in DICOM data.
- Throws:
IOException
- if an error occurs in reading image
-