BIC-MNI / Display

MNI Display project, converted from CVS
Other
8 stars 4 forks source link

Display develop HEAD reports wrong value for voxel under cursor #65

Open gdevenyi opened 8 years ago

gdevenyi commented 8 years ago

I'm writing some code using nibabel to lookup voxel values from minc files, so I was using Display to look at the value under the cursor to compare (since I know both the world and voxel coodinates thanks to recent Display improvements).

I found consistent difference between my nibabel output and Display. After much testing, I have confirmed it's not my nibabel code as register reports the correct value.

Screenshots: Display: voxel [96,114,96] image

Register: voxel [96,114,96] image

Nibabel:

import nibabel as nb
img_y = nb.load("y.mnc")
print(img_y.get_data()[96,114,96])
2.59016
rdvincent commented 8 years ago

ok, is there anything unusual about that file (e.g. what is the voxel type)? Also, do you know if you have Convert_volumes_to_byte set to FALSE?

gdevenyi commented 8 years ago

The mincheader of the file:

hdf5 y {
dimensions:
    xspace = 193 ;
    yspace = 229 ;
    zspace = 193 ;
variables:
    float image(zspace, yspace, xspace) ;
        image:varid = "MINC standard variable" ;
        image:vartype = "group________" ;
        image:version = "MINC Version    2.0" ;
        image:dimorder = "zspace,yspace,xspace" ;
        image:valid_range = -12.0096292495728, 11.6458549499512 ;
    double image-min ;
        image-min:varid = "MINC standard variable" ;
        image-min:vartype = "group________" ;
        image-min:version = "MINC Version    2.0" ;
    double image-max ;
        image-max:varid = "MINC standard variable" ;
        image-max:vartype = "group________" ;
        image-max:version = "MINC Version    2.0" ;
    double xspace ;
        xspace:version = "MINC Version    2.0" ;
        xspace:width = 1. ;
        xspace:vartype = "group________" ;
        xspace:start = -96. ;
        xspace:spacing = "regular__" ;
        xspace:alignment = "centre" ;
        xspace:direction_cosines = 1., 0., 0. ;
        xspace:class = "spatial" ;
        xspace:comments = "X increases from patient left to right" ;
        xspace:units = "mm" ;
        xspace:varid = "MINC standard variable" ;
        xspace:length = 193 ;
        xspace:step = 1. ;
    double yspace ;
        yspace:version = "MINC Version    2.0" ;
        yspace:width = 1. ;
        yspace:vartype = "group________" ;
        yspace:start = -132. ;
        yspace:spacing = "regular__" ;
        yspace:alignment = "centre" ;
        yspace:direction_cosines = 0., 1., 0. ;
        yspace:class = "spatial" ;
        yspace:comments = "Y increases from patient posterior to anterior" ;
        yspace:units = "mm" ;
        yspace:varid = "MINC standard variable" ;
        yspace:length = 229 ;
        yspace:step = 1. ;
    double zspace ;
        zspace:version = "MINC Version    2.0" ;
        zspace:width = 1. ;
        zspace:vartype = "group________" ;
        zspace:start = -78. ;
        zspace:spacing = "regular__" ;
        zspace:alignment = "centre" ;
        zspace:direction_cosines = 0., 0., 1. ;
        zspace:class = "spatial" ;
        zspace:comments = "Z increases from patient inferior to superior" ;
        zspace:units = "mm" ;
        zspace:varid = "MINC standard variable" ;
        zspace:length = 193 ;
        zspace:step = 1. ;

// global attributes:
        :ident = "devgab:cicws24:2016.08.31.14.28.28:16362:1" ;
        :class = "real___" ;
        :minc_version = "2.4.01" ;
data:

 image-min = -12.0096292495728 ;

 image-max = 11.6458549499512 ;

 xspace = 0 ;

 yspace = 0 ;

 zspace = 0 ;
}

and mincinfo:

file: y.mnc
image: signed__ float -12.009629249572753906 to 11.645854949951171875
image dimensions: zspace yspace xspace
    dimension name         length         step        start
    --------------         ------         ----        -----
    zspace                    193            1          -78
    yspace                    229            1         -132
    xspace                    193            1          -96

I don't have a Display.globals anywhere where the manual says it could be, so I have whatever the code default is for that setting (I think).

Can I check somehow?

rdvincent commented 8 years ago

The default value for that variable is unfortunately still TRUE. Try running Display with

Display -global Convert_volumes_to_byte false y.mnc
gdevenyi commented 8 years ago

That fixes it.

gdevenyi commented 8 years ago

So, I guess I can switch that in a ~/.mni-displayrc for myself.

Maybe that default should make it into the codebase?

rdvincent commented 8 years ago

@gdevenyi I had been planning to make it the default. Will do that today.

zijdenbos commented 8 years ago

Out of curiosity - since register reported the correct value, I assume this means that it does not convert_volumes_to_byte anymore, either?

On Thu, Sep 1, 2016 at 8:52 AM, Robert D Vincent notifications@github.com wrote:

@gdevenyi https://github.com/gdevenyi I had been planning to make it the default. Will do that today.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BIC-MNI/Display/issues/65#issuecomment-244069067, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_r-Iz1hEVW4MsuTqHEwvgbvyE_m0-Zks5qlsqdgaJpZM4JyAPi .

rdvincent commented 8 years ago

@zijdenbos Correct. The default was changed in Register a long time ago - I just changed it in Display today.

rdvincent commented 8 years ago

@zijdenbos Byte volumes are so 1996.

zijdenbos commented 8 years ago

That's only 20 years ago :)

On Thu, Sep 1, 2016 at 11:46 AM, Robert D Vincent notifications@github.com wrote:

@zijdenbos https://github.com/zijdenbos Byte volumes are so 1996.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BIC-MNI/Display/issues/65#issuecomment-244122196, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_r-H_jS5M7yhIdg71qN4kWLqWPMr3Tks5qlvNXgaJpZM4JyAPi .