[MINC-development] -labels support in minccalc, mincmath and mincresample

Robert D. Vincent robert.d.vincent at mcgill.ca
Fri Mar 4 07:03:13 EST 2016


Hi Vlad,

Thanks for tackling this - it's long overdue. Regarding Andrew's comments,
I'll look into adding support for the long-neglected "class" field we
defined for MINC 2 files - it was supposed to help solve this problem, by
marking label files as one of "real", "integer", "label", etc.

   -bert

On Thu, Mar 3, 2016 at 7:45 PM, Andrew Janke <a.janke at gmail.com> wrote:

> ace stuff.
>
> I like it a lot.  any chance we can introduce a label header tag somewhere
> so that this happens by default for label files?
>
> I can think of a few edge cases but this should usually be right?
>
> thanks
>
> a
> On 04/03/2016 9:10 AM, "Vladimir S. FONOV" <vladimir.fonov at gmail.com>
> wrote:
>
>> Hello MINC developers,
>>
>>
>> I made changes to libminc (
>> https://github.com/BIC-MNI/libminc/tree/develop-labels )
>>
>> And minc-tools (
>> https://github.com/BIC-MNI/minc-tools/tree/develop-labels ) to add
>> support for -labels option in minccalc,mincmath and mincresample, to try to
>> address the common problem that many people seem to have over and over
>> again and again - inter-slice normalization of volumes with integer labels.
>>
>> Description of the problem:
>>
>> When you have a minc file that contains discrete levels (i.e anatomical
>> labels) produced, for example, by manual labeling in Display or ITK-SNAP.
>> You apply some simple operation using minccalc (for example intersecting
>> your labels with a mask, or doing some logical operations) you
>> inadvertently produce a volume where the actual discrete values for voxles
>> are replaced by floating-point ones. What's worse is the rule of this
>> replacement depends on the data type used for the minc file, dimension
>> order of the file and particular location of the voxel within the file.
>>
>> Example:
>>
>> minccalc  -express 'A[0]*2'
>> /opt/minc/share/icbm152_model_09c/mni_icbm152_t1_tal_nlin_sym_09c_deep2.mnc
>> test.mnc
>>
>> Here I take a file that contains 15 labels describing deep gray matter
>> structures and multiply each label by 2.
>> The contents of the input file (using print_all_labels):
>> Label: 1 6931
>> Label: 2 16801
>> Label: 3 1499
>> Label: 4 175210
>> Label: 5 5789
>> Label: 6 1404
>> Label: 7 909
>> Label: 8 4992
>> Label: 9 8512
>> Label: 101 6931
>> Label: 103 1499
>> Label: 106 1404
>> Label: 107 909
>> Label: 108 4992
>> Label: 109 8512
>>
>> The contents of the output file :
>> Label: 2 6649
>> *Label: 3 282*
>> Label: 4 16801
>> Label: 6 1499
>> Label: 8 175210
>> Label: 10 5789
>> Label: 12 1404
>> Label: 14 857
>> *Label: 15 52*
>> Label: 16 4992
>> Label: 18 8512
>> Label: 202 6931
>> Label: 206 1499
>> Label: 212 1404
>> Label: 214 857
>> *Label: 215 52*
>> Label: 216 4992
>> Label: 218 8512
>>
>>
>> Note the highlighted Labels: 3,15,215 which are clearly not possible when
>> one multiplies integer labels by 2.
>>
>> Solution (using the -labels option):
>> minccalc -labels -express 'A[0]*2'
>> /opt/minc/share/icbm152_model_09c/mni_icbm152_t1_tal_nlin_sym_09c_deep2.mnc
>> test_labels.mnc
>>
>> The output is now correct:
>> Label: 2 6931
>> Label: 4 16801
>> Label: 6 1499
>> Label: 8 175210
>> Label: 10 5789
>> Label: 12 1404
>> Label: 14 909
>> Label: 16 4992
>> Label: 18 8512
>> Label: 202 6931
>> Label: 206 1499
>> Label: 212 1404
>> Label: 214 909
>> Label: 216 4992
>> Label: 218 8512
>>
>>
>> --
>> Best regards,
>>
>>  Vladimir S. FONOV ~ vladimir.fonov <at> gmail.com
>> _______________________________________________
>> MINC-development mailing list
>> MINC-development at bic.mni.mcgill.ca
>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development
>>
>
> _______________________________________________
> MINC-development mailing list
> MINC-development at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.bic.mni.mcgill.ca/pipermail/minc-development/attachments/20160304/1f70d8e4/attachment-0001.html>


More information about the MINC-development mailing list