Saving BigDataViewer Sources into bigdataviewer hdf5

Hi BigDataViewer experts,

I’d like to know if there’s a way to export a multiresolution BigDataViewer bdv.viewer.Source<T> into a xml/hdf5 file format ? Or even better, a list of such sources.

I’ve seen this forum post : Saving RandomAccessibleInterval as bigdataviewer hdf5, and I wonder if there’s a way to extend it to the case of multiresolution RAI already present in a bdv Source.

Maybe such a function is already implemented somewhere in BigStitcher ?

Thanks!

Nico

@Christian_Tischer @bogovicj @tpietzsch @tibuch

3 Likes

I see, you do not want to compute the resolutions but use already existing ones. One way could be to modify the BasicSetupImgLoader by a MultiResolutionSetpImgLoader to not only provide the image at a certain timepoint but also at a certain resolution. At this place in the exporter:

You would also need to check where in the down-stream code this is actually called and change the call to also include the resolution level. But sounds like a bit of work. Maybe there is something already implemented.

3 Likes

It would be great to have this in bigdataviewer-core, but it doesn’t exist yet, as far as I know.

1 Like

Thanks for the response.

Small side question : Does the xml/hdf5 file format handle correctly 2D dataset ? Like from a slide scanner image ?

It always uses 3D stacks, but if you set the Z dimension = 1, I don’t see why it shouldn’t work.
I think BigStitcher already allows to define 2D datasets and also resave them to HDF5.

1 Like

I did that and it worked but you explicitly set the chunk size in Z to 1s during the conversion.

1 Like

I just notice that

 ProposeMipmaps.proposeMipmaps(
                            new BasicViewSetup(0, "", imageSize, voxelSize));

fails if one dimension of the image equals 1 (-> 2D) : an infinite while loop is going on. Otherwise yes it works nicely!

I’m almost done for the source(s) exporter, but finally I’m recomputing the pyramid, just as @Christian_Tischer does. Maybe some performance can be gained by reusing the scaled images provided by the Source, but one also has to assume that the pyramid has integer scaling factors, and that could be wrong in some cases.

I tried to trigger that, and with z dimension of the image = 1, it works fine.
I think the reason is probably that you had voxeldimension in z = 0.

1 Like