Skip to content

Commit

Permalink
register_atlas() and multilabel() aren't connecting properly -- print…
Browse files Browse the repository at this point in the history
…ing multilabel's annot_files list as ['U','U']
  • Loading branch information
binarybottle committed May 30, 2012
1 parent 9e985af commit 4fbef6e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
5 changes: 4 additions & 1 deletion atlases.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,15 @@ def vote_labels(label_lists):

return labels_max, label_votes, label_counts

def multilabel(hemi, subject_id, surface_file, annot_files):
def multilabel(surface_file, annot_files):
"""
Load VTK surfaces and write majority vote labels as VTK files,
according to multiple labelings (atlas_annot_name).
"""
print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
print(surface_file)
print(annot_files)
print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
"""
from os import path, getcwd
import pyvtk
Expand Down
35 changes: 15 additions & 20 deletions pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
mbflow.connect([(infosource, datasource,
[('subject_id','subject_id'),
('hemi','hemi')])])
#mbflow.add_nodes([datasink])

##############################################################################
# Surface input and conversion
Expand Down Expand Up @@ -142,13 +143,6 @@
template_reg.inputs.templates_path = templates_path
template_reg.inputs.template_reg_name = template_reg_name

flo1.add_nodes([template_reg])
mbflow.connect([(infosource, flo1,
[('hemi', 'Register_template.hemi')])])
mbflow.connect([(datasource, flo1,
[('sph_surface_files',
'Register_template.sph_surface_file')])])

# Atlas registration
atlas_reg = pe.MapNode(util.Function(input_names=['hemi',
'subject_id',
Expand All @@ -164,27 +158,28 @@
atlas_reg.inputs.atlases_path = atlases_path
atlas_reg.inputs.atlas_annot_name = atlas_annot_name

flo1.add_nodes([atlas_reg])
mbflow.connect([(infosource, flo1,
[('hemi', 'Register_atlases.hemi'),
('subject_id', 'Register_atlases.subject_id')])])
flo1.connect([(template_reg, atlas_reg,
[('template_reg_name', 'template_reg_name')])])

# Majority vote labeling
majority_vote = pe.Node(util.Function(input_names=['hemi',
'subject_id',
'surface_file',
majority_vote = pe.Node(util.Function(input_names=['surface_file',
'annot_files'],
output_names=['output_files'],
function = multilabel),
name='Vote_majority')

flo1.add_nodes([majority_vote])
# Add and connect the above nodes
flo1.add_nodes([template_reg, atlas_reg, majority_vote])

mbflow.connect([(infosource, flo1,
[('hemi', 'Register_template.hemi')]),
(datasource, flo1,
[('sph_surface_files',
'Register_template.sph_surface_file')])])

mbflow.connect([(infosource, flo1,
[('hemi', 'Vote_majority.hemi'),
('subject_id', 'Vote_majority.subject_id')])])
[('hemi', 'Register_atlases.hemi'),
('subject_id', 'Register_atlases.subject_id')])])
flo1.connect([(template_reg, atlas_reg,
[('template_reg_name', 'template_reg_name')])])

if use_freesurfer_surfaces:
mbflow.connect([(surface_conversion, flo1,
[('converted', 'Vote_majority.surface_file')])])
Expand Down

0 comments on commit 4fbef6e

Please sign in to comment.