Skip to content

Commit c9992d0

Browse files
author
Erik Ziegler
committed
Fixes for adding multiple tract files to a CFF file
1 parent 7153693 commit c9992d0

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

examples/dmri_connectivity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def select_aparc_annot(list_of_files):
551551
mapping.connect([(gpickledNetworks, CFFConverter,[("out","gpickled_networks")])])
552552
mapping.connect([(niftiVolumes, CFFConverter,[("out","nifti_volumes")])])
553553
mapping.connect([(fiberDataArrays, CFFConverter,[("out","data_files")])])
554-
mapping.connect([(camino2trackvis, CFFConverter,[("trackvis","tract_files")])])
554+
mapping.connect([(creatematrix, CFFConverter,[("filtered_tractographies","tract_files")])])
555555
mapping.connect([(inputnode, CFFConverter,[("subject_id","title")])])
556556

557557
"""

examples/dmri_connectivity_advanced.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268

269269
probCSDstreamtrack = pe.Node(interface=mrtrix.ProbabilisticSphericallyDeconvolutedStreamlineTrack(),name='probCSDstreamtrack')
270270
probCSDstreamtrack.inputs.inputmodel = 'SD_PROB'
271-
probCSDstreamtrack.inputs.maximum_number_of_tracks = 150000
271+
probCSDstreamtrack.inputs.desired_number_of_tracks = 150000
272272
tracks2prob = pe.Node(interface=mrtrix.Tracks2Prob(),name='tracks2prob')
273273
tracks2prob.inputs.colour = True
274274
MRconvert_tracks2prob = MRconvert_fa.clone(name='MRconvert_tracks2prob')
@@ -542,7 +542,7 @@
542542
mapping.connect([(creatematrix, CFFConverter,[("matrix_files","gpickled_networks")])])
543543
mapping.connect([(niftiVolumes, CFFConverter,[("out","nifti_volumes")])])
544544
mapping.connect([(fiberDataArrays, CFFConverter,[("out","data_files")])])
545-
mapping.connect([(creatematrix, CFFConverter,[("filtered_tractography","tract_files")])])
545+
mapping.connect([(creatematrix, CFFConverter,[("filtered_tractographies","tract_files")])])
546546
mapping.connect([(inputnode, CFFConverter,[("subject_id","title")])])
547547

548548
"""

nipype/interfaces/cmtk/cmtk.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ class CreateMatrixOutputSpec(TraitedSpec):
416416
fiber_labels_noorphans = File(desc='Saved Numpy array with the labels for each non-orphan fiber', exists=True)
417417
filtered_tractography = File(desc='TrackVis file containing only those fibers originate in one and terminate in another region', exists=True)
418418
filtered_tractography_by_intersections = File(desc='TrackVis file containing all fibers which connect two regions', exists=True)
419+
filtered_tractographies = OutputMultiPath(File(desc='TrackVis file containing only those fibers originate in one and terminate in another region', exists=True))
419420

420421
class CreateMatrix(BaseInterface):
421422
"""
@@ -536,6 +537,7 @@ def _list_outputs(self):
536537

537538
_, name , _ = split_filename(self.inputs.tract_file)
538539
outputs['filtered_tractography'] = op.abspath(name + '_streamline_final.trk')
540+
outputs['filtered_tractographies'] = [outputs['filtered_tractography'], outputs['filtered_tractography_by_intersections']]
539541
return outputs
540542

541543
def _gen_outfilename(self, ext):

nipype/interfaces/cmtk/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def _run_interface(self, runtime):
138138
count = 0
139139
if isdefined(self.inputs.tract_files):
140140
for trk in self.inputs.tract_files:
141-
trk_name = 'Tract file {cnt}'.format(cnt=count)
141+
_, trk_name, _ = split_filename(trk)
142142
ctrack = cf.CTrack(trk_name, trk)
143143
a.add_connectome_track(ctrack)
144144
count += 1

nipype/workflows/dmri/mrtrix/connectivity_mapping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def create_connectivity_pipeline(name="connectivity", parcellation_name='scale50
213213

214214
probCSDstreamtrack = pe.Node(interface=mrtrix.ProbabilisticSphericallyDeconvolutedStreamlineTrack(),name='probCSDstreamtrack')
215215
probCSDstreamtrack.inputs.inputmodel = 'SD_PROB'
216-
probCSDstreamtrack.inputs.maximum_number_of_tracks = 150000
216+
probCSDstreamtrack.inputs.desired_number_of_tracks = 150000
217217
tracks2prob = pe.Node(interface=mrtrix.Tracks2Prob(),name='tracks2prob')
218218
tracks2prob.inputs.colour = True
219219
MRconvert_tracks2prob = MRconvert_fa.clone(name='MRconvert_tracks2prob')
@@ -479,7 +479,7 @@ def create_connectivity_pipeline(name="connectivity", parcellation_name='scale50
479479
mapping.connect([(creatematrix, CFFConverter,[("matrix_files","gpickled_networks")])])
480480
mapping.connect([(niftiVolumes, CFFConverter,[("out","nifti_volumes")])])
481481
mapping.connect([(fiberDataArrays, CFFConverter,[("out","data_files")])])
482-
mapping.connect([(creatematrix, CFFConverter,[("filtered_tractography","tract_files")])])
482+
mapping.connect([(creatematrix, CFFConverter,[("filtered_tractographies","tract_files")])])
483483
mapping.connect([(inputnode_within, CFFConverter,[("subject_id","title")])])
484484

485485
"""

0 commit comments

Comments
 (0)