Dicom:dcm4che Toolkit How to compress DCM files discussion (sequel)

Source: Internet
Author: User
Tags ultraedit

Background

Previous Time Bowen Dicom:dcm4che Toolkit How to compress DCM files (previous) A question was raised:"using the DCM2DCM in the Dcm4che Toolkit to compress and compress DCM files , Change the transfer Syntax in the DCM file, for example by 1.2.840.10008.1.2 (implicit VR Little Endian) into 1.2.840.10008.1.2.4.70 (JPEG LossLess, Non-hierarchical,first_order prediction Process). However, the solution to the problem was not found because it was not known to the relevant image IO classes in Java.
It is gratifying to note that shortly after the post was sent to the enthusiastic Bo friends of the E-mail, and in the annex to the solution required for the installation package. Follow the message prompts, after the local eclipse debugging, has been verified to successfully solve the problem, special re-issued a note, and once again thank Bo Friend Nanarongrong selfless help.

Bo Friends Solutions:

The local environment has been in accordance with the previous post Dicom:dcm4che Toolkit How to compress DCM file discussion (previous article) to replace the 32-bit environment, such as Bo friendsNanrongrongAs indicated in the message, the problem is caused by the lack of clib_jiio.dll in the local 32-bit JRE running environment, double-clicking the attachment in the installation message. After installation, you can see that the Clib_jiio.dll file is in the bin directory of the JRE, and there are jai_imageio.jar files in the Lib/ext directory.

Test again locally, enter dcm2dcm-t 1.2.840.10008.1.2.4.70 c:\test.dcm C:\TESTJPEG.DCM
As shown, the command-line prompt has successfully converted. But do not be happy too early, with the DICOM reader to open the discovery can not be successfully imported.

Using the Dcmdump tool provided by DCMTK, the following output results are obtained:

As shown, bloggers who have seen my column should immediately be able to respond to the problem,The most common mistake in dicom in the compression and decompression problem is the inability to locate Pixeldata successfully.or Pixeldata data write incomplete (such as post dicom medical image processing: dicom storage operation "Multiple JPG image data into DCM file")or pixeldata data length write error causes parsing failure (such as Ben Boven, post dicom medical image processing: fo-dicom network transmission C-echo and C-Store, etc.)。 Open the TEST-JPEG.DCM file in binary mode with UltraEdit, and navigate to Pixeldata (0x7fe0 0010) as shown in:

According to the DICOM3.0 standard description of the compressed pixeldata (for the sake of description, again the blog post paste out), each compressed fragment fragment (that is, the label 0xFFFE e000) need to clearly indicate the length of subsequent fragments, The value in the second fragment of the test-jpeg.dcm file you just got is 00 00 00 00.

To verify our idea, manually write the length of the fragment in UltraEdit. First drag in the UE to the end of the test-jpeg.dcm file, navigate to the 0xFFFE e0dd (that is, the Sequenceitem Terminator), the position is0x3a23d, the starting position is0x87c, which results in a length of0x3a23d-0x87c+0x1=0x39a72, according to the paragraph should be arranged in 9A 03 00, such as modified to open the image smoothly


At this point, the DCM2DCM tool can be used to complete the JPEG lossless compression of DCM files, but there is a little bit of problem. Keep looking down.

DCM2DCM Source Analysis:

Download the dcm4che2 source from the official website, and after importing in Eclipse, start the DCM4CHE-TOOL-DCM2DCM project. The debug parameters are configured as follows:

Note: The JRE debug environment should be specified as the 32-bit operating environment after we install the JAI_IMAGEIO-1_0_01-LIB-WINDOWS-I586-JDK library.


Stepping into the writebytestosequence function in Dicomimagewriter.java can see that the length of the Pixeldata is successfully written to 236146, which is the hexadecimal 0x39a72. So it can be proved that DCM2DCM project source code is not a problem, may be the local CMD environment configuration of the Dcm4che2-bin package older cause problems, regenerate Dcm4che2-tool-dcm2dcm.jar package, re-test locally, you can successfully get the correct image.

This problem solved successfully!

Jai_imageio Library:

Thanks Bo friend Nanarongrong's enthusiastic help, Jai_imageio Windows32 position Environment Library has been successfully uploaded to Csdn, download link:jai_imageio_for_win32
Note: In accordance with Dcm4chee official installation documentation, Dcm4chee and Dcm4che2-tools in Linux32bits and Linux64bits, and Windows32bits can successfully complete DCM compression and decompression, The only windows64bits environment is not, this is the problem we encountered above why the JRE switch to 32-bit environment.





[Email protected]
Date: 2015/08/02

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Dicom:dcm4che Toolkit How to compress DCM files discussion (sequel)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.