From: <way...@us...> - 2014-03-10 18:29:47
|
Revision: 18254 http://sourceforge.net/p/dcm4che/svn/18254 Author: wayfarer3130 Date: 2014-03-10 18:29:44 +0000 (Mon, 10 Mar 2014) Log Message: ----------- Review #16230: "[#DCM-579] Add a getFrameLength to allow the correct frame length to be used for streaming" (due in 1 day) Subversion - 2 files. Modified Paths: -------------- dcm4che2/trunk/dcm4che-imageio/src/main/java/org/dcm4che2/imageio/plugins/dcm/DicomStreamMetaData.java dcm4che2/trunk/dcm4che-imageio/src/main/java/org/dcm4che2/imageioimpl/plugins/dcm/DicomImageReader.java Modified: dcm4che2/trunk/dcm4che-imageio/src/main/java/org/dcm4che2/imageio/plugins/dcm/DicomStreamMetaData.java =================================================================== --- dcm4che2/trunk/dcm4che-imageio/src/main/java/org/dcm4che2/imageio/plugins/dcm/DicomStreamMetaData.java 2014-03-07 10:16:01 UTC (rev 18253) +++ dcm4che2/trunk/dcm4che-imageio/src/main/java/org/dcm4che2/imageio/plugins/dcm/DicomStreamMetaData.java 2014-03-10 18:29:44 UTC (rev 18254) @@ -52,8 +52,17 @@ private DicomObject dicomObject; boolean isFileMetaInfoIncluded = true; + boolean pixelData = false; - @Override + public boolean isPixelData() { + return pixelData; + } + + public void setPixelData(boolean pixelData) { + this.pixelData = pixelData; + } + + @Override public Node getAsTree(String formatName) { throw new UnsupportedOperationException(); } Modified: dcm4che2/trunk/dcm4che-imageio/src/main/java/org/dcm4che2/imageioimpl/plugins/dcm/DicomImageReader.java =================================================================== --- dcm4che2/trunk/dcm4che-imageio/src/main/java/org/dcm4che2/imageioimpl/plugins/dcm/DicomImageReader.java 2014-03-07 10:16:01 UTC (rev 18253) +++ dcm4che2/trunk/dcm4che-imageio/src/main/java/org/dcm4che2/imageioimpl/plugins/dcm/DicomImageReader.java 2014-03-10 18:29:44 UTC (rev 18254) @@ -311,6 +311,7 @@ pmi = ds.getString(Tag.PhotometricInterpretation); if (dis.tag() == Tag.PixelData) { + streamMetaData.setPixelData(true); if (frames == 0) frames = 1; swapByteOrder = bigEndian && dis.vr() == VR.OW @@ -771,6 +772,20 @@ iis.read(ret); return ret; } + + /** + * Gets the correct frame length for the given instance - can be used instead of the + * @param imageIndex + * @return + * @throws IOException + */ + public int getFrameLength(int imageIndex) throws IOException { + initImageReader(imageIndex); + if( compressed) { + return itemParser.getFrameLength(imageIndex); + } + return calculateFrameLength(); + } /** * Before read image stream, seek the right frame position first. @@ -792,7 +807,7 @@ return frameLen; } /** - * Get the ImageInputStream to read. + * Get the ImageInputStream to read. Use getFrameLength to get the length of the frame to read. * @return */ public ImageInputStream getImageInputStream(int imageIndex, ImageReadParam param) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |