Example #1
0
File: reg.py Project: a3sha2/oxasl
    def groups(self, parser):
        groups = []

        group = IgnorableOptionGroup(parser,
                                     "Registration",
                                     ignore=self.ignore)
        group.add_option(
            "--regfrom",
            help="Registration image (e.g. perfusion weighted image)",
            type="image")
        #group.add_option("--omat", help="Output file for transform matrix", default=None)
        #group.add_option("--bbr", dest="do_bbr", help="Include BBR registration step using EPI_REG", action="store_true", default=False)
        #group.add_option("--flirt", dest="do_flirt", help="Include rigid-body registration step using FLIRT", action="store_true", default=True)
        #group.add_option("--flirtsch", help="user-specified FLIRT schedule for registration")
        groups.append(group)

        #group = IgnorableOptionGroup(parser, "Extra BBR registration refinement", ignore=self.ignore)
        #group.add_option("-c", dest="cfile", help="ASL control/calibration image for initial registration - brain extracted")
        #group.add_option("--wm_seg", dest="wm_seg", help="tissue segmenation image for bbr (in structural image space)")
        #groups.append(group)

        #group = IgnorableOptionGroup(parser, "Distortion correction using fieldmap (see epi_reg)", ignore=self.ignore)
        #g.add_option("--nofmapreg", dest="nofmapreg", help="do not perform registration of fmap to T1 (use if fmap already registered)", action="store_true", default=False)
        #groups.append(group)

        #group = IgnorableOptionGroup(parser, "Deprecated", ignore=self.ignore)
        #g.add_option("-r", dest="lowstruc", help="extra low resolution structural image - brain extracted")
        #g.add_option("--inweight", dest="inweight", help="specify weights for input image - same functionality as the flirt -inweight option", type="float")
        #groups.append(group)

        return groups
Example #2
0
    def groups(self, parser):
        groups = []

        group = IgnorableOptionGroup(parser, "BASIL options", ignore=self.ignore)
        group.add_option("--infertau", help="Infer bolus duration", action="store_true", default=False)
        group.add_option("--inferart", help="Infer macro vascular (arterial) signal component (not supported for multi-TE data)", action="store_true", default=False)
        group.add_option("--inferpc", help="Infer pre-capillary signal component (not supported for multi-TE data)", action="store_true", default=False)
        group.add_option("--infert1", help="Include uncertainty in T1 values", action="store_true", default=False)
        group.add_option("--infertexch", help="Infer exchange time (multi-TE data only)", action="store_true", default=False)
        group.add_option("--artonly", help="Remove tissue component and infer only arterial component (not supported for multi-TE data)", action="store_true", default=False)
        group.add_option("--fixbat", help="Fix bolus arrival time", action="store_false", default=True)
        group.add_option("--batsd", help="Bolus arrival time standard deviation (s) - default 1.0 for multi-PLD, 0.1 otherwise", type=float)
        group.add_option("--spatial", help="Add step that implements adaptive spatial smoothing on CBF", action="store_true", default=False)
        group.add_option("--fast", help="Faster analysis (1=faster, 2=single step", type=int, default=0)
        group.add_option("--noiseprior", help="Use an informative prior for the noise estimation", action="store_true", default=False)
        group.add_option("--noisesd", help="Set a custom noise std. dev. for the nosie prior", type=float)
        group.add_option("--basil-options", "--fit-options", help="File containing additional options for model fitting step", type="optfile")
        groups.append(group)

        group = IgnorableOptionGroup(parser, "Model options", ignore=self.ignore)
        group.add_option("--disp", help="Model for label dispersion", default="none")
        group.add_option("--exch", help="Model for tissue exchange (residue function)", default="mix")
        groups.append(group)

        group = IgnorableOptionGroup(parser, "Partial volume correction / CBF estimation (enforces --spatial)", ignore=self.ignore)
        group.add_option("--pgm", help="Gray matter PV map", type="image")
        group.add_option("--pwm", help="White matter PV map", type="image")
        groups.append(group)

        group = IgnorableOptionGroup(parser, "Special options", ignore=self.ignore)
        group.add_option("--t1im", help="Voxelwise T1 tissue estimates", type="image")
        group.add_option("--batim", "--attim", help="Voxelwise BAT (ATT) estimates in seconds", type="image")
        groups.append(group)

        return groups
Example #3
0
    def groups(self, parser):
        group = IgnorableOptionGroup(parser, "ENABLE options", ignore=self.ignore)
        group.add_option("--noise", "-n", dest="noise_roi", help="Noise ROI. If not specified, will run BET on structural image and invert the brain mask", type="image")
        group.add_option("--noise-from-struc", help="If specified, noise ROI is assumed to be in structural image space and will be registered to ASL space", action="store_true", default=False)
        group.add_option("--gm", dest="gm_roi", help="Grey matter ROI. If not specified, FAST will be run on the structural image", type="image")
        group.add_option("--gm-from-struc", help="If specified, GM ROI is assumed to be in T1 image space and will be registered to ASL space", action="store_true", default=False)
        group.add_option("--regfrom", help="Reference image in ASL space for registration and motion correction. If not specified will use middle volume of ASL data", type="image")
        group.add_option("--min-nvols", help="Minimum number of repeats to keep for each TI", type="int", default=6)

        return [group]
Example #4
0
 def groups(self, parser):
     group = IgnorableOptionGroup(parser,
                                  "Preprocessing",
                                  ignore=self.ignore)
     group.add_option("--diff",
                      help="Perform tag-control subtraction",
                      action="store_true",
                      default=False)
     group.add_option("--smooth",
                      help="Spatially smooth data",
                      action="store_true",
                      default=False)
     group.add_option("--fwhm",
                      help="FWHM for spatial filter kernel",
                      type="float",
                      default=6)
     group.add_option("--mc",
                      help="Motion correct data",
                      action="store_true",
                      default=False)
     group.add_option("--ref",
                      help="Optional reference image for motion correction",
                      type="image",
                      default=None)
     group.add_option("--reorder", help="Re-order data in specified order")
     return [
         group,
     ]
Example #5
0
    def groups(self, parser):
        ret = []
        g = IgnorableOptionGroup(parser, "General Pipeline Options")
        g.add_option(
            "--wp",
            help=
            "Analysis which conforms to the 'white papers' (Alsop et al 2014)",
            action="store_true",
            default=False)
        g.add_option("--mc",
                     help="Motion correct data",
                     action="store_true",
                     default=False)
        if oxasl_enable:
            g.add_option("--use-enable",
                         help="Use ENABLE preprocessing step",
                         action="store_true",
                         default=False)
        ret.append(g)

        g = IgnorableOptionGroup(parser, "Model fitting options")
        g.add_option("--fixbat",
                     dest="inferbat",
                     help="Fix bolus arrival time",
                     action="store_false",
                     default=True)
        g.add_option(
            "--batsd",
            help=
            "Bolus arrival time standard deviation (s) - default 1.0 for multi-PLD, 0.1 otherwise",
            type=float)
        g.add_option("--fixbolus",
                     "--fixtau",
                     dest="infertau",
                     help="Fix bolus duration",
                     action="store_false")
        g.add_option("--art-off",
                     "--artoff",
                     dest="inferart",
                     help="Do not infer arterial component",
                     action="store_false",
                     default=True)
        g.add_option("--spatial-off",
                     "--spatialoff",
                     dest="spatial",
                     help="Do not include adaptive spatial smoothing on CBF",
                     action="store_false",
                     default=True)
        g.add_option("--infertexch",
                     help="Infer exchange time (multi-TE data only)",
                     action="store_true",
                     default=False)
        g.add_option("--infert1",
                     help="Infer T1 value",
                     action="store_true",
                     default=False)
        g.add_option("--infert2",
                     help="Infer T2 value (multi-TE data only)",
                     action="store_true",
                     default=False)
        g.add_option("--t1im",
                     help="Voxelwise T1 tissue estimates",
                     type="image")
        g.add_option("--batim",
                     "--attim",
                     help="Voxelwise BAT (ATT) estimates in seconds",
                     type="image")
        g.add_option(
            "--basil-options",
            "--fit-options",
            help="File containing additional options for model fitting step",
            type="optfile",
            default=None)
        ret.append(g)

        g = IgnorableOptionGroup(
            parser,
            "Physiological parameters (all have default values from literature)"
        )
        g.add_option(
            "--bat",
            help=
            "Estimated bolus arrival time (s) - default=0.7 (pASL), 1.3 (cASL)",
            type=float)
        g.add_option("--t1",
                     "--t1t",
                     help="Tissue T1 (s)",
                     type=float,
                     default=1.3)
        g.add_option("--t2",
                     "--t2t",
                     help="Tissue T2 (ms)",
                     type=float,
                     default=50)
        g.add_option("--t2s", help="Tissue T2* (ms)", type=float, default=20)
        g.add_option("--t1b", help="Blood T1 (s)", type=float, default=1.65)
        g.add_option(
            "--t2b",
            help=
            "Blood T2 (ms) - Lu et al. 2012 MRM 67:42-49, 3T during normoxia",
            type=float,
            default=150)
        g.add_option("--t2sb",
                     help="Blood T2* (ms) - Petersen 2006 MRM 55(2):219-232",
                     type=float,
                     default=50)
        ret.append(g)

        g = IgnorableOptionGroup(parser, "Output options")
        g.add_option("--save-corrected",
                     help="Save corrected input data",
                     action="store_true",
                     default=False)
        g.add_option("--save-reg",
                     help="Save registration information (transforms etc)",
                     action="store_true",
                     default=False)
        g.add_option("--save-basil",
                     help="Save Basil modelling output",
                     action="store_true",
                     default=False)
        g.add_option("--save-calib",
                     help="Save calibration output",
                     action="store_true",
                     default=False)
        g.add_option("--save-all",
                     help="Save all output (enabled when --debug specified)",
                     action="store_true",
                     default=False)
        g.add_option("--output-stddev",
                     "--output-std",
                     help="Output standard deviation of estimated variables",
                     action="store_true",
                     default=False)
        g.add_option("--output-var",
                     "--vars",
                     help="Output variance of estimated variables",
                     action="store_true",
                     default=False)
        g.add_option("--output-residuals",
                     help="Output residuals (model fit - actual data)",
                     action="store_true",
                     default=False)
        g.add_option("--output-mni",
                     help="Output in MNI standard space",
                     action="store_true",
                     default=False)
        g.add_option(
            "--output-custom",
            help=
            "Output in custom space (provide path to reference image in space)",
            type=str)
        g.add_option(
            "--output-custom-mat",
            help=
            "(Optional) FLIRT transformation from structural space to custom space. "
            +
            "If not provided, will FLIRT registration from structural to --output-custom will be used.",
            type=str)
        g.add_option("--no-report",
                     dest="save_report",
                     help="Don't try to generate an HTML report",
                     action="store_false",
                     default=True)
        ret.append(g)
        return ret
Example #6
0
    def groups(self, parser):
        ret = []
        g = IgnorableOptionGroup(parser,
                                 "Distortion correction using fieldmap")
        g.add_option("--fmap", help="fieldmap image (in rad/s)", type="image")
        g.add_option("--fmapmag",
                     help="fieldmap magnitude image - wholehead extracted",
                     type="image")
        g.add_option("--fmapmagbrain",
                     help="fieldmap magnitude image - brain extracted",
                     type="image")
        g.add_option(
            "--nofmapreg",
            help=
            "Do not perform registration of fmap to T1 (use if fmap already in T1-space)",
            action="store_true",
            default=False)
        ret.append(g)

        g = IgnorableOptionGroup(
            parser,
            "Distortion correction using phase-encode-reversed calibration image (TOPUP)"
        )
        g.add_option("--cblip",
                     help="phase-encode-reversed (blipped) calibration image",
                     type="image")
        ret.append(g)

        g = IgnorableOptionGroup(parser,
                                 "General distortion correction options")
        g.add_option(
            "--echospacing",
            help=
            "Effective EPI echo spacing (sometimes called dwell time) - in seconds",
            type=float)
        g.add_option("--pedir",
                     help="Phase encoding direction, dir = x/y/z/-x/-y/-z")
        g.add_option(
            "--gdc-warp",
            "--gdcwarp",
            help=
            "Additional warp image for gradient distortion correction - will be combined with fieldmap or TOPUP distortion correction",
            type="image")
        ret.append(g)

        g = IgnorableOptionGroup(parser, "Sensitivity correction")
        g.add_option("--cref",
                     help="Reference image for sensitivity correction",
                     type="image")
        g.add_option(
            "--cact",
            help=
            "Image from coil used for actual ASL acquisition (default: calibration image - only in longtr mode)",
            type="image")
        g.add_option("--isen",
                     help="User-supplied sensitivity correction in ASL space")
        g.add_option(
            "--senscorr-auto",
            "--senscorr",
            help=
            "Apply automatic sensitivity correction using bias field from FAST",
            action="store_true",
            default=False)
        g.add_option("--senscorr-off",
                     help="Do not apply any sensitivity correction",
                     action="store_true",
                     default=False)
        ret.append(g)

        g = IgnorableOptionGroup(parser, "Partial volume correction (PVEc)")
        g.add_option(
            "--pvcorr",
            help="Apply PVEc using FAST estimates taken from --fslanat dir",
            action="store_true",
            default=False)
        g.add_option(
            "--surf-pvcorr",
            help=
            "Apply PVEc using surface PV estimates taken from --fslanat dir w/ surfaces (not mutually exclusive with --pvcorr)",
            action="store_true",
            default=False)
        g.add_option('--cores',
                     help="Number of processor cores to use for --surf-pvcorr",
                     type=int)
        g.add_option(
            "--pvgm",
            help=
            "GM PV estimates in ASL space (apply PVEc only, don't estimate PVs)",
            type="image",
            default=None)
        g.add_option("--pvwm",
                     help="As above, WM PV estimates in ASL space",
                     type="image",
                     default=None)
        ret.append(g)

        return ret
Example #7
0
    def groups(self, parser):
        group = IgnorableOptionGroup(parser, self.title, ignore=self.ignore)
        group.add_option("--struc", "-s", help="Structural image", type="image", default=None)
        group.add_option("--struc-brain", "--sbet", "--struc-bet", type="image", help="Structural image (brain extracted)", default=None)
        group.add_option("--struc2asl", help="Structural->ASL transformation matrix", default=None)
        group.add_option("--asl2struc", help="ASL->Structural transformation matrix", default=None)
        group.add_option("--wm-seg", help="White matter segmentation of structural image", type="image", default=None)
        group.add_option("--gm-seg", help="Grey matter segmentation of structural image", type="image", default=None)
        group.add_option("--csf-seg", help="CSF segmentation of structural image", type="image", default=None)
        group.add_option("--fslanat", help="FSL_ANAT output directory for structural information", default=None)
        group.add_option("--fastsrc", help="Images from a FAST segmentation - if not set FAST will be run on structural image")
        group.add_option("--struc2std", help="Structural to MNI152 linear registration (.mat)")
        group.add_option("--struc2std-warp", help="Structural to MNI152 non-linear registration (warp)")

        return [group, ]
Example #8
0
    def groups(self, parser):
        groups = []
        group = IgnorableOptionGroup(parser, "Calibration", ignore=self.ignore)
        group.add_option("--calib",
                         "-c",
                         help="Calibration image",
                         type="image")
        group.add_option(
            "--perf",
            "-i",
            help=
            "Perfusion image for calibration, in same image space as calibration image",
            type="image")
        group.add_option("--calib-method",
                         "--cmethod",
                         help="Calibration method: voxelwise or refregion")
        group.add_option("--calib-alpha",
                         "--alpha",
                         help="Inversion efficiency",
                         type=float,
                         default=None)
        group.add_option("--calib-gain",
                         "--cgain",
                         help="Relative gain between calibration and ASL data",
                         type=float,
                         default=1.0)
        group.add_option(
            "--calib-aslreg",
            help="Calibration image is already aligned with ASL image",
            action="store_true",
            default=False)

        group.add_option("--tr",
                         help="TR used in calibration sequence (s)",
                         type=float,
                         default=3.2)
        groups.append(group)

        group = IgnorableOptionGroup(parser,
                                     "Voxelwise calibration",
                                     ignore=self.ignore)
        group.add_option("--pct",
                         help="Tissue/arterial partition coefficiant",
                         type=float,
                         default=0.9)
        groups.append(group)

        group = IgnorableOptionGroup(parser,
                                     "Reference region calibration",
                                     ignore=self.ignore)
        group.add_option("--mode",
                         help="Calibration mode (longtr or satrevoc)",
                         default="longtr")
        group.add_option("--tissref",
                         help="Tissue reference type (csf, wm, gm or none)",
                         default="csf")
        group.add_option("--te",
                         help="Sequence TE (ms)",
                         type=float,
                         default=0.0)
        group.add_option(
            "--refmask",
            "--csf",
            help="Reference tissue mask in calibration image space",
            type="image")
        group.add_option(
            "--t1r",
            help=
            "T1 of reference tissue (s) - defaults: csf 4.3, gm 1.3, wm 1.0",
            type=float,
            default=None)
        group.add_option(
            "--t2r",
            help=
            "T2/T2* of reference tissue (ms) - defaults T2/T2*: csf 750/400, gm 100/60,  wm 50/50",
            type=float,
            default=None)
        group.add_option(
            "--t2star",
            action="store_true",
            default=False,
            help=
            "Correct with T2* rather than T2 (alters the default T2 values)")
        group.add_option(
            "--pcr",
            help=
            "Reference tissue partition coefficiant (defaults csf 1.15, gm 0.98,  wm 0.82)",
            type=float,
            default=None)
        groups.append(group)

        group = IgnorableOptionGroup(
            parser,
            "longtr mode (calibration image is a control image with a long TR)",
            ignore=self.ignore)
        groups.append(group)

        group = IgnorableOptionGroup(
            parser,
            "satrecov mode (calibration image is a sequnce of control images at various TIs)",
            ignore=self.ignore)
        group.add_option(
            "--tis",
            help=
            "Comma separated list of inversion times, e.group. --tis 0.2,0.4,0.6"
        )
        group.add_option(
            "--fa",
            help="Flip angle (in degrees) for Look-Locker readouts",
            type=float)
        group.add_option(
            "--lfa",
            help="Lower flip angle (in degrees) for dual FA calibration",
            type=float)
        group.add_option("--calib-nphases",
                         help="Number of phases (repetitions) of higher FA",
                         type=int)
        group.add_option(
            "--fixa",
            action="store_true",
            default=False,
            help=
            "Fix the saturation efficiency to 100% (useful if you have a low number of samples)"
        )
        groups.append(group)

        #group = IgnorableOptionGroup(parser, "CSF masking options (only for --tissref csf)", ignore=self.ignore)
        #group.add_option("--csfmaskingoff", action="store_true", default=False, help="Turn off the ventricle masking, reference is based on segmentation only.")
        #group.add_option("--str2std", help="Structural to MNI152 linear registration (.mat)")
        #group.add_option("--warp", help="Structural to MNI152 non-linear registration (warp)")

        return groups
Example #9
0
 def groups(self, parser):
     groups = []
     group = IgnorableOptionGroup(parser,
                                  "Multiphase Options",
                                  ignore=self.ignore)
     group.add_option(
         "--mp-spatial",
         help="Enable spatial smoothing on multiphase fitting step",
         action="store_true",
         default=False)
     group.add_option(
         "--mp-spatial-phase",
         help=
         "Perform spatial regularization on the phase rather than the magnitude",
         action="store_true",
         default=False)
     group.add_option(
         "--mp-options",
         help=
         "File containing additional options for multiphase fitting step",
         type="optfile")
     group.add_option(
         "--mp-init-step",
         help=
         "Initialize multiphase fitting by initially fitting to the mean over repeats",
         action="store_true",
         default=False)
     group.add_option("--mp-biascorr",
                      help="Use supervoxel-based bias correction",
                      action="store_true",
                      default=False)
     group.add_option(
         "--mp-biascorr-sv",
         help="Number of supervoxels to use in bias correction",
         type="int",
         default=8)
     group.add_option(
         "--mp-biascorr-comp",
         help="Supervoxels compactness to use in bias correction",
         type="float",
         default=0.1)
     group.add_option(
         "--mp-biascorr-sigma",
         help="Pre-supervoxel smoothing width in bias correction",
         type="float",
         default=0.5)
     group.add_option(
         "--mp-biascorr-simple",
         help="Use simplified form of supervoxel-based bias correction",
         action="store_true",
         default=False)
     groups.append(group)
     return groups