mobie / mobie-viewer-fiji

BSD 2-Clause "Simplified" License
29 stars 12 forks source link

Add 3D image to 2D dataset in Fiji project creator #1119

Closed tischi closed 2 months ago

tischi commented 3 months ago

Hi @K-Meech,

in the new-n5 branch there is now a method: ImagesCreator.addOMEZarrImage

Inside there is:

        if ( ! is2D( imageData ) && projectCreator.getDataset( datasetName ).is2D() ) {
            // FIXME: why not? Can't we change the project to be 3D
            throw new UnsupportedOperationException("Can't add a 3D image to a 2D dataset" );
        }

Could you please comment on this?

K-Meech commented 3 months ago

I think this was to prevent people accidentally adding 3D images to a 2D project (+ changing bdv to display with 3D controls rather than locked to 2D). I'd need to look into it more to be sure - but I don't have time right now.

K-Meech commented 2 months ago

I looked into this some more. So it is possible to add a 3D image into a 2D dataset via the project creator - it will pop up a dialog to warn about changing the dimension, then go ahead and do that if you accept. If you want to do it via a script, you would directly call projectsCreator.getDatasetsCreator().makeDataset2D( datasetName, false ); then add the image.

So the check you linked above prevents you from accidentally adding a 3D image to a 2D dataset, but doesn't prevent you from doing so if you explicitly change the dataset from 2D to 3D.

tischi commented 2 months ago

Sounds great! So we can close the issue?!

K-Meech commented 2 months ago

Yes! All good from my side