imglib / imglib2-ij

Translation between ImgLib & ImageJ data structures (both 1.x and 2)
Other
4 stars 8 forks source link

Fix converting back and forth between VirtualStack and PlanarImg #34

Closed maarzt closed 1 year ago

maarzt commented 1 year ago

Fixes this bug: https://forum.image.sc/t/plugin-maintainers-can-you-test-fiji-2-11-0/78852/7

The current implementation of PlanarImgToVirtualStack.wrap(...) would fail to convert an ImgPlus<?> that was returned by ImgPlus<?> img = VirtualStackAdapter.wrap( imagePlus );

Instead of correctly converting the image, the following line of code throws an UnsupportedOperationException:

PlanarImgToVirtualStack.wrap( VirtualStackAdapter.wrap( imagePlus ) )

This commit fixes this UnsupportedOperationExcpetion. The exception is simply is catched inside PlanarImgToVirtualStack.wrap( img ).setPixels(...). (more specifically inside the setPixelsZeroBasedIndex(...) method) This makes the PlanarImgToVirtualStack behave similar to the vanilla VirtualStack, which simply has an empty setPixels method.

hinerm commented 1 year ago

Thanks so much @maarzt!