%YAML 1.1
---
# CPAC Pipeline Configuration YAML file
# Version 1.8.8.dev1
#
# http://fcp-indi.github.io for more info.
#
# Tip: This file can be edited manually with a text editor for quick modifications.
FROM: blank

pipeline_setup:

  # Name for this pipeline configuration - useful for identification.
  # This string will be sanitized and used in filepaths
  pipeline_name: ndmg
  output_directory:

    # Quality control outputs
    quality_control:

      # Generate quality control pages containing preprocessing and derivative outputs.
      generate_quality_control_images: On

  system_config:

    # The number of cores to allocate to ANTS-based anatomical registration per participant.
    # - Multiple cores can greatly speed up this preprocessing step.
    # - This number cannot be greater than the number of cores per participant.
    num_ants_threads: 4

anatomical_preproc:
  run: On
  acpc_alignment:
    T1w_brain_ACPC_template: $FSLDIR/data/standard/MNI152_T1_1mm_brain.nii.gz

  brain_extraction:
    run: On

segmentation:

  # Automatically segment anatomical images into white matter, gray matter,
  # and CSF based on prior probability maps.
  run: On
  tissue_segmentation:
    Template_Based:

      # These masks should be in the same space of your registration template, e.g. if
      # you choose 'EPI Template' , below tissue masks should also be EPI template tissue masks.
      #
      # Options: ['T1_Template', 'EPI_Template']
      template_for_segmentation: []

registration_workflows:
  anatomical_registration:
    run: On
    registration:

      # using: ['ANTS', 'FSL', 'FSL-linear']
      # this is a fork point
      #   selecting both ['ANTS', 'FSL'] will run both and fork the pipeline
      using: [FSL]

      # option parameters
      ANTs:

        # ANTs parameters for T1-template-based registration
        T1_registration:

  functional_registration:
    coregistration:

      # functional (BOLD/EPI) registration to anatomical (structural/T1)
      run: On
      boundary_based_registration:

        # this is a fork point
        #   run: [On, Off] - this will run both and fork the pipeline
        run: [On]

    func_registration_to_template:

      # these options modify the application (to the functional data), not the calculation, of the
      # T1-to-template and EPI-to-template transforms calculated earlier during registration
      # apply the functional-to-template (T1 template) registration transform to the functional data
      run: On
      output_resolution:

        # The resolution (in mm) to which the preprocessed, registered functional timeseries outputs are written into.
        # NOTE:
        #   selecting a 1 mm or 2 mm resolution might substantially increase your RAM needs- these resolutions should be selected with caution.
        #   for most cases, 3 mm or 4 mm resolutions are suggested.
        # NOTE:
        #   this also includes the single-volume 3D preprocessed functional data,
        #   such as the mean functional (mean EPI) in template space
        func_preproc_outputs: 2mm

        # The resolution (in mm) to which the registered derivative outputs are written into.
        # NOTE:
        #   this is for the single-volume functional-space outputs (i.e. derivatives)
        #   thus, a higher resolution may not result in a large increase in RAM needs as above
        func_derivative_outputs: 2mm

    EPI_registration:
      ANTs:

        # EPI registration configuration - synonymous with T1_registration
        # parameters under anatomical registration above
        parameters:

functional_preproc:
  run: On
  slice_timing_correction:

    # Interpolate voxel time courses so they are sampled at the same time points.
    # this is a fork point
    #   run: [On, Off] - this will run both and fork the pipeline
    run: [On]

  motion_estimates_and_correction:
    run: On
    motion_correction:

      # using: ['3dvolreg', 'mcflirt']
      # Forking is currently broken for this option.
      # Please use separate configs if you want to use each of 3dvolreg and mcflirt.
      # Follow https://github.com/FCP-INDI/C-PAC/issues/1935 to see when this issue is resolved.
      using: [3dvolreg]

  distortion_correction:

    # this is a fork point
    #   run: [On, Off] - this will run both and fork the pipeline
    run: [On]

    # using: ['PhaseDiff', 'Blip', 'Blip-FSL-TOPUP']
    #   PhaseDiff - Perform field map correction using a single phase difference image, a subtraction of the two phase images from each echo. Default scanner for this method is SIEMENS.
    #   Blip - Uses AFNI 3dQWarp to calculate the distortion unwarp for EPI field maps of opposite/same phase encoding direction.
    #   Blip-FSL-TOPUP - Uses FSL TOPUP to calculate the distortion unwarp for EPI field maps of opposite/same phase encoding direction.
    using: []

  func_masking:
    run: On

  generate_func_mean:

    # Generate mean functional image
    run: On

  normalize_func:

    # Normalize functional image
    run: On

  coreg_prep:

    # Generate sbref
    run: On

nuisance_corrections:
  2-nuisance_regression:

    # this is a fork point
    #   run: [On, Off] - this will run both and fork the pipeline
    run: [On]

    # Select which nuisance signal corrections to apply
    Regressors:
      - Name: Regressor_1
        Bandpass:
          bottom_frequency: 0.01
          top_frequency: 0.1
        CerebrospinalFluid:
          extraction_resolution: 2
          summary: Mean
        PolyOrt:
          degree: 2
        aCompCor:
          extraction_resolution: 2
          summary:
            components: 5
            method: DetrendPC
          tissues:
          - WhiteMatter
          - CerebrospinalFluid

    # Process and refine masks used to produce regressors and time series for
    # regression.
    regressor_masks:
      erode_anatomical_brain_mask:

        # Erode brain mask in millimeters, default for brain mask is 30 mm
        # Brain erosion default is using millimeters.
        brain_mask_erosion_mm: 30

      erode_csf:

        # Erode cerebrospinal fluid mask in millimeters, default for cerebrospinal fluid is 30mm
        # Cerebrospinal fluid erosion default is using millimeters.
        csf_mask_erosion_mm: 30

      erode_wm:

        # Target volume ratio, if using erosion.
        # Default proportion is 0.6 for white matter mask.
        # If using erosion, using both proportion and millimeters is not recommended.
        # White matter erosion default is using proportion erosion method when use erosion for white matter.
        wm_erosion_prop: 0.6

      erode_gm:

        # Target volume ratio, if using erosion.
        # If using erosion, using both proportion and millimeters is not recommended.
        gm_erosion_prop: 0.6

timeseries_extraction:
  run: On
  connectivity_matrix:

    # Create a connectivity matrix from timeseries data
    # Options:
    #  ['AFNI', 'Nilearn', 'ndmg']
    using: [Nilearn, ndmg]

    # Options:
    #  ['Pearson', 'Partial']
    # Note: These options are not configurable for ndmg, which will ignore these options
    measure: [Pearson, Partial]

  # Enter paths to region-of-interest (ROI) NIFTI files (.nii or .nii.gz) to be used for time-series extraction, and then select which types of analyses to run.
  # Denote which analyses to run for each ROI path by listing the names below. For example, if you wish to run Avg and SpatialReg, you would enter: '/path/to/ROI.nii.gz': Avg, SpatialReg
  # available analyses:
  #   /path/to/atlas.nii.gz: Avg, Voxel, SpatialReg
  tse_roi_paths:
    /ndmg_atlases/label/Human/AAL_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/Brodmann_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/CPAC200_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/Desikan_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DKT_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00071_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00096_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00108_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00140_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00195_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00278_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00350_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00446_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00583_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS00833_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/DS01216_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/HarvardOxfordcort-maxprob-thr25_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/HarvardOxfordsub-maxprob-thr25_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/JHU_space-MNI152NLin6_res-2x2x2.nii.gz: Avg
    /ndmg_atlases/label/Human/Princetonvisual-top_space-MNI152NLin6_res-2x2x2.nii.gz: Avg

amplitude_low_frequency_fluctuation:

  # space: Template or Native
  target_space: [Native]

regional_homogeneity:

  # space: Template or Native
  target_space: [Native]

# OUTPUTS AND DERIVATIVES
# -----------------------
post_processing:
  spatial_smoothing:
    run: On

  z-scoring:
    run: On