DICOM: How the dcm4che toolkit compresses the dcm file (continued ),

Source: Internet
Author: User
Tags ultraedit

DICOM: How the dcm4che toolkit compresses the dcm file (continued ),

Some time ago, the blog DICOM: How to compress the dcm file in the dcm4che Toolkit (previous article) raised a question:"Using dcm2dcm in the dcm4che toolkit to compress and compress the dcm file,Change Transfer Syntax in the dcm file, for example, from 1.2.840.10008.1.2 (Implicit VR Little Endian) to 1.2.840.10008. (JPEG LossLess, Non-Hierarchical, First_order Prediction Process 14). However, because I didn't know much about the Image IO class in Java, I didn't find a solution to the problem.
FortunatelyShortly after the publication, I received an email from enthusiastic bloggers and provided the installation packages required for the solution in the attachment. As instructed by the email, after local Eclipse debugging, it has been verified that this problem can be solved smoothly. I will try again to explain this article and thank you againNanarongrongSelfless support.

Boyou solution:

The local environment has been changed to a 32-bit environment according to the previous article DICOM: dcm4che toolkit on How to compress the dcm file (previous article ).NanrongrongAs described in the email, the problem is caused by the lack of clib_jiio.dll in the local 32-bit JRE runtime environment. Double-click the attachment in the installation email. After the installation is complete, the clib_jiio.dll file is added to the bin directory of JRE, and the jai_imageio.jar file is added to the lib/ext directory.

Run the test again locally and enter dcm2dcm-t 1.2.840.10008. c: \ test. dcm c: \ testjpeg. dcm.
As shown in, the command line prompts that the conversion has been successful. But don't be happy too early. You can use the DICOM reader to open the file and find that the file cannot be imported smoothly.

Use the dmongoump tool provided by dcmtk to obtain the following output:

As shown in, bloggers who have read my column should be able to immediately respond to problems and errors,The most common error in DICOM compression and decompression is that PixelData cannot be located smoothly.,Or PixelData writing is incomplete (for example, Bowen DICOM medical image processing: An Example of DICOM Storage operation "storing multiple JPG image data into DCM Files),Or the PixelData data Data Length is written incorrectly, resulting in parsing failure (for example, C-Echo and C-Store of fo-DICOM network transmission in this blog or blog dicom medical image processing). Open the test-jpeg.dcm file in binary mode with UltraEdit and navigate to PixelData (0x7fe0 0010), as shown in:

Describe how to compress PixelData according to the DICOM3.0 standard (to facilitate the description, paste the content in the blog post again). Each compressed Fragment (that is, the label 0 xfffe e000) the Length of the subsequent Fragment needs to be clearly pointed out, and the Value Length in the second Fragment of the test-jpeg.dcm file just obtained is actually 00 00 00.

To verify our ideas, manually write the Fragment length in UltraEdit. First drag in UE to the end of the test-jpeg.dcm file, locate 0 xfffe e0dd (that is, SequenceItem Terminator), location is0x3A23D, Starting from0x87CAnd the resulting length is0x3A23D-0x87C + 0x1 = 0x39A72, Arranged as 72 9A 03 00 according to the small segment. After modification, the image can be opened smoothly.

So far, we can use the dcm2dcm tool to perform JPEG lossless compression for the dcm file, but there is still a small problem. Continue.

Dcm2dcm source code analysis:

Download the dcm4che2 source code from the official website, after importing in Eclipse, start the dcm4che-tool-dcm2dcm project. The configuration of debugging parameters is as follows:

Note: The jre debugging environment should be specified as the 32-bit runtime environment after we install the jai_imageio-1_0_01-lib-windows-i586-jdk library.

One-step debugging to the writeBytesToSequence function in DicomImageWriter. java shows that the length of PixelData is 236146, that is, the hexadecimal 0x39A72. Therefore, it can be proved that the dcm2dcm project source code is no problem, may be the local cmd environment configuration of the dcm4che2-bin package older caused by the problem, re-generate the dcm4che2-tool-dcm2dcm.jar package, and then local test, the correct image can be obtained smoothly.

This problem has been solved successfully!

Jai_imageio Library:

Thank you for your enthusiastic help from nanarongrong. The jai_imageio windows 32-bit environment library has been successfully uploaded to CSDN. The download link is:Jai_imageio_for_win32
Note: According to the dcm4chee official installation instructions, dcm4chee and dcm4che2-tools in Linux32bits and Linux64bits, and Windows32bits can be smoothly completed dcm compression and decompression, but Windows64bits environment is not, this is the problem we encountered above. Why is JRE switched to a 32-bit environment.

By zssure@163.com
Time: 2015/08/02

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.