Friday, 9 August 2013

Read dicom images from Dicom File(.DCM)


  • Require ALL DCMCHE jar file
  • dcm4che-imageio-2.0.25 (Special One)
  • dcm4che-imageio-rle-2.0.25 (Special One)


Iterator<ImageReader> iter = ImageIO.getImageReadersByFormatName("DICOM");
ImageReader readers = (ImageReader)iter.next();
//return DicomImageReadParam
DicomImageReadParam param1 = (DicomImageReadParam) readers.getDefaultReadParam();
// Adjust the values of Rows and Columns in it and add a Pixel Data attribute with the byte array from the DataBuffer of the scaled Raster
ImageInputStream iis = ImageIO.createImageInputStream(file);
//sets the input source to use the given ImageInputSteam or other Object
readers.setInput(iis, true);
BufferedImage image = readers.read(frameNumber, param1);
//Releases all of the native sreen resources used by this Window, its subcomponents, and all of its owned children
readers.dispose();
ImageIO.write(image, "jpg", new File("D://dd1//"+value+".jpg"));
view raw ReadDicomImage hosted with ❤ by GitHub

No comments: