Posted by
ctrueden on
Mar 22, 2011; 3:31pm
URL: http://imagej.273.s1.nabble.com/automatically-load-DICOM-stack-from-folder-tp3685323p3685326.html
Hi Tony,
I would like my plugin to open a DICOM image into a stack, just like from
> the menu "file .. import sequence.." when the folder is known, where all the
> files (slices) are.
>
If your DICOM files are numbered, you can do this using the Bio-Formats
Importer plugin API. Try something like:
import loci.plugins.BF;
import loci.plugins.in.ImporterOptions;
...
ImporterOptions options = new ImporterOptions();
options.setGroupFiles(true);
options.setId(oneOfTheDicomFiles);
ImagePlus thisDicom = BF.openImagePlus(options)[0];
The "setGroupFiles(true)" command instructs Bio-Formats to attempt to group
files in the same folder based on numbering.
You will need loci_tools.jar in your classpath for this to compile.
HTH,
Curtis
On Tue, Mar 22, 2011 at 4:39 AM, Tony Shepherd
<
[hidden email]>wrote:
> Hi,
> I would like my plugin to open a DICOM image into a stack, just like from
> the menu "file .. import sequence.." when the folder is known, where all the
> files (slices) are.
> The code would look something like:
>
> ImagePlus thisDicom = IJ.load("path-to-folder", "DICOM")
> or
> ImagePlus thisDicom = IJ.loadDicom("path-to-folder")
>
> Can I do this (even if it means downloading a class library and using
> 'import newLibrary.*;' at the head of the plugin) ?
>