problem reviewing results of segmentation

113 views
Skip to first unread message

Markus Gschwind

unread,
Feb 12, 2014, 9:13:25 AM2/12/14
to cmtk-users
Hi David,,

Using your example data project01_dsi I came through until the en of segmentation step.

There when reviewing the results, I can see the norm/aseg, but I cannot see the brainmask/T1 and neither the norm/aseg/surf.

This is the error when trzing to view brainmask/T1

Converting main surface: 100% done.      
Converting main surface: 100% done.      
Converting original surface: 100% done.      
Converting pial surface: 100% done.      
nquads=4915204,  nvertices=592
ERROR: MRISread: file '/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/surf/rh.jacobian_white' has many more faces than vertices!
Probably trying to use a scalar data file as a surface!

No such file or directory

and this with viewing the norm/aseg/surf

Converting main surface: 100% done.      
Converting main surface: 100% done.      
Converting original surface: 100% done.      
Converting pial surface: 100% done.      
nquads=4915204,  nvertices=592
ERROR: MRISread: file '/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/surf/rh.jacobian_white' has many more faces than vertices!
Probably trying to use a scalar data file as a surface!

No such file or directory

The file
/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/surf/rh.jacobian_white

does well exist.

Thanks for ideas!

Best,
Markus

David Romascano

unread,
Feb 12, 2014, 10:27:25 AM2/12/14
to cmtk-...@googlegroups.com
Good evening Markus,

What do you get if you type "tkmedit -f /home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/mri/brainmask.mgz -surface /home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/surf/lh.white -aux /home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/mri/T1.mgz -aux-surface /home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/surf/rh.white' ?

Do the 4 files exist ? Namely FREESURFER/mri/brainmask.mgz, FREESURFER/surf/lh.white, FREESURFER/mri/T1.mgz and FREESURFER/surf/rh.white in the /home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1 directory.

Markus Gschwind

unread,
Feb 12, 2014, 3:26:40 PM2/12/14
to cmtk-...@googlegroups.com
Hi David,

Thanks for the followup.

Yes, the command executes perfectly and all 4 files are there and they look nice.

What next?

Thanks, Markus

David Romascano

unread,
Feb 13, 2014, 8:15:57 AM2/13/14
to cmtk-...@googlegroups.com
Hi again !

Ok, now try the following (inside python):

import os.path
import pickle
import gzip

from nipype.interfaces.io import FreeSurferSource

reconall_results_path = os.path.join("/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/NIPYPE/diffusion_pipeline/segmentation_stage,"reconall","result_reconall.pklz")
reconall_results = pickle.load(gzip.open(reconall_results_path))

fs = FreeSurferSource(subjects_dir=reconall_results.outputs.subjects_dir, subject_id=reconall_results.outputs.subject_id)
res = fs.run()

res.outputs.brainmask

res.outputs.white[1]

res.outputs.T1

res.outputs.white[2]

Do you get any errors ?

David Romascano

unread,
Feb 13, 2014, 8:20:34 AM2/13/14
to cmtk-...@googlegroups.com
Sorry, there's a " missing, type the following :


import os.path
import pickle
import gzip

from nipype.interfaces.io import FreeSurferSource

reconall_results_path = os.path.join("/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/NIPYPE/diffusion_pipeline/segmentation_stage","reconall","result_reconall.pklz")

Markus Gschwind

unread,
Feb 13, 2014, 10:34:30 AM2/13/14
to cmtk-...@googlegroups.com
Hi David,

This is what I get (after all the import lines):

>>> reconall_results_path = os.path.join("/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/NIPYPE/diffusion_pipeline/segmentation_stage","reconall","result_reconall.pklz")
>>>
>>> reconall_results = pickle.load(gzip.open(reconall_results_path))
>>> fs = FreeSurferSource(subjects_dir=reconall_results.outputs.subjects_dir, subject_id=reconall_results.outputs.subject_id)
>>> res = fs.run()
>>> res.outputs.brainmask
u'/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/mri/brainmask.mgz'
>>>
>>> res.outputs.white[1]
u'/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/surf/lh.white'
>>>
>>> res.outputs.T1
u'/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/mri/T1.mgz'
>>>
>>> res.outputs.white[2]
u'/home/gschwind/Documents/CMapper/exampledataset/project01_dsi/connectome_0001/tp1/FREESURFER/surf/rh.jacobian_white'
>>>

I do not see any error, but I am not sure if the res.output.white[2] should not be simply "rh.white" instead of "rh.jacobean_white"?

What next?

Thanks!
Markus

David Romascano

unread,
Feb 13, 2014, 11:49:41 AM2/13/14
to cmtk-...@googlegroups.com
Yes ! This looks likely to be it, I didn't notice this in your first post.

res.outputs.white[2] is set by nipype when running FreeSurferSource. I do have the rh.white file in res.outputs.white[2] when running FreeSurferSource.

Are you sure you have our forked version of nipype installed ? The official nipype code has an updated version of FreeSurferSource that might set res.outputs.white[2] differently.

I'll take a closer look at this tomorrow morning and get back at you. Thanks for following up !

Cheers,
David

Markus Gschwind

unread,
Feb 13, 2014, 11:59:49 AM2/13/14
to cmtk-...@googlegroups.com
Hi David,
 
I think, that I have installed the LTS5 nipype. How can I be sure?
 
Thanks!


 

--
You received this message because you are subscribed to a topic in the Google Groups "cmtk-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cmtk-users/AbUu-ChAueY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cmtk-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

David Romascano

unread,
Feb 14, 2014, 4:41:15 AM2/14/14
to cmtk-...@googlegroups.com
Hi again !

Actually, it might be because of the glob module in python. What do you get in res.outputs.white when doing all the import lines ?

I get something like :

['~/FREESURFER/surf/lh.jacobian_white',
'~/FREESURFER/surf/lh.white',
'~/FREESURFER/surf/rh.white',
'~/FREESURFER/surf/rh.jacobian_white']

I get the same if I run "import glob", "glob.glob('<base_directory>/FREESURFER/surf/*white')" in python, where <base_directory> is the directory of your subject. That's the command used to fill the res.outputs.white variable with FreeSurferSource.run()

I guess you might get the same paths but in different order ?

Markus Gschwind

unread,
Feb 14, 2014, 4:56:48 AM2/14/14
to cmtk-users
Hi,

after tall the imports, "res.outputs.white" gives me:

[u'/.../FREESURFER/surf/lh.jacobian_white', 
u'/.../FREESURFER/surf/lh.white', 
u'/.../FREESURFER/surf/rh.jacobian_white', 
u'/.../FREESURFER/surf/rh.white']

using the "import glob" and then "glob.glob('/fullpath_to_subject/FREESURFER/surf/*white')" 

I get

['/.../FREESURFER/surf/lh.jacobian_white', 
'/.../FREESURFER/surf/lh.white', 
'/.../FREESURFER/surf/rh.jacobian_white', 
'/.../FREESURFER/surf/rh.white']

so seems the same but without the "u" inbetween, from which I don't know what it means.





--

David Romascano

unread,
Feb 14, 2014, 5:51:46 AM2/14/14
to cmtk-...@googlegroups.com
The error is due to the different order in which the 4 files are specified (on your computer rh.white is the 4th element, on mine it's the 3rd, and on a colleague computer it's the 4th but the other files are in different order). As the order depends on the UNIX configuration of the machine, I've changed the code in CMP to avoid using the FreeSurferSource function and find directly the appropriate files.

Can you download the last commit from https://github.com/LTS5/cmp_nipype and install it using "sudo python setup.py install" ? Viewing the segmentation results should work now.

Tell me how it goes. Thanks again for spotting this bug.

David
Reply all
Reply to author
Forward
0 new messages