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
576 stars 83 forks source link

Roi #703

Closed bnmajor closed 8 months ago

bnmajor commented 9 months ago

Depends on Kitware/itk-vtk-viewer#724 and #702

thewtex commented 8 months ago

loving it!

review-notebook-app[bot] commented 8 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

bnmajor commented 8 months ago

@thewtex @PaulHax A new example notebook has been added but if there is better data to use (maybe a large dataset that is typically stuck to a lower scale?) I'd be happy to update with a different example. This data was more or less selected at random.

thewtex commented 8 months ago

@bnmajor awesome job!

A few requests inline.

This is a good dataset, but another to consider is:

https://data.kitware.com/#item/63476e0911dab81428208e27

for more scales / variety.

thewtex commented 8 months ago

@bnmajor awesome job!

A few requests inline.

This is a good dataset, but another to consider is:

https://data.kitware.com/#item/63476e0911dab81428208e27

for more scales / variety.

thewtex commented 8 months ago

Awesome!

bnmajor commented 8 months ago

@thewtex Two last items:

thewtex commented 8 months ago

@bnmajor what is your ngff_zarr.__version__?

thewtex commented 8 months ago

Checking this branch out locally, I could not reproduce with ngff-Zarr 0.6.0.

bnmajor commented 8 months ago

Checking this branch out locally, I could not reproduce with ngff-Zarr 0.6.0.

I was on 0.4.7... Sorry about that!

EDIT: Actually, still seeing it with 0.6.0...

thewtex commented 8 months ago

I seem to recall an older version of itk-vtk-viewer causing this behavior -- is it possible that an old version is used locally?

thewtex commented 8 months ago

I tried again with a fresh conda environment and repository checkout, the spacing was correct and consistent across scales.

bnmajor commented 8 months ago

I'm not using a local instance of the itk-vtk-viewer and we're currently using the latest release... skewed_lower_scale

thewtex commented 8 months ago

Oh, I was just looking and viewer1 -- I do see that with viewer2 :-)

thewtex commented 8 months ago

roi = multiscales.images[loaded_scale].data[roi_slices]

This is extracting only the array and discarding the metadata.

thewtex commented 8 months ago

image

with:

# Create a new viewer using only the data in the ROI determined above
loaded_image = multiscales.images[loaded_scale]
roi_data = loaded_image.data[roi_slices]

from ngff_zarr import to_ngff_image

roi_image = to_ngff_image(roi_data, dims=loaded_image.dims, scale=loaded_image.scale, translation={'x': roi_region[0][0], 'y': roi_region[0][1], 'z': roi_region[0][2]})

from ngff_zarr import to_ngff_image
  1. update the notebook according to the above.
  2. could you please update get_roi_region to output a list of dictionaries, 'x', 'y', etc.

?

bnmajor commented 8 months ago
  1. update the notebook according to the above.
  2. could you please update get_roi_region to output a list of dictionaries, 'x', 'y', etc.

?

Updates have been pushed, thank you

thewtex commented 8 months ago

Sorry, I was not too clear -- I will push a patch with a minor tweak.

bnmajor commented 8 months ago

Sorry, I was not too clear -- I will push a patch with a minor tweak.

I see, sorry about my misunderstanding! Thanks for the fix!

bnmajor commented 8 months ago

@thewtex This is good to go from my end if everything is looking good for you as well