# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..segmentation import N4BiasFieldCorrection


def test_N4BiasFieldCorrection_inputs():
    input_map = dict(
        args=dict(
            argstr="%s",
        ),
        bias_image=dict(
            extensions=None,
            hash_files=False,
        ),
        bspline_fitting_distance=dict(
            argstr="--bspline-fitting %s",
        ),
        bspline_order=dict(
            requires=["bspline_fitting_distance"],
        ),
        convergence_threshold=dict(
            requires=["n_iterations"],
        ),
        copy_header=dict(
            mandatory=True,
            usedefault=True,
        ),
        dimension=dict(
            argstr="-d %d",
            usedefault=True,
        ),
        environ=dict(
            nohash=True,
            usedefault=True,
        ),
        histogram_sharpening=dict(
            argstr="--histogram-sharpening [%g,%g,%d]",
        ),
        input_image=dict(
            argstr="--input-image %s",
            extensions=None,
            mandatory=True,
        ),
        mask_image=dict(
            argstr="--mask-image %s",
            extensions=None,
        ),
        n_iterations=dict(
            argstr="--convergence %s",
        ),
        num_threads=dict(
            nohash=True,
            usedefault=True,
        ),
        output_image=dict(
            argstr="--output %s",
            hash_files=False,
            keep_extension=True,
            name_source=["input_image"],
            name_template="%s_corrected",
        ),
        rescale_intensities=dict(
            argstr="-r",
            min_ver="2.1.0",
            usedefault=True,
        ),
        save_bias=dict(
            mandatory=True,
            usedefault=True,
            xor=["bias_image"],
        ),
        shrink_factor=dict(
            argstr="--shrink-factor %d",
        ),
        weight_image=dict(
            argstr="--weight-image %s",
            extensions=None,
        ),
    )
    inputs = N4BiasFieldCorrection.input_spec()

    for key, metadata in list(input_map.items()):
        for metakey, value in list(metadata.items()):
            assert getattr(inputs.traits()[key], metakey) == value


def test_N4BiasFieldCorrection_outputs():
    output_map = dict(
        bias_image=dict(
            extensions=None,
        ),
        output_image=dict(
            extensions=None,
        ),
    )
    outputs = N4BiasFieldCorrection.output_spec()

    for key, metadata in list(output_map.items()):
        for metakey, value in list(metadata.items()):
            assert getattr(outputs.traits()[key], metakey) == value
