Open tashrifbillah opened 5 years ago
Unless I'm misunderstanding the question, pynrrd
should read the oldmin
, old min
, oldmax
, and old max
attributes as double
's. See the code here: https://github.com/mhe/pynrrd/blob/master/nrrd/reader.py#L89
As far as I can tell, they should be read correctly.
I see, so you left it up to the user to properly scale their data, right? However, NIBABEL scales it automatically before reporting.
Oh I understand! Are you wanting it scaled between 0.0f and 1.0f?
This is essentially what you need then?
(data - oldmin) / (oldmax - oldmin)
If so, do you think it's worthwhile to include that in the pynrrd
library or leave it up to the user?
@tashrifbillah ping. Am I on the right track? What are your thoughts on this?
Label: Follow Up Required
Assign: @tashrifbillah
I am organizing the issue in a better way. Let's keep it open, I shall follow up soon.
Are you wanting it scaled between 0.0f and 1.0f?
Negative, we don't want to normalize data, rather scale data properly taking into account oldmin
and
oldmax
.
So, how do we do that using math?
Given oldmin
, oldmax
, datatype
:
oldmin=(datatype_min)*scl_slope + scl_inter
oldmax= (datatype_max)*scl_slope + scl_inter
then, we should solve the above equations to find scl_slope
and scl_inter
. Then, the reported data should be:
scaled_data= raw_data*scl_slope+scl_inter
You can take a look at my issue on ITK where I justified reporting scaled data like NIBABEL and FSLview.
👍 I'm with you, all makes sense.
This should be doable from this library via the custom header fields options. Not sure this is worth being built-in functionality personally. If anything, we could add a helper function that users can utilize.
What are your thoughts?
Hello, do you know how to get the coronal plane, why can I just get the cross section?
@Chida15 , do you mind opening a separate issue on your question? This thread is for other issue we are trying to solve.
Nifti1 has scl_slope and scl_inter. The equivalent attributes in the Nrrd are oldmin and oldmax. However, we don't have support for oldmin and oldmax if they are present in intensity calibrated images (for relative intensity images, they are ignored), do we? If we don't have, then I am developing support for it.