[MINC-development] param2xfm && xfm2param (fwd)

Andrew Janke minc-development@bic.mni.mcgill.ca
Thu, 3 Apr 2003 10:36:47 +1000


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---2107239605-685549424-1049328700=:10949
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.SGI.4.51.0304031036272.10949@twodogs.cmr.uq.edu.au>


On Wed, 2 Apr 2003, Robert VINCENT wrote:

> I found a comment on line 594 of "make_rots.c" which specifies that all three
> scale factors must be positive.  I guess that even though conceptually a
> negative scale factor makes sense, the actual math disallows it.  It seems to
> use the transform to calculate the *magnitude* of the unit vector in each
> direction, and uses this as the scale factor.  So negative numbers lose their
> signs in the transformation.

Correct, this is true for mni_autoreg.  mincresample on the other hand should
(and can IIRC) handle pretty much any affine matrix you throw at it.  This
becomes important when you consider importing volumes and using direction
cosines that don't "make sense".

  ie:

   xdircos   1 0 0
   ydircos   0 0 1
   zdircos   0 1 0

This is commonly done by taking the columns of a "orientation" matrix such as
.mat file from SPM as the direction cosines.

(use the attached 'mi' as a replacement for mincinfo if you do this regularly)
I then usually resample these volumes using mincresample to more "sensible"
direction cosines before using them.

So the problem here is that minctracc probably will do the wrong thing by these
volumes. As such I usually do something like this before feeding any volumes to
minctracc or any pipe for that matter..

   $ mincresample -to_sensible_direction_cosines in.mnc tmp.mnc
   $ mincreshape +direction -dimsize xspace=-1 -dimsize yspace=-1 \
       -dimsize zspace=-1 -dimorder zspace,yspace,xspace tmp.mnc out.mnc

I can see however as to why louis prefers minctracc not to generate negative
scales! The main reason why I do use negative scales is to flip incorrectly
oriented volumes.

> I'm not familiar enough with mni_autoreg to know if this is a bug or a
> feature.  What do you think?

I think it's a fine thing to keep in minctracc (no negative scales as there
should be none!) but perhaps xfm2param and param2xfm should be shifted into
minc and at least a warning/check put in WRT negative scales.


a

>
> On Mon, 31 Mar 2003, Andrew Janke wrote:
>
> >
> >    $ param2xfm -scales 1 -1 1 t2.xfm
> >    $ cat t2.xfm
> >    MNI Transform File
> >    %Mon Mar 31 15:08:50 2003>>> param2xfm -scales 1 -1 1 t2.xfm
> >    %(Package MNI AutoReg, version 0.98k, compiled by rotor@twodogs.cmr.uq.edu.au
> >       (mips-sgi-irix6.5) on 2002-09-06 at 12:02:54)
> >
> >    Transform_Type = Linear;
> >    Linear_Transform =
> >     1 0 0 0
> >     0 -1 0 0
> >     0 0 1 0;
> >
> > so far so good.
> >
> >    $ xfm2param t2.xfm
> >    after parameter extraction
> >    -center         0.00000    0.00000    0.00000
> >    -translation    0.00000    0.00000    0.00000
> >    -rotation       0.00000    0.00000    0.00000
> >    -scale          1.00000    1.00000    1.00000
> >    -shear          0.00000    0.00000    0.00000
> >
> > Hrm..?
> >
> > --
> > Andrew Janke   ( rotor@cmr.uq.edu.au || www.cmr.uq.edu.au/~rotor )
> > Australia->University of Queensland->Centre for Magnetic Resonance
> > Work: +61 7 3365 4100 || Home: +61 7 3800 4042
> > _______________________________________________
> > MINC-development mailing list
> > MINC-development@bic.mni.mcgill.ca
> > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development
> >
>

--
Andrew Janke   ( rotor@cmr.uq.edu.au || www.cmr.uq.edu.au/~rotor )
Australia->University of Queensland->Centre for Magnetic Resonance
Work: +61 7 3365 4100 || Home: +61 7 3800 4042
---2107239605-685549424-1049328700=:10949
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME=mi
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.SGI.4.51.0304031011400.10949@twodogs.cmr.uq.edu.au>
Content-Description: 
Content-Disposition: ATTACHMENT; FILENAME=mi

IyEgL3Vzci9iaW4vZW52IHBlcmwNCg0KdXNlIHdhcm5pbmdzICJhbGwiOw0K
dXNlIEZpbGU6OkJhc2VuYW1lOw0KDQokbWUgPSAmYmFzZW5hbWUoJDApOw0K
aWYoJCNBUkdWIDwgMCl7DQogICBkaWUgIlVzYWdlOyAkbWUgPGluZmlsZS5t
bmM+IDxpbmZpbGUyLm1uYz5cblxuIjsNCiAgIH0NCg0KZm9yZWFjaCAkZiAo
QEFSR1Ypew0KDQogICBAYXJncyA9ICgnbWluY2luZm8nLCANCiAgICAgICAg
ICAgICctYXR0dmFsdWUnLCAneHNwYWNlOmRpcmVjdGlvbl9jb3NpbmVzJywN
CiAgICAgICAgICAgICctYXR0dmFsdWUnLCAneXNwYWNlOmRpcmVjdGlvbl9j
b3NpbmVzJywNCiAgICAgICAgICAgICctYXR0dmFsdWUnLCAnenNwYWNlOmRp
cmVjdGlvbl9jb3NpbmVzJywNCiAgICAgICAgICAgICRmKTsNCg0KICAgQGRp
cmNvcyA9IHNwbGl0KC9cbi8sIGBAYXJnc2ApOw0KICAgDQogICAkZmxhZyA9
IDA7DQogICBmb3JlYWNoIChzcGxpdCgvXG4vLCBgbWluY2luZm8gJGZgKSl7
DQogICAgICBjaG9tcDsNCiAgICAgIA0KICAgICAgcHJpbnQgIiRfIjsNCiAg
ICAgIA0KICAgICAgaWYobS9kaW1lbnNpb25cIG5hbWUvKXsNCiAgICAgICAg
IHByaW50ICIgICAgIGRpcmNvcyI7DQogICAgICAgICAkZmxhZyA9IDE7DQog
ICAgICAgICB9DQogICAgICANCiAgICAgIGVsc2lmKG0vLS0tLS0tLS0tLS0t
LS0vKXsNCiAgICAgICAgIHByaW50ICIgICAgIC0tLS0tLSI7DQogICAgICAg
ICB9DQogICAgICANCiAgICAgIGVsc2lmKCRmbGFnICYmIG0veHNwYWNlLyl7
DQogICAgICAgICBwcmludCAiICAgICAkZGlyY29zWzBdIjsNCiAgICAgICAg
IH0NCiAgICAgIGVsc2lmKCRmbGFnICYmIG0veXNwYWNlLyl7DQogICAgICAg
ICBwcmludCAiICAgICAkZGlyY29zWzFdIjsNCiAgICAgICAgIH0NCiAgICAg
IGVsc2lmKCRmbGFnICYmIG0venNwYWNlLyl7DQogICAgICAgICBwcmludCAi
ICAgICAkZGlyY29zWzJdIjsNCiAgICAgICAgIH0NCiAgICAgICAgIA0KICAg
ICAgcHJpbnQgIlxuIjsNCiAgICAgIH0NCiAgIH0NCg==

---2107239605-685549424-1049328700=:10949--