-
Notifications
You must be signed in to change notification settings - Fork 11
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
f32 images #1
Comments
Hello! Thank you for reporting. It's true that f32 volumes should be supported, they're pretty common. Can you provide the code that you tried? I might look into this at some point. |
I created a test image with this python code
And I tried to load it with
The header and dimension are right but the data is wrong. |
I checked
Do you already know what's missing/broken in the code for f32 images? I'm totally not a Rust expert but I would prefer fixing your lib than coding my own! |
Thanks for the MCVE, I certainly wish to fix this, and I believe I have a clue of what's wrong. |
All right, I just pushed some neat changes to the master branch, tests included. This latest version also allows you to convert f32 volumes to an ndarray, although it always requires a full copy right now. @nilgoyette Would you like to try it out? There should be no breaking changes from 0.1.0. nifti = { git = "https://github.com/Enet4/nifti-rs" } |
Whoah, thank you for working on this so fast. I'll test your branch today. |
GJ, it's working with an
|
@nilgoyette Oops, that was all me. I forgot to remove an old check for the data type. The fix is in the master branch now, can you try again? |
It's compiling and there's no panic... but there's only 0.0 everywhere. You might want to add a "values test" like you did in tests/volumes.rs :) I load an non-blank image (same as before) and the ndarray is always returning 0.0:
|
You are right, I should indeed make a few more tests. I'll get back to this (and hopefully make a new release) in a few hours. In the mean time, can you check whether using the volume API directly works as intended? |
Yes, what I meant in my last message by "GJ, it's working with an InMemNiftiVolume" was that the values are ok. I even tested with a real brain image and I think it's right. In fact, I'm testing with
Probably a LPS/RAS "problem". In fact, it's not actually a problem, I just want you to know. Does nifti-rs revert the directions or simply ignore them? |
You are correct, orientation information stated in the header file is currently ignored (that could earn a separate issue here). Thank you for the checks, I'll try to release 0.2.0 tonight. |
@nilgoyette Just to let you know that the bug has been fixed, and I will throw in a new release soon-ish. Update: It's in. |
Sorry, I never saw your update. I'm testing with f32 images and everything seems right. I'll update this issue if I found anything. I have a question though. The In fact, my goal is to write something like:
|
Good point. I have used a dynamic shape because this one is sure to work for volumes of any dimensionality. Right now, one can use
On the other hand, there sure may be room for improvements in this API, and integrating a second type parameter for the dimension type might indeed work. Let's make this a separate issue. :) |
Hi, thank you for working on this. It's the only nifti loader in rust! I tried using it to test an image denoising algo but it's not possible to load a f32 image. I know it's only a side project for you and I won't be waiting for a fix.
I tried with the simple
InMemNiftiObject
and by creating aNiftiHeader
with the right values. Both give really sparse data. A whole lot of zeros with some random floats.The text was updated successfully, but these errors were encountered: