Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hello Hacklaender,
I'm a developer working with ImageJ for quite a long time. It was recently that I discovered ImageJ does not have a function like saveAsDicom, and the only possibility seems to be using plugins such as dcmie or tudordicom...... Both plugins are quite big, with non-necessary code for my research project. As dcmie requires less third-part dependency, I try to make it work for my project. I red the Dcm_Export.java and FileExporter.java, but still has no idea about how to make it work. Suppose that I have two variables, a ImagePlus "imp" which contains the images and a path "path" to save as. Usually suing FileSaver, it can be done in two lines: ===================================== FileSaver fs = new FileSaver(imp); fs.saveAsTiff(path); ===================================== Now with Dcm_Export, I initialized an instance but did not find one function which deal with the export. The FileExporter, on the other hand, requires 4 variables, which are not trivial to obtain from my point of view. Could you give me a hand? Best regards, Xin -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi Xin,
for plugins that you can't call via their API, it is usually easiest to use 'IJ.run' to invoke them. Simply use the Plugins>Macros>Record (with the Record type set to Plugin) to see what the command should look like. IJ.run has two versions, one where an ImagePlus can be specified [run(imp, command, options)], and one without the ImagePlus, where the current foreground image is used. This should work with all plugins that appear in the menu and use standard ImageJ dialogs. Michael ________________________________________________________________ On Aug 18, 2012, at 10:48, 周鑫 wrote: > I'm a developer working with ImageJ for quite a long time. > > It was recently that I discovered ImageJ does not have a function like saveAsDicom, > and the only possibility seems to be using plugins such as dcmie or tudordicom...... > Both plugins are quite big, with non-necessary code for my research project. > As dcmie requires less third-part dependency, I try to make it work for my project. > I red the Dcm_Export.java and FileExporter.java, but still has no idea about how to make it work. > Suppose that I have two variables, a ImagePlus "imp" which contains the images and a path "path" to save as. > > Usually suing FileSaver, it can be done in two lines: > ===================================== > FileSaver fs = new FileSaver(imp); > fs.saveAsTiff(path); > ===================================== > > Now with Dcm_Export, I initialized an instance but did not find one function which deal with the export. > The FileExporter, on the other hand, requires 4 variables, which are not trivial to obtain from my point of view. > > Could you give me a hand? > > Best regards, Xin ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
In reply to this post by 周鑫
Take a look at our DICOM Toolkit
http://www.santec.lu/project/dicom it offers a DICOM Exporter class: DicomExporter exporter = new DicomExporter(); File dcmFile = new File("/home/hermenj/jhermen.dcm"); ImagePlus ip = new ImagePlus("/home/hermenj/im0"); DicomObject dObj = exporter.createHeader(ip, true, true, true); exporter.write(dObj, ip, dcmFile, true); Greets Johannes ----------------------------------------------------------------- Johannes Hermen - Ingenieur de Recherche [hidden email] ----------------------------------------------------------------- CRP Henri Tudor http://www.santec.tudor.lu 29, Avenue John F. Kennedy L-1855 Luxembourg ----------------------------------------------------------------- From: 周鑫 <[hidden email]> To: <[hidden email]>, Date: 18.08.2012 10:49 Subject: How to export images into DICOM in Java code?? Sent by: ImageJ Interest Group <[hidden email]> Hello Hacklaender, I'm a developer working with ImageJ for quite a long time. It was recently that I discovered ImageJ does not have a function like saveAsDicom, and the only possibility seems to be using plugins such as dcmie or tudordicom...... Both plugins are quite big, with non-necessary code for my research project. As dcmie requires less third-part dependency, I try to make it work for my project. I red the Dcm_Export.java and FileExporter.java, but still has no idea about how to make it work. Suppose that I have two variables, a ImagePlus "imp" which contains the images and a path "path" to save as. Usually suing FileSaver, it can be done in two lines: ===================================== FileSaver fs = new FileSaver(imp); fs.saveAsTiff(path); ===================================== Now with Dcm_Export, I initialized an instance but did not find one function which deal with the export. The FileExporter, on the other hand, requires 4 variables, which are not trivial to obtain from my point of view. Could you give me a hand? Best regards, Xin -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hello Johannes,
Thank you so much. It works!!!! However, the tudor tookit is a big package. In order to benefit the others, I list the only part that is necessary for DICOM export. - 3 jars which are in the tudor tookit lib: dcm4che-core-2.0.26.jar, dcm4che-iod-2.0.26.jar, slf4j-api-1.6.1.jar - they two classes in src folder: DicomExporter.java and DicomHeader.java. Finally, just use the code: DicomExporter exporter = new DicomExporter(); File dcmFile = new File("/home/hermenj/jhermen.dcm"); ImagePlus ip = new ImagePlus("/home/hermenj/im0"); DicomObject dObj = exporter.createHeader(ip, true, true, true); exporter.write(dObj, ip, dcmFile, true); Best regards, Xin > -----原始邮件----- > 发件人: "Johannes Hermen" <[hidden email]> > 发送时间: 2012年8月21日 星期二 > 收件人: [hidden email] > 抄送: > 主题: Re: How to export images into DICOM in Java code?? > > Take a look at our DICOM Toolkit > > http://www.santec.lu/project/dicom > > it offers a DICOM Exporter class: > > DicomExporter exporter = new DicomExporter(); > File dcmFile = new File("/home/hermenj/jhermen.dcm"); > ImagePlus ip = new ImagePlus("/home/hermenj/im0"); > DicomObject dObj = exporter.createHeader(ip, true, true, true); > exporter.write(dObj, ip, dcmFile, true); > > > Greets > Johannes > > > > ----------------------------------------------------------------- > Johannes Hermen - Ingenieur de Recherche > [hidden email] > ----------------------------------------------------------------- > CRP Henri Tudor http://www.santec.tudor.lu > 29, Avenue John F. Kennedy > L-1855 Luxembourg > ----------------------------------------------------------------- > > > > From: 周鑫 <[hidden email]> > To: <[hidden email]>, > Date: 18.08.2012 10:49 > Subject: How to export images into DICOM in Java code?? > Sent by: ImageJ Interest Group <[hidden email]> > > > > Hello Hacklaender, > > I'm a developer working with ImageJ for quite a long time. > > It was recently that I discovered ImageJ does not have a function like > saveAsDicom, > > and the only possibility seems to be using plugins such as dcmie or > tudordicom...... > > Both plugins are quite big, with non-necessary code for my research > project. > > As dcmie requires less third-part dependency, I try to make it work for my > project. > > I red the Dcm_Export.java and FileExporter.java, but still has no idea > about how to make it work. > > Suppose that I have two variables, a ImagePlus "imp" which contains the > images and a path "path" to save as. > > Usually suing FileSaver, it can be done in two lines: > > ===================================== > > FileSaver fs = new FileSaver(imp); > fs.saveAsTiff(path); > > ===================================== > > Now with Dcm_Export, I initialized an instance but did not find one > function which deal with the export. > > The FileExporter, on the other hand, requires 4 variables, which are not > trivial to obtain from my point of view. > > Could you give me a hand? > > Best regards, Xin > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Disable Popup Ads | Edit this page |