@@ -230,7 +230,7 @@ def _list_outputs(self):
230
230
return outputs
231
231
232
232
233
- class ProbTrackXInputSpec (FSLCommandInputSpec ):
233
+ class ProbTrackXBaseInputSpec (FSLCommandInputSpec ):
234
234
thsamples = InputMultiPath (File (exists = True ), mandatory = True )
235
235
phsamples = InputMultiPath (File (exists = True ), mandatory = True )
236
236
fsamples = InputMultiPath (File (exists = True ), mandatory = True )
@@ -243,21 +243,13 @@ class ProbTrackXInputSpec(FSLCommandInputSpec):
243
243
desc = 'seed volume(s), or voxel(s)' +
244
244
'or freesurfer label file' ,
245
245
argstr = '--seed=%s' , mandatory = True )
246
- mode = traits .Enum ("simple" , "two_mask_symm" , "seedmask" ,
247
- desc = 'options: simple (single seed voxel), seedmask (mask of seed voxels), '
248
- + 'twomask_symm (two bet binary masks) ' ,
249
- argstr = '--mode=%s' , genfile = True )
250
246
target_masks = InputMultiPath (File (exits = True ), desc = 'list of target masks - ' +
251
247
'required for seeds_to_targets classification' , argstr = '--targetmasks=%s' )
252
- mask2 = File (exists = True , desc = 'second bet binary mask (in diffusion space) in twomask_symm mode' ,
253
- argstr = '--mask2=%s' )
254
248
waypoints = File (exists = True , desc = 'waypoint mask or ascii list of waypoint masks - ' +
255
249
'only keep paths going through ALL the masks' , argstr = '--waypoints=%s' )
256
250
network = traits .Bool (desc = 'activate network mode - only keep paths going through ' +
257
251
'at least one seed mask (required if multiple seed masks)' ,
258
252
argstr = '--network' )
259
- mesh = File (exists = True , desc = 'Freesurfer-type surface descriptor (in ascii format)' ,
260
- argstr = '--mesh=%s' )
261
253
seed_ref = File (exists = True , desc = 'reference vol to define seed space in ' +
262
254
'simple mode - diffusion space assumed if absent' ,
263
255
argstr = '--seedref=%s' )
@@ -307,6 +299,15 @@ class ProbTrackXInputSpec(FSLCommandInputSpec):
307
299
"Level 2 is required to output particle files." ,
308
300
argstr = "--verbose=%d" )
309
301
302
+ class ProbTrackXInputSpec (ProbTrackXBaseInputSpec ):
303
+ mode = traits .Enum ("simple" , "two_mask_symm" , "seedmask" ,
304
+ desc = 'options: simple (single seed voxel), seedmask (mask of seed voxels), '
305
+ + 'twomask_symm (two bet binary masks) ' ,
306
+ argstr = '--mode=%s' , genfile = True )
307
+ mask2 = File (exists = True , desc = 'second bet binary mask (in diffusion space) in twomask_symm mode' ,
308
+ argstr = '--mask2=%s' )
309
+ mesh = File (exists = True , desc = 'Freesurfer-type surface descriptor (in ascii format)' ,
310
+ argstr = '--mesh=%s' )
310
311
311
312
class ProbTrackXOutputSpec (TraitedSpec ):
312
313
log = File (exists = True , desc = 'path/name of a text record of the command that was run' )
@@ -320,7 +321,6 @@ class ProbTrackXOutputSpec(TraitedSpec):
320
321
'all of the tract samples. Generated only if ' +
321
322
'verbose is set to 2' )
322
323
323
-
324
324
class ProbTrackX (FSLCommand ):
325
325
""" Use FSL probtrackx for tractography on bedpostx results
326
326
@@ -435,6 +435,96 @@ def _gen_filename(self, name):
435
435
else :
436
436
return "seedmask"
437
437
438
+ class ProbTrackX2InputSpec (ProbTrackXBaseInputSpec ):
439
+ simple = traits .Bool (desc = 'rack from a list of voxels (seed must be a ASCII list of coordinates)' ,
440
+ usedefault = False , argstr = '--simple' )
441
+ fopd = File (exists = True , desc = 'Other mask for binning tract distribution' ,
442
+ argstr = '--fopd=%s' )
443
+ waycond = traits .Enum ("OR" , "AND" , argstr = '--waycond=%s' ,
444
+ desc = 'Waypoint condition. Either "AND" (default) or "OR"' )
445
+ wayorder = traits .Bool (desc = 'Reject streamlines that do not hit waypoints in given order. ' +
446
+ 'Only valid if waycond=AND' , argstr = '--wayorder' )
447
+ onewaycondition = traits .Bool (desc = 'Apply waypoint conditions to each half tract separately' ,
448
+ argstr = '--onewaycondition' )
449
+ omatrix1 = traits .Bool (desc = 'Output matrix1 - SeedToSeed Connectivity' ,
450
+ argstr = '--omatrix1' )
451
+ distthresh1 = traits .Float (argstr = '--distthresh1=%.3f' ,
452
+ desc = 'Discards samples (in matrix1) shorter than this threshold ' +
453
+ '(in mm - default=0)' )
454
+ omatrix2 = traits .Bool (desc = 'Output matrix2 - SeedToLowResMask' , argstr = '--omatrix2' , requires = ['target2' ])
455
+ target2 = File (exists = True , desc = 'Low resolution binary brain mask for storing ' +
456
+ 'connectivity distribution in matrix2 mode' , argstr = '--target2=%s' )
457
+ omatrix3 = traits .Bool (desc = 'Output matrix3 (NxN connectivity matrix)' , argstr = '--omatrix3' ,
458
+ requires = ['target3' , 'lrtarget3' ])
459
+ target3 = File (exists = True , desc = 'Mask used for NxN connectivity matrix ' +
460
+ '(or Nxn if lrtarget3 is set)' , argstr = '--target3=%s' )
461
+ lrtarget3 = File (exists = True , desc = 'Column-space mask used for Nxn connectivity matrix' ,
462
+ argstr = '--lrtarget3=%s' )
463
+ distthresh3 = traits .Float (argstr = '--distthresh3=%.3f' ,
464
+ desc = 'Discards samples (in matrix3) shorter than this threshold ' +
465
+ '(in mm - default=0)' )
466
+ omatrix4 = traits .Bool (desc = 'Output matrix4 - DtiMaskToSeed (special Oxford Sparse Format)' ,
467
+ argstr = '--omatrix4' )
468
+ colmask4 = File (exists = True , desc = 'Mask for columns of matrix4 (default=seed mask)' ,
469
+ argstr = '--colmask4=%s' )
470
+ target4 = File (exists = True , desc = 'Brain mask in DTI space' , argstr = '--target4=%s' )
471
+ meshspace = traits .Enum ("caret" , "freesurfer" , "first" , "vox" , argstr = '--meshspace=%s' ,
472
+ desc = 'Mesh reference space - either "caret" (default) or ' +
473
+ '"freesurfer" or "first" or "vox"' )
474
+
475
+
476
+ class ProbTrackX2OutputSpec (ProbTrackXOutputSpec ):
477
+ network_matrix = File (exists = True , desc = 'the network matrix generated by --omatrix1 option' )
478
+ matrix1_dot = File (exists = True , desc = 'Output matrix1.dot - SeedToSeed Connectivity' )
479
+ lookup_tractspace = File (exists = True , desc = 'lookup_tractspace generated by --omatrix2 option' )
480
+ matrix2_dot = File (exists = True , desc = 'Output matrix2.dot - SeedToLowResMask' )
481
+ matrix3_dot = File (exists = True , desc = 'Output matrix3 - NxN connectivity matrix' )
482
+
483
+
484
+ class ProbTrackX2 (ProbTrackX ):
485
+ """ Use FSL probtrackx2 for tractography on bedpostx results
486
+
487
+ Examples
488
+ --------
489
+
490
+ >>> from nipype.interfaces import fsl
491
+ >>> pbx2 = fsl.ProbTrackX2()
492
+ >>> pbx2.inputs.seed = 'seed_source.nii.gz'
493
+ >>> pbx2.inputs.thsamples = 'merged_th1samples.nii.gz'
494
+ >>> pbx2.inputs.fsamples = 'merged_f1samples.nii.gz'
495
+ >>> pbx2.inputs.phsamples = 'merged_ph1samples.nii.gz'
496
+ >>> pbx2.inputs.mask = 'nodif_brain_mask.nii.gz'
497
+ >>> pbx2.inputs.out_dir = '.'
498
+ >>> pbx2.inputs.n_samples = 3
499
+ >>> pbx2.inputs.n_steps = 10
500
+ >>> pbx2.cmdline
501
+ 'probtrackx2 --forcedir -m nodif_brain_mask.nii.gz --nsamples=3 --nsteps=10 --opd --dir=. --samples=merged --seed=seed_source.nii.gz'
502
+ """
503
+ _cmd = 'probtrackx2'
504
+ input_spec = ProbTrackX2InputSpec
505
+ output_spec = ProbTrackX2OutputSpec
506
+
507
+ def _list_outputs (self ):
508
+ outputs = super (ProbTrackX2 , self )._list_outputs ()
509
+
510
+ if not isdefined (self .inputs .out_dir ):
511
+ out_dir = os .getcwd ()
512
+ else :
513
+ out_dir = self .inputs .out_dir
514
+
515
+ if isdefined (self .inputs .omatrix1 ):
516
+ outputs ['network_matrix' ] = os .path .abspath (os .path .join (out_dir , 'fdt_network_matrix' ))
517
+ outputs ['matrix1_dot' ] = os .path .abspath (os .path .join (out_dir , 'fdt_matrix1.dot' ))
518
+
519
+ if isdefined (self .inputs .omatrix2 ):
520
+ outputs ['lookup_tractspace' ] = \
521
+ os .path .abspath (os .path .join (out_dir , 'lookup_tractspace_fdt_matrix2.nii.gz' ))
522
+ outputs ['matrix2_dot' ] = os .path .abspath (os .path .join (out_dir , 'fdt_matrix2.dot' ))
523
+
524
+ if isdefined (self .inputs .omatrix3 ):
525
+ outputs ['matrix3_dot' ] = os .path .abspath (os .path .join (out_dir , 'fdt_matrix3.dot' ))
526
+ return outputs
527
+
438
528
439
529
class VecRegInputSpec (FSLCommandInputSpec ):
440
530
in_file = File (exists = True , argstr = '-i %s' , desc = 'filename for input vector or tensor field' ,
0 commit comments