Retrieve info on current itkwidget.view window bounds - following zoom

As point selection in itkwidgets.view is not currently possible (Geometry / Point selection · Issue #575 · Kitware/itk-vtk-viewer · GitHub) is there a way to get the visual bounds of the viewer? i.e. if we create a view as shown below, and then zoom in on a particular region, is there any way to retrieve the x/y/z ranges of the current view window?

something like bounds = v.camera.GetBounds()?

import numpy as np
from itkwidgets import view

number_of_points = 3000
gaussian_mean = [0.0, 0.0]
gaussian_cov = [[1.0, 0.0], [0.0, 2.0]]
point_set = np.random.multivariate_normal(gaussian_mean, gaussian_cov, number_of_points)

v = view(point_sets=point_set)
v

@matt.mccormick and @PaulHax might answer.

That feature is not there, but we are close. itk-vtk-viewer is already exposing the “cropping planes” (the manual user controlled planes activated by a button in the UI)

I think we just need to wrap the function call to getCroppingPlanes in itkwidgets

Thanks @PaulHax. Is this something i could easily patch locally or would i be better off waiting for it to be included in some future release?

I don’t know how to patch locally. To get this in a release this is what a smarter someone says is needed to expose the “get” functions on Viewer:

We need to await the getter calls (calling the ImJoy wrapped functions returns a coroutine), and because of the “single threaded” nature of the notebook what happens is a cell can make the call and await it but it gets stuck and never returns. At this point it seems that we may need to take advantage of the background thread that we are using for the setters, but then that introduces additional complications (by running in the background the cells continue to progress after they’re called even if they haven’t returned, so we need to make sure returned values are returned to correct cell).

A little coding challenge there…

1 Like