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

mincreshape modifies image-min when changing type #119

Open
bbbxyz opened this issue Feb 8, 2022 · 1 comment
Open

mincreshape modifies image-min when changing type #119

bbbxyz opened this issue Feb 8, 2022 · 1 comment

Comments

@bbbxyz
Copy link

bbbxyz commented Feb 8, 2022

Hello,

I've encountered some odd behaviour with mincreshape:

# Create a phantom with 0's and 1's
$ make_phantom phantom.mnc
# Set its range to 5-10 and fill 
$ mincreshape -fillvalue 5 -valid_range 5 10 -image_range 5 10 phantom.mnc phantom_5_10.mnc 

This works as expected and creates a volume filled with 5's with an image-min of 5

# Change the type to any integer type (byte here)
$ mincreshape -byte phantom_5_10.mnc phantom_byte.mnc
# image-min is now zero and volume is now filled with zeros
$ mincstats -min -max phantom_byte.mnc 
*** mincstats - reported max (0) doesn't equal header (10)
Min:               0
Max:               0
$ mincinfo -varvalue image-min phantom_byte.mnc 
0
0
[...]
0

Is this expected?

@vfonov
Copy link
Member

vfonov commented Feb 9, 2022

make_phantom phantom.mnc - makes a volume with values between 0 and 1
mincreshape -fillvalue 5 -valid_range 5 10 -image_range 5 10 phantom.mnc phantom_5_10.mnc creates a volume filled with NaN's , because all values are outside of image range.
mincreshape -byte phantom_5_10.mnc phantom_byte.mnc tries to convert NaN values to bytes, replaces them with 0 (pixfillvalue)

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

No branches or pull requests

2 participants