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
FIX:fieldmaps #565
FIX:fieldmaps #565
Conversation
That error suggests that the fieldmaps coming in are 16-bit integers. You're now applying a floating point multiplication, which should result in a floating point fmapdata. Creating the image with the original header will result in casting to Can you make sure that you're getting output files that are interpreted as floats? Maybe run |
Of course. Input to 'torads' from 'fmapmrg'
Input to 'tohz' from 'torads'
output from 'tohz'
I'm not getting floats out of most of these, so I should be changing the data-type of my fieldmaps before I submit them to fmriprep? |
when I change my fieldmap datatype to float before I pass it in to fmriprep the error doesn't occur. The int datatype may be due to how our fieldmaps are reconstructed from dicoms. The fieldmap and magnitude image are put into the same nifti file resulting in a 2 volume nifti. We split them (using fslroi) and then do processing from there. So instead of the commit I proposed, would it make more sense to do a datatype check, and if that fails print a warning and convert the image to float? Or is this too much of a niche case? I am unsure if my fieldmap being int type suggests a deeper problem with how I'm reconstructing my data and should be fixed beforehand. |
Sorry, I didn't mean to suggest that users need to coerce their inputs to amenable data types. I was wondering about what the consequences of getting out_img = nb.Nifti1Image(fmapdata, fmapnii.affine, fmapnii.header)
out_img.set_data_dtype('float32')
out_img.to_filename(out_file) It appears that you are getting output images that have So basically it's a question of whether we want to use the precision of the inputs. I lean toward setting the output type to float for consistency, but I'm open to arguments. |
As to whether your (pre-)preprocessing needs adjustment, that's hard for me to say. My working knowledge of fieldmaps does not extend to what units and datatypes to expect out of your DICOMs; perhaps @oesteban or @chrisfilo can speak more authoritatively, here. |
I agree with your assessment for consistency, I made the changes per your suggestion, but I just realized I need to wait for the fsl version to update for this to pass the tests :/ |
Looks reasonable. @oesteban? |
Yes, this is very reasonable. The preprocessing should be robust to the integer range of the image. Good catch! |
@jdkent what you mean by
|
Thanks! That's merged now :) |
Alright. Looks good. Thanks a lot! |
Wait a second. I think your original fix disappeared. We're back to |
Sorry! Nope it was still causing the error, added the original fix back in. |
Fixes #563