environment
OS: win10 64 bit JDK version: 1.8 64 bit
code
import java.io.File;
import java.io.IOException;
public class Dcm2JpgTest {
public static void main(String[] args) throws IOException {
try{
File src = new File("d:\\Test.dcm");
File dest = new File("d:\\Test.jpg");
Dcm2Jpeg dcm2jpg= new Dcm2Jpeg();
dcm2jpg.convert(src, dest);
System.out.println("Completed");
} catch(IOException e){
e.printStackTrace();
} catch(Exception e){
e.printStackTrace();
}
}
}
jar package reference
The following jar package is not in the maven library, the latest maven is 5, but that seems to have a problem
- dcm4che-tool-dcm2jpg-2.0.23.jar
- dcm4che-core-2.0.23.jar
- dcm4che-image-2.0.23.jar
- dcm4che-imageio-2.0.23.jar
- dcm4che-imageio-rle-2.0.23.jar
- slf4j-log4j12-1.5.0.jar
- slf4j-api-1.5.0.jar
- log4j-1.2.13.jar
- commons-cli-1.2.jar
Error solution
The core key is to install the jai_imageio library:
- Install 32-bit JDK
- Install jai_imageio-1_0_01-lib-windows-i586-jdk to 32-bit JDK
- Switch the java runtime environment to 32-bit JDK
Remarks: According to the official installation instructions of dcm4chee, dcm4chee and dcm4che2-tools can successfully complete dcm compression and decompression in Linux32bits, Linux64bits, and Windows32bits, but the Windows64bits environment cannot be used, and the 32-bit environment is the problem.