{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "required": [
        "config",
        "inputs"
    ],
    "type": "object",
    "properties": {
        "inputs": {
            "required": [
                "bvec",
                "bval",
                "nifti"
            ],
            "type": "object",
            "properties": {
                "bvec": {
                    "type": "object",
                    "properties": {
                        "type": {
                            "enum": [
                                "bvec"
                            ]
                        }
                    }
                },
                "bval": {
                    "type": "object",
                    "properties": {
                        "type": {
                            "enum": [
                                "bval"
                            ]
                        }
                    }
                },
                "nifti": {
                    "type": "object",
                    "properties": {
                        "type": {
                            "enum": [
                                "nifti"
                            ]
                        }
                    }
                }
            }
        },
        "config": {
            "required": [
                "dwOutMm-2",
                "numBootStrapSamples",
                "noiseCalcMethod",
                "flipLrApFlag",
                "rotateBvecsWithCanXform",
                "dwOutMm-1",
                "phaseEncodeDir",
                "eddyCorrect",
                "dwOutMm-3",
                "rotateBvecsWithRx",
                "fitMethod",
                "bsplineInterpFlag",
                "nStep"
            ],
            "type": "object",
            "properties": {
                "eddyCorrect": {
                    "default": 1,
                    "type": "integer",
                    "description": "Motion and eddy-current correction. [default = 1, Do eddy-current and motion correction]. Options [0, 1, -1]. 0 = Only motion correction is done. 1 = Do eddy-current and motion correction. -1 = No motion or eddy correction."
                },
                "numBootStrapSamples": {
                    "default": 500,
                    "type": "integer",
                    "description": "Number of boostrap interations."
                },
                "noiseCalcMethod": {
                    "default": "b0",
                    "type": "string",
                    "description": "Noise calculation method for robust tensor fitting. ['corner', 'b0' (default)]. There are 2 ways to calculate the noise. The first is based on the standard deviation of the signal in the corner of the image (noiseCalcMethod = 'corner'). This method works well as long as the corner of the image has not been padded with zeros. Currently GE zeros out the pixel intensity outside of the brain. So for new GE data we calculate the noise by taking the standard deviation of the b=0 images (noiseCalcMethod = 'b0') which means that we need a number of b0 acquisitions. If you are using robust tensor fitting you must decide how to calculate the image noise. If the corner of the image is padded with zeros then you should use the 'b0' method which calculates the noise based on the std of the b0 image."
                },
                "flipLrApFlag": {
                    "default": 0,
                    "type": "integer",
                    "description": "This flag will signal dtiRawBuildBvecs to reorient the gradient directions specified in the dwepi.grads file to logical space rather than keeping the directions in scanner space. Thus, the bvecs do not need to be reoriented for oblique prescriptions as with some other DTI sequences. However, this sequence assumes that the 2nd column in dwepi.grads is the phase-encode dim. If your phase-encode is the usual '2', then this is fine. But, if you run ASSET and change the phase encode to L-R (dim 1), you need to swap the first and second columns of dwepi.grads. Also, there appears to be a flip in the phase-encode dim, so you also need to flip the sign on the phase-encode column."
                },
                "rotateBvecsWithCanXform": {
                    "default": 0,
                    "type": "integer",
                    "description": "Rotate the b-vectors according to the canonical xForm. 0 = false, 1 = true"
                },
                "dwOutMm-1": {
                    "default": 2,
                    "type": "integer",
                    "description": "Resolution of the output in mm."
                },
                "phaseEncodeDir": {
                    "default": 2,
                    "type": "integer",
                    "description": "Phase encoding direction. (1 = L/R 'row', 2 = A/P 'col'). This value is read from the rawDti nifti field, you should specify it here if it does not exist. If you collected your DTI data using GE's ASSET, you should provide the phase-encode direction (1= L/R 'row', 2 = A/P 'col'). Information about this, as well as the b-value and gradient code, can be found in the dicom file header."
                },
                "dwOutMm-2": {
                    "default": 2,
                    "type": "integer",
                    "description": "Resolution of the output in mm."
                },
                "nStep": {
                    "default": 50,
                    "type": "integer",
                    "description": "The number of steps for the restore algorithm in the robust tensor fitting case. (dtiRawFitTensorRobust)."
                },
                "rotateBvecsWithRx": {
                    "default": 0,
                    "type": "integer",
                    "description": "Rotate the b-vectors according to the scanner perscription. 0 = false, 1 = true"
                },
                "fitMethod": {
                    "default": "ls",
                    "type": "string",
                    "description": "Fit-method for tesnsor fitting. Options are ['ls', 'rt', 'lsrt']: 'ls': least-squares (default) 'rt': RESTORE robust tensor fitting and outlier rejection (Chang, Jones & Pierpaoli (2005) RESTORE: Robust Estimation of Tensors by Outlier Rejection. Magnetic Resonance in Medicine, v53). 'lsrt': does least-squares and robust tensor fitting in one go. "
                },
                "bsplineInterpFlag": {
                    "default": 0,
                    "type": "integer",
                    "description": "Method used for interpolation during resampling (dtiRawResample). 1 = bspline. 0 = trilinear (default)"
                },
                "dwOutMm-3": {
                    "default": 2,
                    "type": "integer",
                    "description": "Resolution of the output in mm."
                }
            }
        }
    },
    "title": "Invocation manifest for Diffusion Data Initialization Pipeline"
}