BigDataViewer, smart way to use 2D images

Dear all, @tpietzsch, @NicoKiaru

when playing further with throwing different types of data into BDV, we (+@Christian_Tischer) came across the issue that 2D image data is currently not supported.

Our current workaround would be:

  • duplicate image into a two-slice z-Stack
  • abuse the pixelsize/AffineTransformation tags in the XML to inflate it in Z.

This obviously generates unnecessarily large H5 containers.
What would be a good/elegant way of getting 2D data into BDV to coexist with 3D+ datasets?


1 Like

Mixing 2D and 3D in BigDataViewer can work but I went into some troubles as well…

Could you share a minimal example of the problems you encountered ?



1 Like


Agree w/ @NicoKiaru that your approach should depend on the way in which you’re mixing 2d and 3d.


Quick aside on bdv 2d support

Just to be clear (and so you know about it, in case you don’t already), you can do this: <source>, BdvOptions.options().is2D() );

but it’s not what you need if mixing 2D and 3D.

I think Martin’s issue is not so much displaying the data once we have them but writing it in the first place. The UI in Fiji for saving images as in bdv format does not support saving 2D images, but says that the images should be “at least 3D”. Does one of you have Java code for writing 2D images as bdv? If so, maybe we could provide this as a patch to the code that is currently shipped with Fiji UI?

1 Like

You can create a “3D” image with Views.addDimension without increasing the memory demand. Something similar may work for ImageJ1 data structures, going from an ImageProcessor to an ImageStack, but I am not familiar enough with ImageJ1 to give a concrete example for that.

1 Like

@Christian_Tischer @schorb The “at least 3D” message was over-protective of the user. Actually the code supports writing 2D images. I’m removing the warning and releasing a new version of bigdataviewer_fiji


@Christian_Tischer @schorb

Actually, I’m not releasing it yet, because I don’t know whether this solves your problem.
Could you try with the latest snapshot
(replace the bigdataviewer_fiji-6.0.0.jar in your and tell me whether that is what you need?

Hi Tobias,

The export works. Opening the resulting 2D dataset in BDV works as well. What is still giving an error is “Open current image” when applied to a 2D image.

Thanks a lot,


@schorb Can you try again with
for plugins/bigdataviewer_fiji-....jar
and also
for jars/bigdataviewer-core-....jar

“Open current image” should be fixed now,
And also the initial transform is now set such that it should look correct immediately for 2D images.

Please let me know whether that works for you…


Hi Tobias,

thanks a lot. I have tested all scenarios and it works fine.


1 Like