An elegant Python interface for visualization on the web platform to interactively generate insights into multidimensional images, point sets, and geometry.
When attempting to view multiple images in separate cells in a Jupyter Notebook with itkwidgets.view, only the first region of interest for the first cell run is used in subsequent displays. Trying to view a larger image after viewing a smaller image will display the entirety of the expected bounds.
The viewer otherwise behaves as normal without warnings or error messages, which makes it seem visibly as if the entirety of the image contains less information than expected. This can critically impact quantitative pipeline evaluation.
Minimal Reproducible Example
import numpy as np
from itkwidgets import view
import itk
# Create a smaller and larger image with unit spacing
arr = np.zeros([364, 210], dtype=np.float32)
arr[:,:105] = 1
arr2 = np.zeros([1292,500], dtype=np.float32)
arr2[:646,:] = 1
image = itk.image_from_array(arr) # physical bounds are (0,0), (210,364)
image2 = itk.image_from_array(arr2) # physical bounds are (0,0), (500, 1292)
# View smaller image first in a dedicated cell
view(image)
# View larger image second in a dedicated cell
view(image2)
Size values are based on issue occurrence when viewing ITKMontage tile data input vs output:
Summary
When attempting to view multiple images in separate cells in a Jupyter Notebook with
itkwidgets.view
, only the first region of interest for the first cell run is used in subsequent displays. Trying to view a larger image after viewing a smaller image will display the entirety of the expected bounds.The viewer otherwise behaves as normal without warnings or error messages, which makes it seem visibly as if the entirety of the image contains less information than expected. This can critically impact quantitative pipeline evaluation.
Minimal Reproducible Example
Size values are based on issue occurrence when viewing ITKMontage tile data input vs output:
https://github.com/InsightSoftwareConsortium/ITKMontage/tree/master/examples/SampleData_CMUrun2
https://github.com/InsightSoftwareConsortium/ITKMontage/blob/master/examples/SimpleMontage.py
Expected Result
The full extent of both images are visible in respective notebook cells.
image2
(expected):Observed Result
image
is fully visible butimage2
is visible only on the approximate extent (0,0), (210, 364).image2
(observed):Platforms / Versions
itkwidgets 0.32.6 itk 5.3.0 ipywidgets 7.7.2 ipydatawidgets 4.3.2 notebook 6.1.6
Windows 10 Python 3.8.5
Additional Notes
cc @thewtex @PaulHax