How to work with an image sequence in an ImageJ 2.x plugin?

Hey there, everyone!

I’m new to this community and I’m working on a DICOM plugin for Fiji/ImageJ. I am not able to find however, how can I grab the data from an Image Sequence that the user opens in Fiji (DICOM images are usually a whole folder, so I have to grab all of them).

Thanks in advance!

1 Like

Hi @nicolasmart,

so you can “grab” the currently selected image / image stack by calling

ImagePlus imp = IJ.getImage();

Let us know if this helps. If not, it would be cool if you could show us some of your code so that we can give better hints :wink:


1 Like

Thanks for the extremely speedy answer! I’ll try to use it for a stack and see if it works.

1 Like

Welcome to the community, @nicolasmart!

Would you be able to elaborate a bit on your use case? Is your plugin specific to the DICOM file format, or can you rely on libraries such as #scifio and #bio-formats for reading of pixel data and metadata?

Does it have to be a (Java) plugin, or would a script (e.g. Jython or Groovy) do it as well? In my experience, a script is enough in most cases actually.

That’s the ImageJ1.x way of getting an image, yes. As @nicolasmart was specifically asking about an ImageJ 2.x plugin (see topic title), let me elaborate for completeness:

  • you can get the currently active image (or an image specified as input from calling code) by using #scijava parameters:

    import org.scijava.plugin.Parameter;
    import net.imagej.Dataset;
    private Dataset dataset;
  • if you need to load an image from file(s), you can use the DatasetIOService:

    private DatasetIOService datasetIOService;
    Dataset data =;

Hey there!

The plugin I am currently working on should be able to reconstruct 2D DICOM slices from a different angle.

Jython might work but I’m not sure how well it works with the different Python libraries, so I’ll have to read more on that.

The plugins you mentioned might work as well but I’m not sure whether it won’t make things even more complicated.

Thank you for the help and the kind advice!
It’s a real pleasure working in this forum!

Have a nice day!

What is specific about DICOM here? If you have an open (3D) stack in ImageJ, would you want something that generates 2D slices at arbitrary orientations? If so, we have that already:

1 Like

Oh, my, I never knew that plugin existed.
Thanks a lot!