Login  Register

Re: How to export images into DICOM in Java code??

Posted by Michael Schmid on Aug 20, 2012; 2:29pm
URL: http://imagej.273.s1.nabble.com/How-to-export-images-into-DICOM-in-Java-code-tp4999810p4999811.html

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html