Help! How can I save an ArrayImg object into TIFF file?

Tags: #<Tag:0x00007fa30aaacd00> #<Tag:0x00007fa30aaacb20> #<Tag:0x00007fa30aaac9e0>


I have a net.imglib2.img.array.ArrayImg object of a 5-D image.

I’d like to save this image as a TIFF file via ImageJ2 API, but could not find a way to do it.

I realized that although; can open the image in ImageJ, that image cannot be reached from ImageJ GUI.

The closest I found is a static method

However,,"filename.tif")); did not work, and I’m wondering why.

Undefined variable "net" or class "net.imglib2.script.ImgLib". 

Because; works, the path should be accessible.

Any ideas?


Hi @kouichi-c-nakamura,

I’m surprised that what you tried gave that error, but I’m not familiar with the ImgLib class…

One way is to use ImageJFunctions (which you know about) to turn your ArrayImg into an ImagePlus and then use IJ in the ImageJ1 kind of way.

See here for some tricks and possible issues

If you’re using ImageJ2 Parameter annotations, then it’ll be something like

#@IOService ioService
... myArrayImgObject, "my file path")

or something like:

ij = new ImageJ() ...) 

Hope one of these is what you’re looking for,


Regarding net.imglib2.script.ImgLib it really isn’t distributed with Fiji, so that explains the error.
It is very old though, so better to stick with ImageJFunctions and the ImageJ2 stuff.

Now the mystery is why it’s in the javadoc… :confused:



Thank you for the very helpful comments. I’ll look into it.

This worked for me.

imp =


I agree, I also run into problems with a net.imglib2.script. class, not resolvable (at least with Fiji), but inside javadocs.