GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add `ImageVolumeGraphic` by kushalkolar · Pull Request #791 · fastplotlib/fastplotlib

Conversation

@kushalkolar

@kushalkolar kushalkolar commented Apr 12, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

actually going to merge it this time

  • TextureArrays supports 3D textures
  • implement simple ImageVolumeGraphic
  • implement graphic features for all the different volume materials
  • check and document sharing the data buffer between an object that uses mip/ray material and another object that uses slice material.
  • examples
    • basic for all material types
    • 3D video, maybe generated calcium toy data?
    • multi channel zarr
  • make hlut tool work with this, account for the dims so that the cmap bar shows up
  • make this work with ImageWidget, image widget is a mess, need to refactor iw before adding volume support
  • tests: screenshots, API, new graphic, TextureArray for 2d and 3d, and any new graphic features.
  • test multi-channel
  • fix some typos in graphics.image
  • scripts/generate_add_graphic_methods.py is better, removed Graphic.type attribute which was only used in the generate mixin script and use regex instead to create the add_<graphic> method names.
  • improve docstring for quick_min_max()

@almarklein are RGB volumes supported? Is it even a thing?

selector tools for slicing, cube slicing, etc., non-orthogonal slicing to come later

note: implementing ImageVolumeGraphic as a subclass of ImageGraphic wasn't a good idea because the __init__ gets messy. Might make a BaseImageGraphic class which just has properties which are almost identical between ImageGraphic and ImageVolumeGraphic, but not a big deal right now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kushalkolar
add volume graphic, basic stuff works
2eeea6e
@kushalkolar
kushalkolar requested a review from clewis7 as a code owner April 12, 2025 06:20
@kushalkolar kushalkolar mentioned this pull request Apr 12, 2025
basic image volume #401
Closed
kushalkolar added 2 commits April 12, 2025 02:21
@kushalkolar
remove a useless file I accidentally added
874cd3c
@kushalkolar
black
b2b9b10
@kushalkolar
kushalkolar force-pushed the volume-image branch from ce9c197 to b2b9b10 Compare April 12, 2025 06:30
@kushalkolar
add volume movie
6feec31
@kushalkolar

kushalkolar commented Apr 12, 2025

Copy link
Copy Markdown
Member Author

took some 3d movie gen code from caiman to generate a 3d movie:

@FlynnOConnell

3d-2025-04-12_03.09.08.mp4
ivoflipse and FlynnOConnell reacted with heart emoji
All reactions
  • ❤️ 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@FlynnOConnell

FlynnOConnell commented Apr 12, 2025

Copy link
Copy Markdown
Collaborator
File [~\repos\fastplotlib\fastplotlib\graphics\features\_image.py:147](http://localhost:8888/lab/tree/demos/notebooks/~/repos/fastplotlib/fastplotlib/graphics/features/_image.py#line=146), in TextureArray._fix_data(self, data)
    145 def _fix_data(self, data):
    146     if data.ndim not in (2, 3):
--> 147         raise ValueError(
    148             "image data must be 2D with or without an RGB(A) dimension, i.e. "
    149             "it must be of shape [rows, cols], [rows, cols, 3] or [rows, cols, 4]"
    150         )
    152     # let's just cast to float32 always
    153     return data.astype(np.float32)

ValueError: image data must be 2D with or without an RGB(A) dimension, i.e. it must be of shape [rows, cols], [rows, cols, 3] or [rows, cols, 4]
data = np.random.randn(50, 2, 448, 448)
data.shape
>> (50, 2, 448, 448)

The ability to view a time-series with a 4th dimension would be nice here

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@FlynnOConnell

FlynnOConnell commented Apr 12, 2025

Copy link
Copy Markdown
Collaborator

Also how difficult is something like scale=[1, 4, 1] to account for anisotropy in XY and Z? Here I have a volume of [14, 448, 448] ZXY, but from the side its a flat plane. This dataset is [2um x 2um x 17um]

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@FlynnOConnell

FlynnOConnell commented Apr 12, 2025

Copy link
Copy Markdown
Collaborator

Also how difficult is something like scale=[1, 4, 1] to account for anisotropy in XY and Z? Here I have a volume of [14, 448, 448] ZXY, but from the side its a flat plane. This dataset is [2um x 2um x 17um]

image

nevermind :)

volume.world_object.world.scale_z = 15.0

Some other helpful tidbits:

hlut = fpl.HistogramLUTTool(volume.data.value, volume)
volume.interpolation = "linear"
volume.cmap = "gnuplot2"

fig[0, 0].docks["right"].add_graphic(hlut)
fig[0, 0].docks["right"].size = 80
fig[0, 0].docks["right"].controller.enabled = False
fig[0, 0].docks["right"].camera.maintain_aspect = False
fig[0, 0].docks["right"].auto_scale(maintain_aspect=False)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar
linear interpolation is better
ac76f6a
@almarklein

almarklein commented Apr 15, 2025

Copy link
Copy Markdown
Collaborator

@almarklein are RGB volumes supported? Is it even a thing?

Yes, looks like it is; it uses the same logic (in the shader) as the image. I have never encountered it in the wild though.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar kushalkolar mentioned this pull request Apr 17, 2025
Roadmap 2026 #55
Open
54 of 78 tasks
@kushalkolar
merge conflict
1e61b64
@kushalkolar
kushalkolar marked this pull request as draft June 4, 2025 04:58
kushalkolar added 3 commits June 4, 2025 01:10
@kushalkolar
cmap shown for volume image in hlut tooL
4e616bb
@kushalkolar
volume render modes work
1ed2794
@kushalkolar
example works
b0f26ff
@kushalkolar

kushalkolar commented Jun 4, 2025

Copy link
Copy Markdown
Member Author

ok all the basics are down, switchable materials, can change material props:

vol-2025-06-04_03.34.28.mp4

Need to figure out why regex is turning VolumeSliceMaterial into slic instead of slice

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Jun 4, 2025

Copy link
Copy Markdown
Member Author

In other news, the latest pycharm is full of bugs, wtf is this. Also it wanted to auto insert the old rst structured docstring template even though I configured it to do numpydoc format 🤮

image

FlynnOConnell and apasarkar reacted with laugh emoji
All reactions
  • 😄 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar added 5 commits June 5, 2025 00:51
@kushalkolar
some updates to ImageGraphic for sharing buffesr
9d059c7
@kushalkolar
update volume and add examples
d27cd31
@kushalkolar
update example
98a09f7
@kushalkolar
update add_graphics mixin
61be715
@kushalkolar
bah
b6e29cd
@kushalkolar

kushalkolar commented Jun 5, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

All that's left is tests, 2D over time example, and RGB(A) examples. I also think I want to merge #849 and then rebase this so the examples will be much simpler.

Also pygfx has non-orthogonal slicing:

vol_slicing-2025-06-05_00.53.40.mp4
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Jun 5, 2025

Copy link
Copy Markdown
Member Author

ok there's a bug in the TextureArray or tiling somewhere, because when a dim is greater than the limit it is tiling along the wrong dim 😆

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Jun 6, 2025

Copy link
Copy Markdown
Member Author

The rendering at the edges is weird if one of the dims is larger than the 3d texture size limit so let's just not support this, I think the uses are very much rare edge cases. Also if the 3d texture size limit is 16,383, then 16384x16384x16384 with float32 is 17 TB which is more than any GPU that I know of can handle 😂 .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar
separate TextureArrayVolume for volumes, fix indexing for tiling volumes
36d5abb
kushalkolar added 7 commits September 28, 2025 05:15
@kushalkolar
fix
25562b6
@kushalkolar
upate example
7bac111
@kushalkolar
better way to detect images
26dfd05
@kushalkolar
texture array for volume image is 3D
599c6dd
@kushalkolar
fix test
e9b7db9
@kushalkolar
rename to figure so pygfx gallery scraper picks it up
8698c3e
@kushalkolar
allow longer time for actions, I guess volumes take a while
e23bf44
@github-actions

github-actions Bot commented Sep 28, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

📚 Docs preview built and uploaded! https://www.fastplotlib.org/ver/volume-image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar added 6 commits September 28, 2025 07:05
@kushalkolar
rename
5095612
@kushalkolar
update screenshots
c2f2923
@kushalkolar
for some reason using black via python gives different results than b…
0566f1b
…lack on commandline
@kushalkolar
add ImageVolume api docs
5de4a23
@kushalkolar
replace image_widget_grid yet again...
9b57677
@kushalkolar
forgot to commit event tables diff
78b4e96
@kushalkolar

kushalkolar commented Sep 28, 2025

Copy link
Copy Markdown
Member Author

More tests for the TextureArray for volumes would be nice, but can do that later. I think tiling of volume is a rare edge case so if there is a bug it will affect very rare usecases not already covered by the tests.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

clewis7
clewis7 requested changes Sep 29, 2025
View reviewed changes

@clewis7 clewis7 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Just some small comments, otherwise looks good to me

Very cool stuff!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread examples/image_volume/image_volume_mip.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/features/_volume.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/features/_volume.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/image_volume.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar added 7 commits September 30, 2025 03:16
@kushalkolar
hlut tool can manage multiple ImageGraphics or ImageVolumeGraphics
616a223
@kushalkolar
remove property that's no longer part of the API
c8e44f6
@kushalkolar
docs
e9c9a7a
@kushalkolar
docstring fix
39344c3
@kushalkolar
better text on hlut
dbe5056
@kushalkolar
black
8ff0f7d
@kushalkolar
update api docs
d92b24a
@FlynnOConnell

FlynnOConnell commented Sep 30, 2025

Copy link
Copy Markdown
Collaborator

Amazing! @kushalkolar I'll test this out!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar added 2 commits September 30, 2025 23:57
@kushalkolar
update CI timeouts because of new downloaded volume image
201532a
@kushalkolar
update screenshots because hlut line is more gray
ce4570b
@kushalkolar

kushalkolar commented Oct 1, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@clewis7 gtg! 🥳 and then we can merge #904 once I make new ground truth screenshots for that and then #883

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

clewis7
clewis7 approved these changes Oct 1, 2025
View reviewed changes
@clewis7
clewis7 merged commit 5a9b829 into main Oct 1, 2025
@clewis7
clewis7 deleted the volume-image branch October 1, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@clewis7 clewis7 clewis7 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@kushalkolar @FlynnOConnell @almarklein @clewis7
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.