[MINC-users] minccalc bug

Andrew Janke a.janke at gmail.com
Mon Jul 7 07:18:57 EDT 2014


Hi Alex,

After fiddling with this for a bit I think it's a combination of two things.

1. Restriction of range and slice scaling. If you run this all in
double precision and clamp the output afterwards you can almost
recover your image. Something is strange in the logic as presented but
I can't quite figure out what is causing things to go haywire.

2. You are relying upon "magic" functionality for your output image,
(the last evaluated expression). It's also not clear upon a quick
glance that the final y is out of the if loop. Use braces! To avoid
confusion you are always best to use the outfile argument syntax in
these cases. ie:

    minccalc -expression 'x=0; y=A[1]; if (y < 2) x=y; y' \
      -outfile y y.mnc \
/usr/local/bic/share/mni-models/average305_t1_tal_lin_mask.mnc \
/usr/local/bic/share/mni-models/average305_t1_tal_lin.mnc

Still I think it's a bug but if its caused by restriction of range
then it isn't really. Not sure. You'd be best served to break your
file down to one voxel and check the output using the -debug argument
at which point you'll probably get a clue as to what is awry.

In the meantime, probably a good idea to file a bug here (preferably a
reduced version using rawtominc with a single voxel).


https://github.com/BIC-MNI/minc-tools/issues

ta


a

On 5 July 2014 04:00, Alex Zijdenbos <zijdenbos at gmail.com> wrote:
> This one is probably for AJ; I stumbled across some really bizarre
> behaviour of minccalc:
>
> minccalc -expression 'x=0; y=A[1]; if (y < 2) x=y; y' \
> /usr/local/bic/share/mni-models/average305_t1_tal_lin_mask.mnc \
> /usr/local/bic/share/mni-models/average305_t1_tal_lin.mnc \
> y.mnc
>
> I would have imagined that the output file y.mnc would be the same as the
> second input file (A[1]), as y is never assigned to after y=A[1]; but that
> is not the case. The 'if' condition combined with the x=y assignment,
> somehow modifies y (rather significantly). If you play with the
> conditional, the assignment, or for instance use y=A[0], things may work as
> expected; but in the invocation above, it goes horribly wrong.
>
> -- A
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users


More information about the MINC-users mailing list