You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
16:58:28.676 [main] DEBUG org.dcm4che3.imageio.codec.Transcoder - Compressor: org.dcm4che3.opencv.NativeJ2kImageWriter
16:58:28.834 [main] DEBUG org.dcm4che3.imageio.codec.Transcoder - Compressed frame #1 in 136 ms, ratio 33.67608:1
Failed to transcode C:\Users\Administrator\Desktop\test\1.dcm: null
java.io.EOFException
at org.dcm4che3.util.StreamUtils.skipFully(StreamUtils.java:78)
at org.dcm4che3.io.DicomInputStream.skipFully(DicomInputStream.java:469)
at org.dcm4che3.imageio.codec.Transcoder.compressPixelData(Transcoder.java:596)
at org.dcm4che3.imageio.codec.Transcoder.processPixelData(Transcoder.java:513)
at org.dcm4che3.imageio.codec.Transcoder.access$800(Transcoder.java:71)
at org.dcm4che3.imageio.codec.Transcoder$1.readValue(Transcoder.java:466)
at org.dcm4che3.io.DicomInputStream.readAttributes(DicomInputStream.java:681)
at org.dcm4che3.io.DicomInputStream.readAllAttributes(DicomInputStream.java:568)
at org.dcm4che3.imageio.codec.Transcoder.transcode(Transcoder.java:440)
at org.dcm4che3.tool.dcm2dcm.Dcm2Dcm.transcodeWithTranscoder(Dcm2Dcm.java:428)
at org.dcm4che3.tool.dcm2dcm.Dcm2Dcm.transcode(Dcm2Dcm.java:343)
at org.dcm4che3.tool.dcm2dcm.Dcm2Dcm.mtranscode(Dcm2Dcm.java:334)
at org.dcm4che3.tool.dcm2dcm.Dcm2Dcm.mtranscode(Dcm2Dcm.java:316)
at org.dcm4che3.tool.dcm2dcm.Dcm2Dcm.main(Dcm2Dcm.java:288)
Although this solves the problem, I only have a byte array Transcoder transcoder = new Transcoder(new DicomInputStream(byteArrayInputStream))
Modify as follows Transcoder transcoder = new Transcoder(new DicomInputStream(new File("c:\\test.dcm")))
The text was updated successfully, but these errors were encountered:
dis.length() is 7515424 and imageDescriptor.getLength() is 7515423,so the padding result is equal to 1.
private void compressPixelData() throws IOException {
int padding = dis.length() - imageDescriptor.getLength();
for (int i = 0; i < imageDescriptor.getFrames(); i++) {
if (decompressor == null){
readFrame();
}
else{
decompressFrame(i);
}
if (i == 0) {
extractEmbeddedOverlays();
adjustDataset();
writeDataset();
dos.writeHeader(Tag.PixelData, VR.OB, -1);
dos.writeHeader(Tag.Item, null, 0);
}
nullifyUnusedBits();
bi = palette2rgb ? BufferedImageUtils.convertPalettetoRGB(originalBi, bi)
: ybr2rgb ? BufferedImageUtils.convertYBRtoRGB(originalBi, bi)
: imageDescriptor.is16BitsAllocated8BitsStored()
? BufferedImageUtils.convertShortsToBytes(originalBi, bi) // workaround for JPEG codec issue
: originalBi;
compressFrame(i);
}
dis.skipFully(padding);
dos.writeHeader(Tag.SequenceDelimitationItem, null, 0);
}
At this step, count is 0 and in.read() is -1, resulting in an error message.
public static void skipFully(InputStream in, long n) throws IOException {
while (n > 0) {
long count = in.skip(n);
if (count == 0) {
if (in.read() == -1) {
throw new EOFException();
}
count = 1;
}
n -= count;
}
}
Modify as follows.in.skip(n) is 1,Can be successfully executed Transcoder transcoder = new Transcoder(new DicomInputStream(new File("c:\\test.dcm")))
version:dcm4che5.29.0
I want to compress my dicom.
The code is as follows.
Throw anomaly.
Although this solves the problem, I only have a byte array
Transcoder transcoder = new Transcoder(new DicomInputStream(byteArrayInputStream))
Modify as follows
Transcoder transcoder = new Transcoder(new DicomInputStream(new File("c:\\test.dcm")))
The text was updated successfully, but these errors were encountered: