InsightSoftwareConsortium / itkwidgets

An elegant Python interface for visualization on the web platform to interactively generate insights into multidimensional images, point sets, and geometry.
https://itkwidgets.readthedocs.io/
Apache License 2.0
579 stars 83 forks source link

Improper intermediate downscale spacing #655

Closed tbirdso closed 1 year ago

tbirdso commented 1 year ago

Overview

Observed an issue where itkwidgets.view(image) with three levels shows incorrect spacing for Level 1, while Level 0 and Level 2 appear correctly.

Level 0 (original image)

scale0

Level 1 (improper scale, pancake image)

scale1

Level 2 (apparently correct scale, lowest resolution)

scale2

Versions

itkwidgets[all]==1.0a32 itk==v5.3.0

Steps to Reproduce

3D image file: https://drive.google.com/file/d/1rKB7a65EIPvtNYclea1C7cvOhGhbCG_0/view?usp=share_link

itkwidgets.view(image)

Additional Notes

Unclear whether the image itself is downsampled with the wrong spacing or if the issue is limited to viewing. The fact that the subsequent level is correctly scaled seems to imply a viewing issue?

cc @thewtex @PaulHax

tbirdso commented 1 year ago

Note that this behavior appeared to be visible in ngff-zarr in Exercise 1(?) during the GYBT multiscale tutorial:

https://github.com/InsightSoftwareConsortium/GetYourBrainTogether/blob/main/HCK02_2023_Allen_Institute_Hybrid/Tutorials/LargeScaleRegistration/Multiscale_Spatial_Metadata_and_Distributed_Processing.ipynb

EDIT: Behavior may have been due to the size of the matplotlib pyplot view rather than improper image size in space. May be worth investigating to confirm.

tbirdso commented 1 year ago

I was able to recreate the issue in neuroglancer, it appears that the origin is in ngff-zarr rather than itkwidgets. I have cross-posted the issue there with neuroglancer details: https://github.com/thewtex/ngff-zarr/issues/33