Class 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);
     
    • Constructor Detail

      • DicomDecoder

        public DicomDecoder()
    • Method Detail

      • read

        public BufferedImage read​(byte[] dicomData)
                           throws Exception
        Make NO assumptions about type of BufferedImage type returned as this may change

        Decodes and returns the DICOM image as a BufferedImage from bytes

        Specified by:
        read in interface com.idrsolutions.image.Decoder
        Parameters:
        dicomData - byte[] containing the DICOM data to be decoded
        Returns:
        BufferedImage The decoded image
        Throws:
        Exception
      • read

        public BufferedImage read​(File dicomFile)
                           throws Exception
        Make NO assumptions about type of BufferedImage type returned as this may change

        Decodes and returns the DICOM image as a BufferedImage from a File

        Specified by:
        read in interface com.idrsolutions.image.Decoder
        Parameters:
        dicomFile - DICOM File to be decoded into a BufferedImage
        Returns:
        BufferedImage The decoded image
        Throws:
        Exception
      • read

        public BufferedImage read​(int frameNumber,
                                  File dicomFile)
                           throws Exception
        Please Note: frameNumber should start from 1

        Decodes 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
      • read

        public BufferedImage read​(int frameNumber,
                                  byte[] dicomData)
                           throws Exception
        Please Note: frameNumber should start from 1

        Decodes 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
      • getFrameCount

        public int getFrameCount​(byte[] dicomData)
                          throws IOException
        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
      • getFrameCount

        public int getFrameCount​(File dicomFile)
                          throws IOException
        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