@@ -245,145 +245,6 @@ def _overload_extension(self, value, name=None):
245
245
return value + Info .output_type_to_ext (self .inputs .output_type )
246
246
247
247
248
- class FSLXCommandInputSpec (FSLCommandInputSpec ):
249
- dwi = File (exists = True , argstr = '--data=%s' , mandatory = True ,
250
- desc = 'diffusion weighted image data file' )
251
- mask = File (exists = True , argstr = '--mask=%s' , mandatory = True ,
252
- desc = 'brain binary mask file (i.e. from BET)' )
253
- bvecs = File (exists = True , argstr = '--bvecs=%s' , mandatory = True ,
254
- desc = 'b vectors file' )
255
- bvals = File (exists = True , argstr = '--bvals=%s' , mandatory = True ,
256
- desc = 'b values file' )
257
-
258
- logdir = Directory ('.' , argstr = '--logdir=%s' , usedefault = True )
259
- n_fibres = traits .Range (low = 1 , argstr = '--nfibres=%d' , desc = ('Maximum '
260
- 'number of fibres to fit in each voxel' ))
261
- model = traits .Enum (1 , 2 , argstr = '--model=%d' ,
262
- desc = ('use monoexponential (1, default, required for '
263
- 'single-shell) or multiexponential (2, multi-'
264
- 'shell) model' ))
265
- fudge = traits .Int (argstr = '--fudge=%d' ,
266
- desc = 'ARD fudge factor' )
267
- n_jumps = traits .Int (5000 , argstr = '--njumps=%d' ,
268
- desc = 'Num of jumps to be made by MCMC' )
269
- burn_in = traits .Range (low = 0 , default = 0 , argstr = '--burnin=%d' ,
270
- desc = ('Total num of jumps at start of MCMC to be '
271
- 'discarded' ))
272
- burn_in_no_ard = traits .Range (low = 0 , default = 0 , argstr = '--burninnoard=%d' ,
273
- desc = ('num of burnin jumps before the ard is'
274
- ' imposed' ))
275
- sample_every = traits .Range (low = 0 , default = 1 , argstr = '--sampleevery=%d' ,
276
- desc = 'Num of jumps for each sample (MCMC)' )
277
- update_proposal_every = traits .Range (low = 1 , default = 40 ,
278
- argstr = '--updateproposalevery=%d' ,
279
- desc = ('Num of jumps for each update '
280
- 'to the proposal density std '
281
- '(MCMC)' ))
282
- seed = traits .Int (argstr = '--seed=%d' ,
283
- desc = 'seed for pseudo random number generator' )
284
-
285
- _xor_inputs1 = ('no_ard' , 'all_ard' )
286
- no_ard = traits .Bool (argstr = '--noard' , xor = _xor_inputs1 ,
287
- desc = 'Turn ARD off on all fibres' )
288
- all_ard = traits .Bool (argstr = '--allard' , xor = _xor_inputs1 ,
289
- desc = 'Turn ARD on on all fibres' )
290
-
291
- _xor_inputs2 = ('no_spat' , 'non_linear' , 'cnlinear' )
292
- no_spat = traits .Bool (argstr = '--nospat' , xor = _xor_inputs2 ,
293
- desc = 'Initialise with tensor, not spatially' )
294
- non_linear = traits .Bool (argstr = '--nonlinear' , xor = _xor_inputs2 ,
295
- desc = 'Initialise with nonlinear fitting' )
296
- cnlinear = traits .Bool (argstr = '--cnonlinear' , xor = _xor_inputs2 ,
297
- desc = ('Initialise with constrained nonlinear '
298
- 'fitting' ))
299
- rician = traits .Bool (argstr = '--rician' , desc = ('use Rician noise modeling' ))
300
-
301
- _xor_inputs3 = ['f0_noard' , 'f0_ard' ]
302
- f0_noard = traits .Bool (argstr = '--f0' , xor = _xor_inputs3 ,
303
- desc = ('Noise floor model: add to the model an '
304
- 'unattenuated signal compartment f0' ))
305
- f0_ard = traits .Bool (argstr = '--f0 --ardf0' , xor = _xor_inputs3 + ['all_ard' ],
306
- desc = ('Noise floor model: add to the model an '
307
- 'unattenuated signal compartment f0' ))
308
- force_dir = traits .Bool (True , argstr = '--forcedir' , usedefault = True ,
309
- desc = ('use the actual directory name given '
310
- '(do not add + to make a new directory)' ))
311
-
312
-
313
- class FSLXCommandOutputSpec (TraitedSpec ):
314
- dsamples = File (desc = ('Samples from the distribution on diffusivity d' ))
315
- d_stdsamples = File (desc = ('Std of samples from the distribution d' ))
316
- dyads = OutputMultiPath (File (), desc = ('Mean of PDD distribution'
317
- ' in vector form.' ))
318
- fsamples = OutputMultiPath (File (), desc = ('Samples from the '
319
- 'distribution on f anisotropy' ))
320
- mean_dsamples = File (desc = 'Mean of distribution on diffusivity d' )
321
- mean_d_stdsamples = File (desc = 'Mean of distribution on diffusivity d' )
322
- mean_fsamples = OutputMultiPath (File (), desc = ('Mean of '
323
- 'distribution on f anisotropy' ))
324
- mean_S0samples = File (desc = 'Mean of distribution on T2w'
325
- 'baseline signal intensity S0' )
326
- mean_tausamples = File (desc = 'Mean of distribution on '
327
- 'tau samples (only with rician noise)' )
328
- phsamples = OutputMultiPath (File (), desc = ('phi samples, per fiber' ))
329
- thsamples = OutputMultiPath (File (), desc = ('theta samples, per fiber' ))
330
-
331
-
332
- class FSLXCommand (FSLCommand ):
333
- """
334
- Base support for ``xfibres`` and ``bedpostx``
335
- """
336
- input_spec = FSLXCommandInputSpec
337
- output_spec = FSLXCommandOutputSpec
338
-
339
- def _run_interface (self , runtime ):
340
- self ._out_dir = os .getcwd ()
341
- runtime = super (FSLXCommand , self )._run_interface (runtime )
342
- if runtime .stderr :
343
- self .raise_exception (runtime )
344
- return runtime
345
-
346
- def _list_outputs (self ):
347
- outputs = self .output_spec ().get ()
348
- out_dir = self ._out_dir
349
-
350
- if isdefined (self .inputs .logdir ):
351
- out_dir = os .path .abspath (self .inputs .logdir )
352
- else :
353
- out_dir = os .path .abspath ('logdir' )
354
-
355
- multi_out = ['dyads' , 'fsamples' , 'mean_fsamples' ,
356
- 'phsamples' , 'thsamples' ]
357
- single_out = ['dsamples' , 'd_stdsamples' , 'mean_dsamples' ,
358
- 'mean_S0samples' , 'mean_d_stdsamples' ]
359
-
360
- for k in single_out :
361
- outputs [k ] = self ._gen_fname (k , cwd = out_dir )
362
-
363
- if isdefined (self .inputs .rician ) and self .inputs .rician :
364
- outputs ['mean_tausamples' ] = self ._gen_fname ('mean_tausamples' ,
365
- cwd = out_dir )
366
-
367
- for k in multi_out :
368
- outputs [k ] = []
369
-
370
- for i in xrange (self .inputs .n_fibres + 1 ):
371
- outputs ['fsamples' ].append (self ._gen_fname ('f%dsamples' % i ,
372
- cwd = out_dir ))
373
- outputs ['mean_fsamples' ].append (self ._gen_fname (('mean_f%d'
374
- 'samples' ) % i , cwd = out_dir ))
375
-
376
- for i in xrange (1 , self .inputs .n_fibres + 1 ):
377
- outputs ['dyads' ].append (self ._gen_fname ('dyads%d' % i ,
378
- cwd = out_dir ))
379
- outputs ['phsamples' ].append (self ._gen_fname ('ph%dsamples' % i ,
380
- cwd = out_dir ))
381
- outputs ['thsamples' ].append (self ._gen_fname ('th%dsamples' % i ,
382
- cwd = out_dir ))
383
-
384
- return outputs
385
-
386
-
387
248
def check_fsl ():
388
249
ver = Info .version ()
389
250
if ver :
0 commit comments