Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

float32 image pixel values? #188

Open
manoaman opened this issue Dec 27, 2024 · 6 comments
Open

float32 image pixel values? #188

manoaman opened this issue Dec 27, 2024 · 6 comments

Comments

@manoaman
Copy link

manoaman commented Dec 27, 2024

Hi @william-silversmith ,

Does Igneous support float32 value images? I have images which takes pixel values in the range of 0.0 ~ 0.008 and they all came out black in Neuroglancer. And then I figured CloudVolume and Igneous might not support float32 datatype. Could this be the case? (Perhaps maybe just the shard format not supported?)

Thank you,
m

@william-silversmith
Copy link
Contributor

Hi m!

In theory floats should be supported. Were the data visually black only or did you also see the value zero when you hovered over places where there should be data? You might have to adjust the contrast in Neuroglancer for a floating point image.

Also check to see if the CloudVolume image is non-zero as well.

@manoaman
Copy link
Author

manoaman commented Jan 6, 2025

Hi Will,

Happy New Year! It did show up on the viewer with an adjusted contrast for float values. Luckily, the latest version of Neuroglancer had a friendly feature of picking up the optimal contrast values. Although, the image had to be processed without using a sharded format. That did give errors while processing. I ended up using without it.

-m

@william-silversmith
Copy link
Contributor

Interesting. I'll have to look into the sharded issue. I am considering doing some more imaging work on the sharded format soon so thank you for the tip!

@william-silversmith
Copy link
Contributor

Happy new year!!

@manoaman
Copy link
Author

Hi @william-silversmith , looks like float32 fails here. I did try if I can bypass here but the image results were distorted on two planes. I would have to think there might be more places fix.

  if isinstance(dtype, int):
    byte_width = dtype
  #elif isinstance(dtype, str) or np.issubdtype(dtype, np.integer):
  elif isinstance(dtype, str) or np.issubdtype(dtype, np.integer) or np.issubdtype(dtype, np.floating):
    byte_width = np.dtype(dtype).itemsize
  else:
    raise ValueError(f"{dtype} must be int, str, or np.integer.")

Also, dtype=np.int32 appears and ignores float32 in my info file in case if that's also related.

Volume Bounds:  Bbox([0, 0, 0],[1913, 1383, 749], dtype=np.int32, unit='vx')
Selected ROI:   Bbox([0, 0, 0],[1913, 1383, 749], dtype=np.int32, unit='vx')
Volume Bounds:  Bbox([0, 0, 0],[957, 692, 375], dtype=np.int32, unit='vx')
Selected ROI:   Bbox([0, 0, 0],[957, 692, 375], dtype=np.int32, unit='vx')
Volume Bounds:  Bbox([0, 0, 0],[479, 346, 188], dtype=np.int32, unit='vx')
Selected ROI:   Bbox([0, 0, 0],[479, 346, 188], dtype=np.int32, unit='vx')
Volume Bounds:  Bbox([0, 0, 0],[240, 173, 94], dtype=np.int32, unit='vx')
Selected ROI:   Bbox([0, 0, 0],[240, 173, 94], dtype=np.int32, unit='vx')

@william-silversmith
Copy link
Contributor

Hi m!

Sorry I haven't given this enough attention yet. Just been pretty busy. Thanks for finding at least part of the bug, I just pushed a fix to master. Despite that fix, I'm seeing a float32 sharded volume fail to render in neuroglancer so there's probably more to fix...

The bounding box int32s you are seeing are fine, the dtype controls the content of the image but not how the coordinate system works.

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

No branches or pull requests

2 participants