Skip to content

Commit af12bf7

Browse files
josephmjeeffigies
authored andcommitted
initial eddy update
1 parent 84d3ded commit af12bf7

File tree

1 file changed

+100
-102
lines changed

1 file changed

+100
-102
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 100 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ class EddyInputSpec(FSLCommandInputSpec):
587587
default_value="eddy_corrected",
588588
usedefault=True,
589589
argstr="--out=%s",
590-
desc="Basename for output image",
590+
desc="basename for output (warped) image",
591591
)
592592
session = File(
593593
exists=True,
@@ -598,41 +598,34 @@ class EddyInputSpec(FSLCommandInputSpec):
598598
exists=True,
599599
argstr="--topup=%s",
600600
requires=["in_topup_movpar"],
601-
desc="Topup results file containing the field coefficients",
601+
desc="topup file containing the field coefficients",
602602
)
603603
in_topup_movpar = File(
604-
exists=True,
605-
requires=["in_topup_fieldcoef"],
606-
desc="Topup results file containing the movement parameters (movpar.txt)",
604+
exists=True, requires=["in_topup_fieldcoef"], desc="topup movpar.txt file"
607605
)
608606
field = File(
609-
exists=True,
610607
argstr="--field=%s",
611-
desc="Non-topup derived fieldmap scaled in Hz",
608+
desc=(
609+
"NonTOPUP fieldmap scaled in Hz - filename has "
610+
"to be provided without an extension. TOPUP is "
611+
"strongly recommended"
612+
),
612613
)
613614
field_mat = File(
614615
exists=True,
615616
argstr="--field_mat=%s",
616-
desc="Matrix specifying the relative positions of "
617-
"the fieldmap, --field, and the first volume "
618-
"of the input file, --imain",
617+
desc=(
618+
"Matrix that specifies the relative locations of "
619+
"the field specified by --field and first volume "
620+
"in file --imain"
621+
),
619622
)
620623

621624
flm = traits.Enum(
622-
"quadratic",
623-
"linear",
624-
"cubic",
625-
usedefault=True,
626-
argstr="--flm=%s",
627-
desc="First level EC model",
625+
"linear", "quadratic", "cubic", argstr="--flm=%s", desc="First level EC model"
628626
)
629627
slm = traits.Enum(
630-
"none",
631-
"linear",
632-
"quadratic",
633-
usedefault=True,
634-
argstr="--slm=%s",
635-
desc="Second level EC model",
628+
"none", "linear", "quadratic", argstr="--slm=%s", desc="Second level EC model"
636629
)
637630
fep = traits.Bool(
638631
False, argstr="--fep", desc="Fill empty planes in x- or y-directions"
@@ -646,34 +639,33 @@ class EddyInputSpec(FSLCommandInputSpec):
646639
interp = traits.Enum(
647640
"spline",
648641
"trilinear",
649-
usedefault=True,
650642
argstr="--interp=%s",
651643
desc="Interpolation model for estimation step",
652644
)
653645
nvoxhp = traits.Int(
654646
default_value=1000,
655647
usedefault=True,
656648
argstr="--nvoxhp=%s",
657-
desc="# of voxels used to estimate the hyperparameters",
649+
desc=("# of voxels used to estimate the " "hyperparameters"),
658650
)
659651
fudge_factor = traits.Float(
660652
default_value=10.0,
661653
usedefault=True,
662654
argstr="--ff=%s",
663-
desc="Fudge factor for hyperparameter error variance",
655+
desc=("Fudge factor for hyperparameter " "error variance"),
664656
)
665657
dont_sep_offs_move = traits.Bool(
666658
False,
667659
argstr="--dont_sep_offs_move",
668-
desc="Do NOT attempt to separate field offset from subject movement",
660+
desc=("Do NOT attempt to separate " "field offset from subject " "movement"),
669661
)
670662
dont_peas = traits.Bool(
671663
False,
672664
argstr="--dont_peas",
673-
desc="Do NOT perform a post-eddy alignment of shells",
665+
desc="Do NOT perform a post-eddy alignment of " "shells",
674666
)
675667
fwhm = traits.Float(
676-
desc="FWHM for conditioning filter when estimating the parameters",
668+
desc=("FWHM for conditioning filter when estimating " "the parameters"),
677669
argstr="--fwhm=%s",
678670
)
679671
niter = traits.Int(
@@ -682,9 +674,8 @@ class EddyInputSpec(FSLCommandInputSpec):
682674
method = traits.Enum(
683675
"jac",
684676
"lsr",
685-
usedefault=True,
686677
argstr="--resamp=%s",
687-
desc="Final resampling method (jacobian/least squares)",
678+
desc=("Final resampling method (jacobian/least " "squares)"),
688679
)
689680

690681
repol = traits.Bool(
@@ -725,59 +716,57 @@ class EddyInputSpec(FSLCommandInputSpec):
725716
requires=["repol"],
726717
min_ver="5.0.10",
727718
)
728-
multiband_factor = traits.Int(
729-
argstr="--mb=%s", desc="Multi-band factor", min_ver="5.0.10"
730-
)
731-
multiband_offset = traits.Enum(
719+
mb = traits.Int(argstr="--mb=%s", desc="Multi-band factor", min_ver="5.0.10")
720+
mb_offs = traits.Enum(
732721
0,
733722
1,
734723
-1,
735-
argstr="--mb_offs=%d",
736-
desc="Multi-band offset (-1 if bottom slice removed, 1 if top slice removed",
737-
requires=["multiband_factor"],
724+
argstr="--mb_offs=%s",
725+
desc=(
726+
"Multi-band offset (-1 if bottom slice removed, 1 if " "top slice removed"
727+
),
728+
requires=["mb"],
738729
min_ver="5.0.10",
739730
)
740731

741732
mporder = traits.Int(
742733
argstr="--mporder=%s",
743734
desc="Order of slice-to-vol movement model",
744-
requires=["use_cuda"],
735+
requires=["slspec"],
745736
min_ver="5.0.11",
746737
)
747-
slice2vol_niter = traits.Int(
748-
argstr="--s2v_niter=%d",
738+
s2v_niter = traits.Int(
739+
argstr="--s2v_niter=%s",
749740
desc="Number of iterations for slice-to-vol",
750-
requires=["mporder"],
741+
requires=["slspec"],
751742
min_ver="5.0.11",
752743
)
753-
slice2vol_lambda = traits.Int(
754-
argstr="--s2v_lambda=%d",
744+
s2v_lambda = traits.Int(
745+
agstr="--s2v_lambda",
755746
desc="Regularisation weight for slice-to-vol movement (reasonable range 1-10)",
756-
requires=["mporder"],
747+
requires=["slspec"],
757748
min_ver="5.0.11",
758749
)
759-
slice2vol_interp = traits.Enum(
750+
s2v_interp = traits.Enum(
760751
"trilinear",
761752
"spline",
762753
argstr="--s2v_interp=%s",
763754
desc="Slice-to-vol interpolation model for estimation step",
764-
requires=["mporder"],
755+
requires=["slspec"],
765756
min_ver="5.0.11",
766757
)
767-
slice_order = traits.File(
758+
slspec = traits.File(
768759
exists=True,
769760
argstr="--slspec=%s",
770761
desc="Name of text file completely specifying slice/group acquisition",
771-
requires=["mporder"],
772762
xor=["json"],
773763
min_ver="5.0.11",
774764
)
775765
json = traits.File(
776766
exists=True,
777767
argstr="--json=%s",
778768
desc="Name of .json text file with information about slice timing",
779-
requires=["mporder"],
780-
xor=["slice_order"],
769+
xor=["slspec"],
781770
min_ver="6.0.1",
782771
)
783772

@@ -812,9 +801,11 @@ class EddyInputSpec(FSLCommandInputSpec):
812801
is_shelled = traits.Bool(
813802
False,
814803
argstr="--data_is_shelled",
815-
desc="Override internal check to ensure that "
816-
"date are acquired on a set of b-value "
817-
"shells",
804+
desc=(
805+
"Override internal check to ensure that "
806+
"date are acquired on a set of b-value "
807+
"shells"
808+
),
818809
)
819810

820811
use_cuda = traits.Bool(False, desc="Run eddy using cuda gpu")
@@ -832,8 +823,9 @@ class EddyOutputSpec(TraitedSpec):
832823
)
833824
out_parameter = File(
834825
exists=True,
835-
desc="Text file with parameters defining the field and"
836-
"movement for each scan",
826+
desc=(
827+
"Text file with parameters defining the field and" "movement for each scan"
828+
),
837829
)
838830
out_rotated_bvecs = File(
839831
exists=True, desc="File containing rotated b-values for all volumes"
@@ -848,56 +840,74 @@ class EddyOutputSpec(TraitedSpec):
848840
)
849841
out_shell_alignment_parameters = File(
850842
exists=True,
851-
desc="Text file containing rigid body movement parameters "
852-
"between the different shells as estimated by a "
853-
"post-hoc mutual information based registration",
843+
desc=(
844+
"Text file containing rigid body movement parameters "
845+
"between the different shells as estimated by a "
846+
"post-hoc mutual information based registration"
847+
),
854848
)
855849
out_shell_pe_translation_parameters = File(
856850
exists=True,
857-
desc="Text file containing translation along the PE-direction "
858-
"between the different shells as estimated by a "
859-
"post-hoc mutual information based registration",
851+
desc=(
852+
"Text file containing translation along the PE-direction "
853+
"between the different shells as estimated by a "
854+
"post-hoc mutual information based registration"
855+
),
860856
)
861857
out_shell_pe_translation_parameters = File(
862858
exists=True,
863-
desc="Text file containing translation along the PE-direction "
864-
"between the different shells as estimated by a "
865-
"post-hoc mutual information based registration",
859+
desc=(
860+
"Text file containing translation along the PE-direction "
861+
"between the different shells as estimated by a "
862+
"post-hoc mutual information based registration"
863+
),
866864
)
867865
out_outlier_map = File(
868866
exists=True,
869-
desc="Matrix where rows represent volumes and columns represent "
870-
'slices. "0" indicates that scan-slice is not an outlier '
871-
'and "1" indicates that it is',
867+
desc=(
868+
"Matrix where rows represent volumes and columns represent "
869+
'slices. "0" indicates that scan-slice is not an outlier '
870+
'and "1" indicates that it is'
871+
),
872872
)
873873
out_outlier_n_stdev_map = File(
874874
exists=True,
875-
desc="Matrix where rows represent volumes and columns represent "
876-
"slices. Values indicate number of standard deviations off the "
877-
"mean difference between observation and prediction is",
875+
desc=(
876+
"Matrix where rows represent volumes and columns represent "
877+
"slices. Values indicate number of standard deviations off the "
878+
"mean difference between observation and prediction is"
879+
),
878880
)
879881
out_outlier_n_sqr_stdev_map = File(
880882
exists=True,
881-
desc="Matrix where rows represent volumes and columns represent "
882-
"slices. Values indicate number of standard deivations off the "
883-
"square root of the mean squared difference between observation "
884-
"and prediction is",
883+
desc=(
884+
"Matrix where rows represent volumes and columns represent "
885+
"slices. Values indicate number of standard deivations off the "
886+
"square root of the mean squared difference between observation "
887+
"and prediction is"
888+
),
885889
)
886890
out_outlier_report = File(
887891
exists=True,
888-
desc="Text file with a plain language report on what "
889-
"outlier slices eddy has found",
892+
desc=(
893+
"Text file with a plain language report on what "
894+
"outlier slices eddy has found"
895+
),
890896
)
891897
out_outlier_free = File(
892898
exists=True,
893-
desc="4D image file not corrected for susceptibility or eddy-"
894-
"current distortions or subject movement but with outlier "
895-
"slices replaced",
899+
desc=(
900+
"4D image file not corrected for susceptibility or eddy-"
901+
"current distortions or subject movement but with outlier "
902+
"slices replaced"
903+
),
896904
)
897905
out_movement_over_time = File(
898906
exists=True,
899-
desc="Text file containing translations (mm) and rotations "
900-
"(radians) for each excitation",
907+
desc=(
908+
"Text file containing translations (mm) and rotations "
909+
"(radians) for each excitation"
910+
),
901911
)
902912
out_cnr_maps = File(exists=True, desc="path/name of file with the cnr_maps")
903913
out_residuals = File(exists=True, desc="path/name of file with the residuals")
@@ -934,27 +944,15 @@ class Eddy(FSLCommand):
934944
Running eddy on an Nvidia GPU using cuda:
935945
>>> eddy.inputs.use_cuda = True
936946
>>> eddy.cmdline # doctest: +ELLIPSIS
937-
'eddy_cuda --flm=quadratic --ff=10.0 \
938-
--acqp=epi_acqp.txt --bvals=bvals.scheme --bvecs=bvecs.scheme \
939-
--imain=epi.nii --index=epi_index.txt --mask=epi_mask.nii \
940-
--interp=spline --resamp=jac --niter=5 --nvoxhp=1000 \
941-
--out=.../eddy_corrected --slm=none'
942-
943-
Running eddy with slice-to-volume motion correction:
944-
>>> eddy.inputs.mporder = 6
945-
>>> eddy.inputs.slice2vol_niter = 5
946-
>>> eddy.inputs.slice2vol_lambda = 1
947-
>>> eddy.inputs.slice2vol_interp = 'trilinear'
948-
>>> eddy.inputs.slice_order = 'epi_slspec.txt'
949-
>>> eddy.cmdline # doctest: +ELLIPSIS
950-
'eddy_cuda --flm=quadratic --ff=10.0 \
951-
--acqp=epi_acqp.txt --bvals=bvals.scheme --bvecs=bvecs.scheme \
952-
--imain=epi.nii --index=epi_index.txt --mask=epi_mask.nii \
953-
--interp=spline --resamp=jac --mporder=6 --niter=5 --nvoxhp=1000 \
954-
--out=.../eddy_corrected --s2v_interp=trilinear --s2v_lambda=1 \
955-
--s2v_niter=5 --slspec=epi_slspec.txt --slm=none'
956-
>>> res = eddy.run() # doctest: +SKIP
957-
947+
'eddy_cuda --ff=10.0 --fwhm=0 --acqp=epi_acqp.txt --bvals=bvals.scheme \
948+
--bvecs=bvecs.scheme --imain=epi.nii --index=epi_index.txt \
949+
--mask=epi_mask.nii --niter=5 --nvoxhp=1000 --out=.../eddy_corrected'
950+
>>> eddy.inputs.use_cuda = False
951+
>>> eddy.cmdline # doctest: +ELLIPSIS
952+
'eddy_openmp --ff=10.0 --fwhm=0 --acqp=epi_acqp.txt --bvals=bvals.scheme \
953+
--bvecs=bvecs.scheme --imain=epi.nii --index=epi_index.txt \
954+
--mask=epi_mask.nii --niter=5 --nvoxhp=1000 --out=.../eddy_corrected'
955+
>>> res = eddy.run() # doctest: +SKIP
958956
"""
959957

960958
_cmd = "eddy_openmp"

0 commit comments

Comments
 (0)