Niftiinfo do not keep negative values
9 次查看(过去 30 天)
显示 更早的评论
When I'm importing nifti files using niftiinfo and niftiread, only the positive values from the metadata remains. The original files contain both positive and negative values. I have read the documentation and tried to change the cal_max and cal_min field, but this doesn't solve it.
Any ideas how to fix this? Are there any other functions to load niftifiles in matlab?
Thanks!
7 个评论
Walter Roberson
2023-6-17
cal_max and cal_min are used for mapping for display colors
Data scaling is different controls; see for example https://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields/nifti1fields_pages/scl_slopeinter.html
采纳的回答
Walter Roberson
2023-6-17
I stepped through the code that reads the image. The data as it is stored in the file has no negative values.
The only items that the code uses from the headers include:
- offset from beginning of file to data
- byte order
- image size
- image data type
The code does not perform any data scaling or any min() or max() or anything like that: the values you get from the reading function are what is stored in the file.
You yourself should probably be applying the MultiplicativeScaling: 2 and AdditiveOffset: -4096 -- that would get you values in the range -4096 to +4094
2 个评论
Walter Roberson
2023-6-17
ITK-SNAP and fsleyes are probably applying the scaling and offset; MATLAB is just returning the raw data.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Biomedical Imaging 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!