Parameters

Adding -params

Definition of the sequence of nodes in processing pipelines, as well as general parameters, are specified by json file. When specifying a -species and -soft (see Commands), the corresponding default parameter file will be used; They are located in the workflows directory of the package.

The original parameter file can be altered by some options in -soft (e.g. _robustreg, _prep, etc.; see Commands).

Here is an example of the params.json with parameters -soft ANTS_skull for -species macaque:

{
    "general":
    {
        "template_name": "NMT_v2.0_asym"
    },
    "short_preparation_pipe":
    {
        "aladin_T2_on_T1":{},
        "crop_aladin_pipe":
        {
            "reg_T1_on_template":
            {
                "rig_only_flag" : true
            },
            "reg_T1_on_template2":
            {
                "rig_only_flag":true
            }
        },
        "pad_template":
        {
            "operation" : "PadImage",
            "op2" : "70"
        },
        "denoise":
        {
            "shrink_factor": 2
        },
        "N4debias":
        {
            "dimension": 3,
            "bspline_fitting_distance": 200,
            "n_iterations": [50, 50, 40, 30],
            "convergence_threshold": 1e-08,
            "shrink_factor": 2,
            "args": "-r 0 --verbose 1"
        }
    },
    "extract_pipe":
    {
        "atlas_brex":
        {
            "f": 0.5,
            "reg": 1,
            "wrp": "10,10,10",
            "msk": "a,0,0",
            "dil": 2,
            "nrm": 1
        }
    },
    "debias":
    {
        "s": 2
    },
    "brain_segment_pipe":
    {
        "reg":
        {
            "n": 2,
            "m": "ref",
            "dof": 12
        },
        "segment_atropos_pipe":
        {
            "use_priors": 0.0,
            "Atropos":
            {
                "dimension": 3
            },
            "tissue_dict":
            {
                "gm": [2, 3],
                "wm": 4,
                "csf": [1, 5]
            }
        }
    },
    "export_5tt_pipe": {},
    "IsoSurface_brain_pipe":
    {
        "merge_brain_tissues":
        {
            "keep_indexes": [2, 3, 4]
        }
    },
    "IsoSurface_tissues_pipe":
    {
    },

    "skull_t1_pipe":
    {
        "headmask_t1_pipe":
        {
            "t1_head_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 9.0
            },
            "t1_head_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 9.0
            }
        },
        "skullmask_t1_pipe":
        {
            "t1_fast":
            {
                "args": "-l 10",
                "img_type": 1,
                "output_biascorrected": true,
                "output_biasfield": true
            },
            "t1_head_erode_skin":
            {
                "kernel_shape": "boxv",
                "kernel_size": 9.0
            },
            "t1_skull_gcc_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 6.0
            },
            "t1_skull_gcc_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 6.0
            },
            "t1_skull_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 4.0
            },
            "t1_skull_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 4.0
            },
            "t1_skull_fov":
            {
                "brainsize": 45
            }
        }
    },

    "skull_petra_pipe":
    {
        "headmask_petra_pipe":
        {
            "petra_head_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 7.0
            },
            "petra_head_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 7.0
            }
        },
        "skullmask_petra_pipe":
        {
            "petra_fast":
            {
                "args": " -l 10",
                "img_type": 3,
                "output_biascorrected": true,
                "output_biasfield": true
            },
            "petra_head_erode_skin":
            {
                "kernel_shape": "boxv",
                "kernel_size": 9.0
            },

            "petra_skull_gcc_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },
            "petra_skull_gcc_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },

            "petra_skull_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 7.0
            },
            "petra_skull_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 7.0
            },
            "petra_skull_fov":
            {
                "brainsize": 45
            }
        }
    },

    "skull_ct_pipe":
    {
        "align_ct_on_T1_2":
        {
        },

        "skullmask_ct_pipe":
        {
            "ct_skull_auto_mask":
            {
                "kmeans": true,
                "sample_bins": 30,
                "distance": 10,
                "operation": "lower",
                "index": 2
            },
            "ct_skull_dilate":
            {
                "operation" : "modal",
                "kernel_shape" : "boxv",
                "kernel_size" : 3.0
            },
            "ct_skull_erode":
            {
                "kernel_shape" : "boxv",
                "kernel_size" : 3.0
            },
            "ct_skull_fov":
            {
                "brainsize" : 45
            }
        }
    },

    "angio_pipe":
    {
        "angio_denoise":
        {
            "shrink_factor": 1
        },
        "angio_fast":
        {
            "args": " -l 10",
            "img_type": 3,
            "output_biascorrected": true,
            "output_biasfield": true
        }
    }
}

It is also possible to alter values of some nodes for individual sessions/subjects. See individual parameter section).

Note: Individual parameter will not modify the pipeline sequence itself, a value specified in indiv_params for a node that do not exists in params will ignored

Advanced parameters settings

For advanced user, it is however possible to pass the pipeline sequence as a params.json file. In this case all further alteration will be canceled.

Here is json file with all possible nodes to be tuned; Some node are optional, some nodes are exclusive with each other (XOR). All parameters given here are give as examples and may vary

{
    "skull_t1_pipe":
    {
        "comment": "will be removed if option _noheadmask or _noskullmask is provided in -soft)",
        "headmask_t1_pipe":
        {
            "comment": "the following nodes are mutually exclusive, but are mandatory if headmask_t1_pipe is defined",
            "t1_head_li_mask":
            {
                "comment": "DEFAULT (do not need to be specied in params)",
                "params": "Uses threshold_li from skimage.filters (from macapype, also used in remove_capsule_pipe)",

                "comment": "No argument"

            },
            "comment": "OR",
            "t1_head_mask_thr":
            {
                "comment": "OPTIONAL",
                "params": "Threshold (FSL)",

                "thr": "300"

            },
            "comment": "OR",
            "t1_head_auto_mask":
            {
                "comment": "OPTIONAL",
                "params": "mask_auto_img (python)",

                "kmeans": true,
                "operation": "lower",
                "index": 2
            },

            "comment": "The following 2 nodes are OPTIONAL either have to be both defined or none of them",
            "comment": "allows to cut some elements before gcc is applied",
            "comment": "are used in -soft _skullnoisypetra",
            "t1_head_gcc_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },
            "t1_head_gcc_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },

            "t1_head_dilate":
            {

                "params": "DilateImage (FSL)",

                "operation" : "modal",
                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            },
            "t1_head_erode":
            {

                "params": "ErodeImage (FSL)",

                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            }
        },

        "comment": "will be removed if option _noskullmask is provided in -soft)",
        "skullmask_t1_pipe":
        {

            "t1_fast":
            {
                "params": "FAST (FSL)",
            },


            "comment": "The following 2 nodes are OPTIONAL and mutually exclusive",
            "comment": "If not defined fast pve_0 is used as mask for skull",
            "t1_skull_auto_mask":
            {
                "comment": "OPTIONAL",
                "params": "mask_auto_img (python)",

                "kmeans": true,
                "operation": "lower",
                "index": 2
            },
            "comment": "OR",
            "t1_skull_mask_thr":
            {
                "comment": "OPTIONAL",
                "params": "Threshold (FSL)",

                "thr": "300"

            },

            "t1_head_erode_skin":
            {

                "comment": "OPTIONAL",
                "params": "ErodeImage (FSL)",

                "kernel_shape" : "boxv",
                "kernel_size" : 14.0
            },


            "comment": "The following 2 nodes are OPTIONAL either have to be both defined or none of them",
            "comment": "allows to cut some elements before gcc is applied",
            "comment": "are used in -soft _skullnoisypetra",
            "t1_skull_gcc_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },
            "t1_skull_gcc_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },



            "t1_skull_dilate":
            {
                "params": "DilateImage (FSL)",

                "operation" : "modal",
                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            },
            "t1_skull_erode":
            {
                "params": "ErodeImage (FSL)",

                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            },

            "t1_skull_fov":
            {
                "comment": "OPTIONAL",
                "params": "RobustFOV (FSL)",

                "brainsize" : "45",
            }
        },

    },



    "skull_ct_pipe":
    {
        "align_ct_on_T1_2":
        {

            "comment": "OPTIONAL",
            "comment": "Cannot be modified",
            "params": "RegAladin (NiftyReg)"

        },

        "comment": "will be removed if option _noheadmask or _noskullmask is provided in -soft)",
        "skullmask_ct_pipe":
        {
            "comment": "the following nodes are mutually exclusive, but are mandatory if skullmask_ct_pipe is defined ",

            "ct_head_mask_thr":
            {
                "params": "Threshold (FSL)",

                "thr": "300"

            },
            "comment": "OR",
            "ct_head_auto_mask":
            {
                "params": "mask_auto_img (python)",

                "kmeans": true,
                "operation": "lower",
                "index": 2
            },

            "ct_skull_dilate":
            {
                "params": "DilateImage (FSL)",

                "operation" : "modal",
                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            },
            "ct_skull_erode":
            {
                "params": "ErodeImage (FSL)",

                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            }
    },

    "skull_petra_pipe":
    {

        "avg_reorient_pipe":
        {
            "comment": "OPTIONAL",
            "params": "see corresponding doc in short_preparation_pipe in macapype"

        },

        "comment": "will be removed if option _noheadmask or _noskullmask is provided in -soft)",
        "headmask_petra_pipe":
        {

            "petra_itk_debias":
            {
                "comment": "OPTIONAL",
                "params": "SimpleITK N4BiasFieldCorrectionImageFilter dirty wrap (defined in macapype.nodes.correc_bias)",
                "comment": "TODO: Should be made a proper nipype node",

            },


            "comment": "the following nodes are mutually exclusive, but are mandatory if headmask_t1_pipe is defined",
            "petra_head_li_mask":
            {
                "comment": "DEFAULT (do not need to be specied in params)",
                "params": "Uses threshold_li from skimage.filters (from macapype, also used in remove_capsule_pipe)",

                "comment": "No argument"

            },
            "comment": "OR",
            "petra_head_mask_thr":
            {
                "params": "Threshold (FSL)",
                "thr": "300"
            },
            "comment": "OR",
            "petra_head_auto_mask":
            {
                "params": "mask_auto_img (python)",

                "kmeans": true,
                "operation": "lower",
                "index": 2
            },


            "comment": "The following 2 nodes are OPTIONAL either have to be both defined or none of them",
            "comment": "allows to cut some elements before gcc is applied",
            "comment": "are used in -soft _skullnoisypetra",
            "petra_head_gcc_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },
            "petra_head_gcc_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },

            "petra_head_dilate":
            {

                "params": "DilateImage (FSL)",

                "operation" : "modal",
                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            },
            "petra_head_erode":
            {

                "params": "ErodeImage (FSL)",

                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            }
        },

        "comment": "will be removed if option _noskullmask is provided in -soft)",
        "skullmask_petra_pipe":
        {

            "petra_fast":
            {
                "params": "FAST (FSL)",
            },


            "comment": "The following 2 nodes are OPTIONAL and mutually exclusive",
            "comment": "If not defined fast pve_0 is used as mask for skull",
            "petra_skull_auto_mask":
            {
                "comment": "OPTIONAL",
                "params": "mask_auto_img (python)",

                "kmeans": true,
                "operation": "lower",
                "index": 2
            },
            "comment": "OR",
            "petra_skull_mask_thr":
            {
                "comment": "OPTIONAL",
                "params": "Threshold (FSL)",

                "thr": "300"

            },

            "comment": "The following 2 nodes are OPTIONAL either have to be both defined or none of them",
            "comment": "allows to cut some elements before gcc is applied",
            "comment": "are used in -soft _skullnoisypetra",
            "petra_skull_gcc_erode":
            {
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },
            "petra_skull_gcc_dilate":
            {
                "operation": "modal",
                "kernel_shape": "boxv",
                "kernel_size": 3.0
            },

            "petra_head_erode_skin":
            {

                "comment": "OPTIONAL",
                "params": "ErodeImage (FSL)",

                "kernel_shape" : "boxv",
                "kernel_size" : 14.0
            },


            "petra_skull_dilate":
            {
                "params": "DilateImage (FSL)",

                "operation" : "modal",
                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            },
            "petra_skull_erode":
            {
                "params": "ErodeImage (FSL)",

                "kernel_shape" : "boxv",
                "kernel_size" : 13.0
            },

            "petra_skull_fov":
            {
                "comment": "OPTIONAL",
                "params": "RobustFOV (FSL)",

                "brainsize" : "45",
            },
    },


    "comment": "Still optional, should be used with caution",
    "angio_pipe":
    {

            "angio_mask_thr":
            {
                "params": "Threshold (FSL)",

                "thr": "300"

            },
            "comment": "OR",
            "angio_auto_mask":
            {
                "params": "FAST (FSL)"


            }
    }
}

Note: The json file provided here only pass the node available in pipelines specific to skullTo3d processing. A functional pipeline will also require some pipeline sequence from macapype itself, a minima the definition of a short_preparation_pipe sequence of nodes. See macapype params page for more details.