@@ -46,7 +46,7 @@ class PrepareFieldmapInputSpec(FSLCommandInputSpec):
46
46
usedefault = True ,
47
47
desc = ('do not perform sanity checks for image '
48
48
'size/range/dimensions' ))
49
- out_fieldmap = File (argstr = '%s' , position = 5 ,
49
+ out_fieldmap = File (argstr = '%s' , position = 4 ,
50
50
desc = 'output name for prepared fieldmap' )
51
51
52
52
@@ -534,6 +534,129 @@ def _gen_filename(self, name):
534
534
return self ._list_outputs ()['out_file' ]
535
535
return None
536
536
537
+
538
+ class EpiRegInputSpec (FSLCommandInputSpec ):
539
+ epi = File (exists = True , argstr = '--epi=%s' , mandatory = True ,
540
+ position = - 4 , desc = 'EPI image' )
541
+ t1_head = File (exists = True , argstr = '--t1=%s' , mandatory = True ,
542
+ position = - 3 , desc = 'wholehead T1 image' )
543
+ t1_brain = File (exists = True , argstr = '--t1brain=%s' , mandatory = True ,
544
+ position = - 2 , desc = 'brain extracted T1 image' )
545
+ out_base = traits .String (desc = 'output base name' , argstr = '--out=%s' ,
546
+ position = - 1 )
547
+ fmap = File (exists = True , argstr = '--fmap=%s' ,
548
+ desc = 'fieldmap image (in rad/s)' )
549
+ fmapmag = File (exists = True , argstr = '--fmapmag=%s' ,
550
+ desc = 'fieldmap magnitude image - wholehead' )
551
+ fmapmagbrain = File (exists = True , argstr = '--fmapmagbrain=%s' ,
552
+ desc = 'fieldmap magnitude image - brain extracted' )
553
+ wmseg = File (exists = True , argstr = '--wmseg=%s' ,
554
+ desc = 'white matter segmentation of T1 image, has to be named \
555
+ like the t1brain and end on _wmseg' )
556
+ echospacing = traits .Float (argstr = '--echospacing=%f' ,
557
+ desc = 'Effective EPI echo spacing \
558
+ (sometimes called dwell time) - in seconds' )
559
+ pedir = traits .Enum ('x' , 'y' , 'z' , '-x' , '-y' , '-z' , argstr = '--pedir=%s' ,
560
+ desc = 'phase encoding direction, dir = x/y/z/-x/-y/-z' )
561
+
562
+ weight_image = File (exists = True , argstr = '--weight=%s' ,
563
+ desc = 'weighting image (in T1 space)' )
564
+ no_fmapreg = traits .Bool (False , argstr = '--nofmapreg' ,
565
+ desc = 'do not perform registration of fmap to T1 \
566
+ (use if fmap already registered)' )
567
+ no_clean = traits .Bool (False , argstr = '--noclean' ,
568
+ desc = 'do not clean up intermediate files' )
569
+
570
+
571
+ class EpiRegOutputSpec (TraitedSpec ):
572
+ out_file = File (exists = True ,
573
+ desc = 'unwarped and coregistered epi input' )
574
+ out_1vol = File (exists = True ,
575
+ desc = 'unwarped and coregistered single volume' )
576
+ fmap2str_mat = File (exists = True ,
577
+ desc = 'rigid fieldmap-to-structural transform' )
578
+ fmap2epi_mat = File (exists = True ,
579
+ desc = 'rigid fieldmap-to-epi transform' )
580
+ fmap_epi = File (exists = True , desc = 'fieldmap in epi space' )
581
+ fmap_str = File (exists = True , desc = 'fieldmap in structural space' )
582
+ fmapmag_str = File (exists = True ,
583
+ desc = 'fieldmap magnitude image in structural space' )
584
+ epi2str_inv = File (exists = True ,
585
+ desc = 'rigid structural-to-epi transform' )
586
+ epi2str_mat = File (exists = True ,
587
+ desc = 'rigid epi-to-structural transform' )
588
+ shiftmap = File (exists = True , desc = 'shiftmap in epi space' )
589
+ fullwarp = File (exists = True ,
590
+ desc = 'warpfield to unwarp epi and transform into \
591
+ structural space' )
592
+ wmseg = File (exists = True , desc = 'white matter segmentation used in flirt bbr' )
593
+ wmedge = File (exists = True , desc = 'white matter edges for visualization' )
594
+
595
+
596
+ class EpiReg (FSLCommand ):
597
+ """
598
+
599
+ Runs FSL epi_reg script for simultaneous coregistration and fieldmap
600
+ unwarping.
601
+
602
+ Examples
603
+ --------
604
+
605
+ >>> from nipype.interfaces.fsl import EpiReg
606
+ >>> epireg = EpiReg()
607
+ >>> epireg.inputs.epi='epi.nii'
608
+ >>> epireg.inputs.t1_head='T1.nii'
609
+ >>> epireg.inputs.t1_brain='T1_brain.nii'
610
+ >>> epireg.inputs.out_base='epi2struct'
611
+ >>> epireg.inputs.fmap='fieldmap_phase_fslprepared.nii'
612
+ >>> epireg.inputs.fmapmag='fieldmap_mag.nii'
613
+ >>> epireg.inputs.fmapmagbrain='fieldmap_mag_brain.nii'
614
+ >>> epireg.inputs.echospacing=0.00067
615
+ >>> epireg.inputs.pedir='y'
616
+ >>> epireg.cmdline #doctest: +ELLIPSIS
617
+ 'epi_reg --echospacing=0.000670 --fmap=fieldmap_phase_fslprepared.nii \
618
+ --fmapmag=fieldmap_mag.nii --fmapmagbrain=fieldmap_mag_brain.nii --pedir=y \
619
+ --epi=epi.nii --t1=T1.nii --t1brain=T1_brain.nii --out=epi2struct'
620
+ >>> epireg.run() # doctest: +SKIP
621
+
622
+ """
623
+ _cmd = 'epi_reg'
624
+ input_spec = EpiRegInputSpec
625
+ output_spec = EpiRegOutputSpec
626
+
627
+ def _list_outputs (self ):
628
+ outputs = self .output_spec ().get ()
629
+ outputs ['out_file' ] = os .path .join (os .getcwd (),
630
+ self .inputs .out_base + '.nii.gz' )
631
+ outputs ['out_1vol' ] = os .path .join (os .getcwd (),
632
+ self .inputs .out_base + '_1vol.nii.gz' )
633
+ outputs ['fmap2str_mat' ] = os .path .join (os .getcwd (),
634
+ self .inputs .out_base + '_fieldmap2str.mat' )
635
+ outputs ['fmap2epi_mat' ] = os .path .join (os .getcwd (),
636
+ self .inputs .out_base + '_fieldmaprads2epi.mat' )
637
+ outputs ['fmap_epi' ] = os .path .join (os .getcwd (),
638
+ self .inputs .out_base + '_fieldmaprads2epi.nii.gz' )
639
+ outputs ['fmap_str' ] = os .path .join (os .getcwd (),
640
+ self .inputs .out_base + '_fieldmaprads2str.nii.gz' )
641
+ outputs ['fmapmag_str' ] = os .path .join (os .getcwd (),
642
+ self .inputs .out_base + '_fieldmap2str.nii.gz' )
643
+ outputs ['epi2str_inv' ] = os .path .join (os .getcwd (),
644
+ self .inputs .out_base + '_inv.mat' )
645
+ outputs ['epi2str_mat' ] = os .path .join (os .getcwd (),
646
+ self .inputs .out_base + '.mat' )
647
+ outputs ['shiftmap' ] = os .path .join (os .getcwd (),
648
+ self .inputs .out_base + '_fieldmaprads2epi_shift.nii.gz' )
649
+ outputs ['fullwarp' ] = os .path .join (os .getcwd (),
650
+ self .inputs .out_base + '_warp.nii.gz' )
651
+ outputs ['wmedge' ] = os .path .join (os .getcwd (),
652
+ self .inputs .out_base + '_fast_wmedge.nii.gz' )
653
+ outputs ['wmseg' ] = os .path .join (os .getcwd (),
654
+ self .inputs .out_base + '_fast_wmseg.nii.gz' )
655
+
656
+ return outputs
657
+
658
+
659
+
537
660
#######################################
538
661
# deprecated interfaces
539
662
#######################################
0 commit comments