Skip to content

Conversation

@Carifio24
Copy link
Member

This PR updates the volume viewer to allow showing 3D slices of 4+ dimensional data, similar to how the image viewer can show 2D slices of 3+ dimensional data. In fact, the approach here is very much based on what the image viewer does. Below is a video of this in action.

Screen.Recording.2025-06-14.at.5.mp4

I built this on top of #396 to make sure that it was compatible, so that PR should be merged before this one. There are a couple of issues to maybe discuss/address here:

  • The slice widget implementation is taken almost directly from the glue-qt image viewer. The main difference is really that we have to account for the presence of z_att in the 3D viewer. Maybe we should make this a getattr-style check in the glue-qt widget and then import that here?
  • There is a weird issue where changing color or alpha in the layer state will cause the viewer to think that its layers have changed and then reset the reference data. This is present in the current main branch as well, but doesn't seem to cause a problem there. However, I had to work around it here to prevent color/opacity changes from resetting slice indices.

The test data in the video is something simple that I made in the glue terminal as follows:

from glue.core import Data
import numpy as np
sz = 10
arr = np.zeros((sz, sz, sz, sz))
for i in range(sz):
    for j in range(sz):
        arr[i,j,:,i] = i+j
data = Data(x=arr, label="Test Data")
dc.append(data)

@Carifio24 Carifio24 marked this pull request as ready for review June 26, 2025 05:41
@Carifio24
Copy link
Member Author

This now depends on glue-viz/glue-qt#46.

@astrofrog
Copy link
Member

Very nice! Works great for me. Ping me once #396 is merged and this has been rebased and I'll do a careful review.

@Carifio24
Copy link
Member Author

@astrofrog Just rebased this. I've also added in the slice slider widgets to the Jupyter volume viewer (again following the example of the image viewer).

@Carifio24
Copy link
Member Author

@astrofrog Now that glue-qt 0.4 has been released, I think this is ready to review.

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you for working on this!

@astrofrog astrofrog merged commit b394db6 into glue-viz:main Sep 5, 2025
46 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants