Q:Hi, I have a binary mask that I multiply with a volume and I am expecting that in the resultant image, everywhere that the mask was 0, the resulting image should be zero as well. Instead, it is some number close to zero but not necessarily 0.

I am not sure if this is a problem with how register/display display the values or with the data itself.

I used this command mincmath -mult mask.mnc volume.mnc out.mnc

(minccalc -expression “A[0]*A[1]” mask.mnc volume.mnc out.mnc doesn’t seem to work either).

The mask is a unisgned byte, real range 0 to 1, voxel range 0 to 255. The volume is a signed short. real range −91.323 to 1364.351, voxel range 0 to 4095.

I have tried changing the order of the multiplication, adding -double, -short, -int, -long, -byte, -unsigned, -signed to the mincmath command but nothing seems to work.

The data can be found here if you want to see for yourself. http://www.bic.mni.mcgill.ca/users/mishkin/files/

http://www.bic.mni.mcgill.ca/pipermail/minc-users/2008-March/001927.html

A: > Hi, > > I have a binary mask that I multiply with a volume and I am expecting > that in the resultant image, everywhere that the mask was 0, the > resulting image should be zero as well. Instead, it is some number > close to zero but not necessarily 0. > > I am not sure if this is a problem with how register/display display > the values or with the data itself.

I would take a bet that you are being bitten by a combination of both. Certainly register always rescales all values between 0 and 255 internally.

> I used this command > mincmath -mult mask.mnc volume.mnc out.mnc > > (minccalc -expression “A[0]*A[1]” mask.mnc volume.mnc out.mnc doesn’t > seem to work either). > > The mask is a unisgned byte, real range 0 to 1, voxel range 0 to 255. > The volume is a signed short. real range −91.323 to 1364.351, voxel > range 0 to 4095.

My first suggestion would be to use mincextract to determine the real values that are being produced in the resulting file and then if this is wrong start investigating further. ie: to get the value at voxel coord 0,0,0 (which i presume will/should be a “0”) do this:

  $ mincextract -start 0,0,0 -count 1,1,1 out.mnc

Then if this is working you can either rescale your output volume to force it to lie between 0 and 255 as a byte (so that register will display the result “correctly” or simply ignore the value from register! :)