[nipype] question about running multiple seed masks for tractography

86 views
Skip to first unread message

David Gutman

unread,
Mar 19, 2013, 1:36:52 PM3/19/13
to nipy...@googlegroups.com
I wanted to get some feedback on the cleanest way to set up a pipeline that will iterate through a list of seeds (or targets), and be fairly easy to reuse (e.g. change the list of seed/targets regions).


In this case, the seed regions are in native DTI space, although named consistently across subjects.

So I would have something similar to this:

subj_list = [ subj1, subj2, subj3]

seed_mask_list = [ 'frontal_lobe.nii.gz', 'parietal_lobe.nii.gz', 'amygdala.nii.gz', 'seed4.nii.gz]

and the masks are subject specific (since they are in the patient's DTI space), so are located in

subj1/ROIS/seed1.nii.gz, subj2/ROIs/seed1.nii.gz, etc,etc...

Is this possible to do via an iterable?  The number of seed_masks will be the same for all subjects, but the actual path for a given seed region would have to be updated for each subject on run time to specify the "SUBJ_ROI_DIR".


In my data source I'd have something like this:   seed_region_base_path='%s/ROI/',

but my iterable would be something like

probtrackx.iterables = [ "seed", seed_region_base_path + seed_mask_list]  ## <obviously wrong syntax


The only syntax I've seen before is simply:
probtrackx.iterables = ["seed", SEED_MASK_LIST]

but in this case, the SEED_MASK_LIST is different for each subject....


Thanks!

David





 


--
David A Gutman, M.D. Ph.D.
Assistant Professor of Biomedical Informatics
Senior Research Scientist, Center for Comprehensive Informatics
Emory University School of Medicine

Satrajit Ghosh

unread,
Mar 19, 2013, 8:50:49 PM3/19/13
to nipy-user
hi david,

iterables need to have fixed lists as these are expanded before a workflow is run. 

in your case, is the list of names different or is the content of those files different for each subject. if each subject has a different set of filenames, then you cannot use iterables, 

cheers,

satra

--
 
---
You received this message because you are subscribed to the Google Groups "NiPy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nipy-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

David Gutman

unread,
Mar 19, 2013, 8:56:06 PM3/19/13
to nipy...@googlegroups.com

Ok that's what I thought...   ill have to structure things a bit different then... thanks for the feedback...

David Gutman

unread,
Mar 19, 2013, 8:57:53 PM3/19/13
to nipy...@googlegroups.com

Also the filenames of the rois are the same but two directories up on the hierarchy is the subject id. .. so there's a separate set of files for every subject

On Mar 19, 2013 8:51 PM, "Satrajit Ghosh" <sa...@mit.edu> wrote:

Satrajit Ghosh

unread,
Mar 19, 2013, 9:00:05 PM3/19/13
to nipy-user

Also the filenames of the rois are the same but two directories up on the hierarchy is the subject id. .. so there's a separate set of files for every subject

that's not a problem. you can get things with datagrabber or the new datafinder.

cheers,

satra

David Gutman

unread,
Apr 1, 2013, 7:18:40 PM4/1/13
to nipy...@googlegroups.com
Are there any examples/workflows where the datafinder is grabbing a "list" of stuff (i.e. datasource.seedmasks = list of masks.. not a specific key value assocation... but a key->list of values).

I am still screwing up the syntax, and most of the examples I found were not in a workflow, but isolated commands, and I think I am screwing up the output trait when I am trying to put the thing together.

So basically:

Subj_IDS = [ 'John', 'Jane', 'Doug']

tractography data is in

John/data.bedpostX/bvecs
John/data.bedpostX/bvals
John/data.bedpostX/thsamples

etc,etc..

i.e. %s/data.bedpostX/%s... so I got the dictionary set up so that datasource.outputs.bvecs/bvals/etc.. are set up.


Now I also have my custom ROI's arranged as follows

subj_id/ROIs/rois_on_fa/mask_1.nii.gz
subj_id/ROIs/rois_on_fa/mask_2.nii.gz
subj_id/ROIs/rois_on_fa/mask_3.nii.gz
subj_id/ROIs/rois_on_fa/mask_4.nii.gz
 
i,e.

John/ROIs/rois_on_fa/mask1.nii.gz
John/ROIs/rois_on_fa/mask2.nii.gz
John/ROIs/rois_on_fa/mask3.nii.gz
John/ROIs/rois_on_fa/mask4.nii.gz
 

So I've been trying a number of ways to hook things up, but must be screwing something up syntactically.  What I (think) I want to do is generate an infosource (i.e. subject list).... past that to a standard datafinder that generates the bvecs/bvals/thsamples1/etc links....

Now either in the same datafinger, or maybe a separate one if it's easier.... I want to generate the list of subject specific seed masks... ... and then bind that list of of seed_masks to the "seed" input parameter of probtrackx.

So for n subjects, and m masks, I would generate n x m iterations of probtrackx, running each seed for each subject...


I am sure this is possible, I just haven't find a "simple" example that does this I could follow.... as there are numerous ways to connect the nodes, and since I am still somewhat of a python newb, I still get lost trying to figure out this stuff.

Any help would be appreciated.... if not I will send the herd of monkeys back to the typewriters till this works.













Chris Filo Gorgolewski

unread,
Jun 1, 2013, 9:11:39 PM6/1/13
to nipy...@googlegroups.com
Sorry for late reply. What if you use two infosources (with iterables): one for subject_id and one for mask_name; and two datagrabbers: one for dwi/bvecs/bvals (and connect subject_id_infosource to it) and one for mask (and connect both infosources to it). Alternatively you can use one datagrabber that returns dwi/bvecs/bvals and a list of subject specific masks and then use mapnode on probtrackx. I hope this helps!

David Gutman

unread,
Jun 3, 2013, 1:11:52 PM6/3/13
to nipy...@googlegroups.com

Thanks... I did something similar.   For some reason at first it didn't occur to me a data source could have its own satasource.   Obviously nothing prevents it just hadn't thought that way and was trying unsuccessfullt to do it all within a skngle datasource node which of course didn't work right..

Thanks

Reply all
Reply to author
Forward
0 new messages