[pymvpa] How to export neighborhood relationships of NiftiDataset?

Thorsten Kranz thorstenkranz at googlemail.com
Thu Nov 10 16:33:10 UTC 2011


Hi Lu Feng,

ah, o.k., your EPI is already normalized. The easiest way would then be to
just open it in FSLView, there you have spinboxes (special kind of GUI
input boxes) for setting and reading the current voxel-coordinate and right
next to it you see the coordinates with qform applied (compare my example
image in the attachment).

If this doesn't help, you have to apply your qform to your voxel
coordinates. Are you using pynifti? Then you can use the NiftiImage class
and the vx2q method. Hope my memory doesn't play tricks on me.

Greetings,
Thorsten

2011/11/10 冯璐 <fenglu at fingerpass.net.cn>

>  Dear Thorsten,****
>
> ** **
>
>          Thank you for your reply. What I have done may be something
> curious. I did slice timing, realignment, coregistering, and normalization
> using SPM. Then I changed the .img/.hdr pairs (supplied by SPM) into 4D
> .nii.gz files which are more suitable for PyMVPA. For SPM, I can check the
> MNI coordinates easily. But for PyMVPA, I don’t know how to check the MNI
> coordinates. What I got using *dataset.mapper.getInId()* is a coordinate
> in the voxel space, I think. I wonder how to change them into the MNI space.
> ****
>
> ** **
>
> ** **
>
> Best wishes!****
>
> ** **
>
>      *Lu FENG*
>
> fenglu at fingerpass.net.cn****
>
> ** **
>
> *From:* pkg-exppsy-pymvpa-bounces+fenglu=
> fingerpass.net.cn at lists.alioth.debian.org [mailto:
> pkg-exppsy-pymvpa-bounces+fenglu=fingerpass.net.cn at lists.alioth.debian.org]
> *On Behalf Of *Thorsten Kranz
> *Sent:* 2011年11月10日 18:06
>
> *To:* Development and support pf PyMVPA
> *Subject:* Re: [pymvpa] How to export neighborhood relationships of
> NiftiDataset?****
>
>  ** **
>
> Hi Lu Feng,
>
> getting to some voxel-indices to MNI coordinates is a somewhat tricky
> task. What you have to do is (assuming you have a EPI-sequence, not
> structural MRI):
>
> 1) coregister your EPI to a structural image of the same subject
> 2) normalize the structural image to some standard image, e.g.
> MNI152T1_2mm as contained in fsl data
> 3) apply the concatenated transform EPI->structural an structural->MNI to
> the EPI sequence
> 4) thus you obtain an image that is in "MNI space", e.g. by opening it in
> fslview you can find out the MNI coordinates.
>
> Going to Talairach would be the next step, look at
>
> http://imaging.mrc-cbu.cam.ac.uk/imaging/MniTalairach
>
> for more details.
>
> But be careful: Talairach is not a 1:1 analogy to MNI, some parts of the
> Tal-Brain are much smaller than in MNI. MNI is an average of 152 brains,
> Talairach is based on only one example brain.
>
> You do not have to do steps 3+4, after obtaining the two transforms from
> EPI to structural to MNI, you can also manually calculate MNI coordinates
> from your voxel coordinates, but I don'T know if you want to do this.
>
> Greetings,
>
> Thorsten
>
> ****
>
> 2011/11/10 冯璐 <fenglu at fingerpass.net.cn>****
>
> ... I can't understand your words exactly ... I used SPM before and I
> didn't have to think about the voxel space and MNI space, etc. Let's move
> to some practical problems.
>
> Loading from
>         Task1.nii.gz,
> I can get
>         dataset.samples which is a M*N*P matrix.
> Using
>         dataset.mapper.getInId(index),
> I can get
>         a coordinate [z, y, x], x belongs to (0, M), y belongs to (0, N),
> z belongs to (0, P).
> I have checked the result above.
>
> Using
>        fslhd Task1.nii.gz,
> I can get some information may be useful
>        qform_name     Aligned Anat
>                qform_code     2
>                qto_xyz:1      -3.500000  0.000000  -0.000000  76.000000
>                qto_xyz:2      0.000000  3.500000  -0.000000  -112.000000
>                qto_xyz:3      0.000000  0.000000  4.000000  -50.000000
>                qto_xyz:4      0.000000  0.000000  0.000000  1.000000
>                qform_xorient  Right-to-Left
>                qform_yorient  Posterior-to-Anterior
>                qform_zorient  Inferior-to-Superior
>                sform_name     Aligned Anat
>                sform_code     2
>                sto_xyz:1      -3.500000  0.000000  0.000000  76.000000
>                sto_xyz:2      0.000000  3.500000  0.000000  -112.000000
>                sto_xyz:3      0.000000  0.000000  4.000000  -50.000000
>                sto_xyz:4      0.000000  0.000000  0.000000  1.000000
>                sform_xorient  Right-to-Left
>                sform_yorient  Posterior-to-Anterior
>                sform_zorient  Inferior-to-Superior
>
> Then, how can I change the coordinate into a MNI coordinate or a Talairach
> coordinate?
>
> Sorry for interruption and thanks in advance.****
>
>
> Best wishes!
>
>     Lu FENG
> fenglu at fingerpass.net.cn
>
> -----Original Message-----
> From: pkg-exppsy-pymvpa-bounces+fenglu=
> fingerpass.net.cn at lists.alioth.debian.org [mailto:
> pkg-exppsy-pymvpa-bounces+fenglu=fingerpass.net.cn at lists.alioth.debian.org]
> On Behalf Of Yaroslav Halchenko****
>
> Sent: 2011年11月8日 20:55
> To: Development and support pf PyMVPA
> Subject: Re: [pymvpa] How to export neighborhood relationships of
> NiftiDataset?
>
> axes and direction depend on how they are stored in your specific
> Nifti -- and those could vary since we do not deduce physical
> orientation of the volume anyhow from qform.
>
> On Tue, 08 Nov 2011, 冯璐 wrote:
>
> > I think that is what I need.
> > So array([0, 0, 1]) is the coordinate in the voxel space. X from 0 to
> max: right->left; Y from 0 to max: posterior->anterior; Z from 0 to max:
> inferior->superior ??
>
>
> > Best wishes!
>
> >      Lu FENG
> > fenglu at fingerpass.net.cn
>
> > -----Original Message-----
> > From: pkg-exppsy-pymvpa-bounces+fenglu=
> fingerpass.net.cn at lists.alioth.debian.org [mailto:
> pkg-exppsy-pymvpa-bounces+fenglu=fingerpass.net.cn at lists.alioth.debian.org]
> On Behalf Of Yaroslav Halchenko
> > Sent: 2011年11月8日 13:35
> > To: Development and support pf PyMVPA
> > Subject: Re: [pymvpa] How to export neighborhood relationships of
> NiftiDataset?
>
> > so we are talking about 0.4.x series of pymvpa (in 0.6 AKA mvpa2 voxel
> > indices are explicitly stored in feature attributes of a dataset):  so I
> > guess you are looking for:
>
> > In [10]: from mvpa.tests.tests_warehouse import datasets
> > In [11]: datasets['3dsmall'].mapper.getInId(0)
> > Out[11]: array([0, 0, 1])
>
> > ?
>
> > On Tue, 08 Nov 2011, 冯璐 wrote:
>
> > >    Dear experts,
>
>
>
> > >             I  know that  using NiftiDataset.map2Nifti()  or other
>  functions
> > >    like mapForward()  or mapReverse(),  we  can deal  with  either 2D
>  or  3D
> > >    dataset freely. But I wonder how to export the neighborhood
>  relationships
> > >    of the volume.  Briefly, I��d like  to have a  transformation
> matrix or  a
> > >    list of  coordinations  for each  voxel.  I need  this  if I  go
>  on  with
> > >    processing by other tools instead of PyMVPA.
>
> > >             Thanks in advanceJ
>
>
>
> > >    Best wishes!
>
>
>
> > >         Lu FENG
>
> > >    fenglu at fingerpass.net.cn
>
>
>
> > >    __________ Information from ESET NOD32 Antivirus, version of virus
> > >    signature database 6532 (20111010) __________
>
> > >    The message was checked by ESET NOD32 Antivirus.
>
> > >    [1]http://www.eset.com
>
> > > References
>
> > >    Visible links
> > >    1. http://www.eset.com/
>
> > > _______________________________________________
> > > Pkg-ExpPsy-PyMVPA mailing list
> > > Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> > >
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
> --
> =------------------------------------------------------------------=
> Keep in touch                                     www.onerussian.com
> Yaroslav Halchenko                 www.ohloh.net/accounts/yarikoptic
>
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
>
> ****
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 6616 (20111109) __________****
>
>
> The message was checked by ESET NOD32 Antivirus.****
>
> http://www.eset.com****
>
>
>
>
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa*
> ***
>
> ** **
>
> ** **
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 6617 (20111110) __________****
>
> ** **
>
> The message was checked by ESET NOD32 Antivirus.****
>
> ** **
>
> http://www.eset.com****
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 6617 (20111110) __________
>
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20111110/c44daa49/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fslview.png
Type: image/png
Size: 14223 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20111110/c44daa49/attachment-0001.png>


More information about the Pkg-ExpPsy-PyMVPA mailing list