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

oldmin and oldmax support #83

Open
tashrifbillah opened this issue Mar 4, 2019 · 9 comments
Open

oldmin and oldmax support #83

tashrifbillah opened this issue Mar 4, 2019 · 9 comments
Assignees

Comments

@tashrifbillah
Copy link
Contributor

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.

@addisonElliott
Copy link
Collaborator

addisonElliott commented Mar 4, 2019

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.

@tashrifbillah
Copy link
Contributor Author

I see, so you left it up to the user to properly scale their data, right? However, NIBABEL scales it automatically before reporting.

@addisonElliott
Copy link
Collaborator

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?

@addisonElliott
Copy link
Collaborator

@tashrifbillah ping. Am I on the right track? What are your thoughts on this?

@tashrifbillah
Copy link
Contributor Author

tashrifbillah commented Mar 7, 2019

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.

@tashrifbillah
Copy link
Contributor Author

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.

@addisonElliott
Copy link
Collaborator

👍 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?

@Chida15
Copy link

Chida15 commented May 13, 2019

Hello, do you know how to get the coronal plane, why can I just get the cross section?

@tashrifbillah
Copy link
Contributor Author

@Chida15 , do you mind opening a separate issue on your question? This thread is for other issue we are trying to solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants