Dicom的多帧转单帧(BTO2CTO)【JAVA】
目的:将一张多帧的dicom图像转成N张单帧的dicom图像。
测试的Dicom(BTO)可以看到有里面共有62帧。
传输语法也可以看到是1.2.840.10008.1.2.4.70,即代表是JPEG Lossless(JPEG无损压缩),可以从dcm4che-core-5.12中的UID.class中知道


正式开始了…
maven 主要引用
org.dcm4che.tool dcm4che-tool-emf2sf 5.12.0
这个jar包里面有一段函数是这样的
Emf2sf.javapublic static void main(String[] args) {try {CommandLine cl = parseComandLine(args);Emf2sf main = new Emf2sf();if (cl.hasOption("frame"))main.setFrames(toFrames(cl.getOptionValues("frame")));main.setPreserveSeriesInstanceUID(cl.hasOption("not-chseries"));main.setOutputDirectory(new File(cl.getOptionValue("out-dir", ".")));if (cl.hasOption("out-file"))main.setOutputFileFormat(cl.getOptionValue("out-file"));long start = System.currentTimeMillis();int n = main.extract(new File(fname(cl.getArgList())));long end = System.currentTimeMillis();System.out.println();System.out.println(MessageFormat.format(rb.getString("extracted"), n,(end - start) / 1000f));} catch (ParseException e) {System.err.println("emf2sf: " + e.getMessage());System.err.println(rb.getString("try"));System.exit(2);} catch (Exception e) {System.err.println("emf2sf: " + e.getMessage());e.printStackTrace();System.exit(2);}}
这里有个main函数:而这里有个String[] args 参数;
这个参数的用法如下:
usage: emf2sf [] The emf2sf utility converts a DICOM Enhanced CT, MR or PET Multi-frameimage to legacy DICOM Single-frame CT, MR, PET images.-Options:-f,--frame comma separated numbers of frames to convert;convert all frames by default-h,--help display this help and exit--inst-no specifies instance number in createdSingle-frame images as printf pattern. First %will be replaced by the instance number of theEnhanced Multi-frame image, second % by theframe number (default: '%s%04d')--not-chseries do not change Series Instance UID in createdSingle-frame images--out-dir directory to which extracted frames are storedin DICOM files with file names specified byoption --out-file (default: '.')--out-file name of DICOM files of converted legacy DICOMSingle-frame images written to the directoryspecified by out-dir. Zeros will be replacedby the frame number (default:-000.dcm)-V,--version output version information and exitExample:$ emf2sf -f 1,20,120 --out-file ct-000.dcm ct-emf.dcmExtract frame 1, 20 and 120 from Enhanced CT Multi-frame image ct-emf.dcmto legacy DICOM Single-frame CT images ct-001.dcm, ct-020.dcm andct-120.dcm.
这里我在调用时候
String[] args= new String[] { "--out-dir", //启用自定义目录的参数outFloder.getAbsolutePath(), //转换后的目录(文件夹目录)dcm.getAbsolutePath() //待转换文件(BTO的全路径)};
这时候生成的62张dicom的单帧传输语法也是1.2.840.10008.1.2.4.70。

而经过解压后的文件大小约4412k。下篇文章将如果将压缩过得dicom解压。
我把我测试的bto上传,仅技术交流,请不要用于商业宣传,违者必究!谢谢合作!
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
