[MINC-users] mincmath

Jérôme Redouté redoute at cermep.fr
Wed Sep 23 07:41:04 EDT 2015


Thank you all!

Jerome

Le 23/09/2015 00:36, Mishkin Derakhshan a écrit :
> Hi Jerome,
> If you haven't discovered it by now, the minccalc -expression command is
> also great for both simple and advanced calculations.
>
> Here is an example of subtraction
> mincmath -expression "A[0]-A[1]" a.mnc B.mnc out.mnc
> A[0] is the first mmc file specified on the command line, so a.mnc
> A[1] is the second input, so B.mnc
> and out.mc is the output file where the result of a.mnc-B.mnc would go. If
> you wanted B.mnc - a.mnc, you could either change the expression to read
> "A[1]-A[0]" or you could leave the expression as is, and just change the
> ordering of your input files:
> mincmath -expression "A[0]-A[1]" B.mnc a.mnc out.mnc
>
> There are lots of other types of expressions possible, but one of the most
> useful ones I've used is the if/else
> mincmath -expr "A[1] != 0 ? A[0]/A[1]:0" a.mnc b.mnc out.mnc
>
> The general syntax of the expression is first evaluate the stuff before the
> ?, if it is true, then in the output file you put the stuff on the left of
> the colon, else, write out the stuff on the right of the :
>
> So the above would read, if a voxel in A[1] is not equal to zero, then in
> the output file put in A[0] divided by A[1]. And if A[1] is equal to zero,
> then instead of outputting the division, just output 0. Like in the above
> a.mnc maps to A[0] and b.mnc maps to A[1].
>
> See the minccalc man page for lots of documentation.
>
> hth,
> mishkin
>
>
> On Tue, Sep 22, 2015 at 4:56 AM, Andrew Janke <a.janke at gmail.com> wrote:
>
>> Hi Jerome,
>>
>> The first is correct (this one):
>>
>>     mincmath -sub A.mnc B.mnc out.mnc
>>
>>
>> Be careful of div zero effects when using divide and mincmath.
>>
>>
>> a
>>
>>
>> On 23 September 2015 at 00:50, Jérôme Redouté <redoute at cermep.fr> wrote:
>>> Hi All,
>>> just a naive question concerning mincmath syntax:
>>>
>>> if you want to substract 2 volumes : A - B
>>>
>>> the correct syntax is:
>>>
>>> mincmath -sub A.mnc B.mnc out.mnc
>>>
>>> or
>>>
>>> mincmath -sub B.mnc A.mnc out.mnc
>>>
>>> (same question for -div  ;)
>>>
>>> Thank you
>>> JR
>>>
>>> --
>>> ==================================================================
>>> Jérôme Redouté
>>> Ph.D. - Ingénieur de Recherche - Université Claude Bernard - Lyon1
>>> CERMEP - Imagerie du vivant
>>> 59 Bd Pinel. 69677 Bron - FRANCE
>>> tel : 33 (0)4 72 68 86 18 (bureau)
>>> tel : 33 (0)4 72 68 86 00 (standard)
>>> fax : 33 (0)4 72 68 86 10
>>> ==================================================================
>>>
>>>
>>> _______________________________________________
>>> MINC-users at bic.mni.mcgill.ca
>>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>> _______________________________________________
>> MINC-users at bic.mni.mcgill.ca
>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>>
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>


-- 
==================================================================
Jérôme Redouté
Ph.D. - Ingénieur de Recherche - Université Claude Bernard - Lyon1
CERMEP - Imagerie du vivant
59 Bd Pinel. 69677 Bron - FRANCE
tel : 33 (0)4 72 68 86 18 (bureau)
tel : 33 (0)4 72 68 86 00 (standard)
fax : 33 (0)4 72 68 86 10
==================================================================




More information about the MINC-users mailing list