Skip to content

Instantly share code, notes, and snippets.

@jpt1122
Last active August 29, 2015 14:02
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"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment