@@ -404,17 +404,17 @@ class GLMFitInputSpec(FSTraitedSpec):
404
404
mrtm1 = InputMultiPath (
405
405
traits .Tuple (File (exists = True ), File (exists = True )),
406
406
argstr = "--mrtm1 %s %s..." ,
407
- desc = "Reference time activity curve and frame times " ,
407
+ desc = "RefTac TimeSec : perform MRTM1 kinetic modeling " ,
408
408
)
409
409
mrtm2 = InputMultiPath (
410
410
traits .Tuple (File (exists = True ), File (exists = True ), traits .Float ),
411
411
argstr = "--mrtm2 %s %s %f..." ,
412
- desc = "Reference time activity curve, frame times and k2p " ,
412
+ desc = "RefTac TimeSec k2prime : perform MRTM2 kinetic modeling " ,
413
413
)
414
414
logan = InputMultiPath (
415
415
traits .Tuple (File (exists = True ), File (exists = True ), traits .Float ),
416
416
argstr = "--logan %s %s %f..." ,
417
- desc = "Reference time activity curve, frame times and tstar " ,
417
+ desc = "RefTac TimeSec tstar : perform Logan kinetic modeling " ,
418
418
)
419
419
force_perm = traits .Bool (
420
420
argstr = "--perm-force" ,
@@ -438,10 +438,9 @@ class GLMFitInputSpec(FSTraitedSpec):
438
438
sim_done_file = File (
439
439
argstr = "--sim-done %s" , desc = "create file when simulation finished"
440
440
)
441
- nii_gz = traits .Bool (
442
- argstr = '--nii.gz' ,
443
- desc = 'save outputs as nii.gz' ,
444
- )
441
+ _ext_xor = ['nii' , 'nii_gz' ]
442
+ nii = traits .Bool (argstr = '--nii' , desc = 'save outputs as nii' , xor = _ext_xor )
443
+ nii_gz = traits .Bool (argstr = '--nii.gz' , desc = 'save outputs as nii.gz' , xor = _ext_xor )
445
444
446
445
447
446
class GLMFitOutputSpec (TraitedSpec ):
@@ -463,6 +462,8 @@ class GLMFitOutputSpec(TraitedSpec):
463
462
frame_eigenvectors = File (desc = "matrix of frame eigenvectors from residual PCA" )
464
463
singular_values = File (desc = "matrix singular values from residual PCA" )
465
464
svd_stats_file = File (desc = "text file summarizing the residual PCA" )
465
+ k2p_file = File (desc = "estimate of k2p parameter" )
466
+ bp_file = File (desc = "Binding potential estimates" )
466
467
467
468
468
469
class GLMFit (FSCommand ):
@@ -497,22 +498,33 @@ def _list_outputs(self):
497
498
glmdir = os .path .abspath (self .inputs .glm_dir )
498
499
outputs ["glm_dir" ] = glmdir
499
500
501
+ if isdefined (self .inputs .nii_gz ):
502
+ ext = '.nii.gz'
503
+ if isdefined (self .inputs .nii ):
504
+ ext = '.nii'
505
+ else :
506
+ ext = '.mgh'
507
+
500
508
# Assign the output files that always get created
501
- outputs ["beta_file" ] = os .path .join (glmdir , "beta.mgh " )
502
- outputs ["error_var_file" ] = os .path .join (glmdir , "rvar.mgh " )
503
- outputs ["error_stddev_file" ] = os .path .join (glmdir , "rstd.mgh " )
504
- outputs ["mask_file" ] = os .path .join (glmdir , "mask.mgh " )
509
+ outputs ["beta_file" ] = os .path .join (glmdir , f "beta.{ ext } " )
510
+ outputs ["error_var_file" ] = os .path .join (glmdir , f "rvar.{ ext } " )
511
+ outputs ["error_stddev_file" ] = os .path .join (glmdir , f "rstd.{ ext } " )
512
+ outputs ["mask_file" ] = os .path .join (glmdir , f "mask.{ ext } " )
505
513
outputs ["fwhm_file" ] = os .path .join (glmdir , "fwhm.dat" )
506
514
outputs ["dof_file" ] = os .path .join (glmdir , "dof.dat" )
507
515
# Assign the conditional outputs
508
- if isdefined (self .inputs .save_residual ) and self .inputs .save_residual :
509
- outputs ["error_file" ] = os .path .join (glmdir , "eres.mgh" )
510
- if isdefined (self .inputs .save_estimate ) and self .inputs .save_estimate :
511
- outputs ["estimate_file" ] = os .path .join (glmdir , "yhat.mgh" )
516
+ if self .inputs .save_residual :
517
+ outputs ["error_file" ] = os .path .join (glmdir , "eres.{ext}" )
518
+ if self .inputs .save_estimate :
519
+ outputs ["estimate_file" ] = os .path .join (glmdir , "yhat.{ext}" )
520
+ if any ((self .inputs .mrtm1 , self .inputs .mrtm2 , self .inputs .logan )):
521
+ outputs ["bp_file" ] = os .path .join (glmdir , f"bp.{ ext } " )
522
+ if self .inputs .mrtm1 :
523
+ outputs ["k2p_file" ] = os .path .join (glmdir , "k2prime.dat" )
512
524
513
525
# Get the contrast directory name(s)
526
+ contrasts = []
514
527
if isdefined (self .inputs .contrast ):
515
- contrasts = []
516
528
for c in self .inputs .contrast :
517
529
if split_filename (c )[2 ] in [".mat" , ".dat" , ".mtx" , ".con" ]:
518
530
contrasts .append (split_filename (c )[1 ])
@@ -522,19 +534,19 @@ def _list_outputs(self):
522
534
contrasts = ["osgm" ]
523
535
524
536
# Add in the contrast images
525
- outputs ["sig_file" ] = [os .path .join (glmdir , c , "sig.mgh " ) for c in contrasts ]
526
- outputs ["ftest_file" ] = [os .path .join (glmdir , c , "F.mgh " ) for c in contrasts ]
537
+ outputs ["sig_file" ] = [os .path .join (glmdir , c , f "sig.{ ext } " ) for c in contrasts ]
538
+ outputs ["ftest_file" ] = [os .path .join (glmdir , c , f "F.{ ext } " ) for c in contrasts ]
527
539
outputs ["gamma_file" ] = [
528
- os .path .join (glmdir , c , "gamma.mgh " ) for c in contrasts
540
+ os .path .join (glmdir , c , f "gamma.{ ext } " ) for c in contrasts
529
541
]
530
542
outputs ["gamma_var_file" ] = [
531
- os .path .join (glmdir , c , "gammavar.mgh " ) for c in contrasts
543
+ os .path .join (glmdir , c , f "gammavar.{ ext } " ) for c in contrasts
532
544
]
533
545
534
546
# Add in the PCA results, if relevant
535
547
if isdefined (self .inputs .pca ) and self .inputs .pca :
536
548
pcadir = os .path .join (glmdir , "pca-eres" )
537
- outputs ["spatial_eigenvectors" ] = os .path .join (pcadir , "v.mgh " )
549
+ outputs ["spatial_eigenvectors" ] = os .path .join (pcadir , f "v.{ ext } " )
538
550
outputs ["frame_eigenvectors" ] = os .path .join (pcadir , "u.mtx" )
539
551
outputs ["singluar_values" ] = os .path .join (pcadir , "sdiag.mat" )
540
552
outputs ["svd_stats_file" ] = os .path .join (pcadir , "stats.dat" )
0 commit comments