Skip to content

[BUG] defaultvalue for padding when registering without skull stripping seems to be off #153

@LMZimmer

Description

@LMZimmer

Description
When rotating an image in the registration the edges require padding. When including skull stripping by specifying a bet path in the modalities everything works smoothly. However, when only performing registration, the padding values seem to be the mean across the image causing "grey boxes". Passing ants.apply_transform's parameter "defaultvalue" does not change the outcome.

Versions
antspyx==0.6.1
brainles_preprocessing==0.6.3

Reproducability
To reproduce place "t1c.nii.gz" and "flair.nii.gz" in the same directory as this script and run it:

from pathlib import Path
from brainles_preprocessing.modality import Modality, CenterModality
from brainles_preprocessing.normalization.percentile_normalizer import (
    PercentileNormalizer,
)
from brainles_preprocessing.preprocessor import AtlasCentricPreprocessor
from brainles_preprocessing.registration import ANTsRegistrator


def main_no_skullstrip():
    patient_folder = Path(".")

    percentile_normalizer = PercentileNormalizer(
            lower_percentile=0.1,
            upper_percentile=99.9,
            lower_limit=0,
            upper_limit=1,
            )

    center = CenterModality(
            modality_name="t1c",
            input_path=patient_folder / "t1c.nii.gz",
            normalizer=percentile_normalizer,
            normalized_skull_output_path="no_skull_strip/t1c_normalized.nii.gz"
            )

    moving_modalities = [
            Modality(
                modality_name="flair",
                input_path=patient_folder / "flair.nii.gz",
                normalizer=percentile_normalizer,
                normalized_skull_output_path="no_skull_strip/flair_normalized.nii.gz",
                )
            ]

    # Adding this registrator yields the same result as using the default one
    registrator = ANTsRegistrator(transformation_params={"defaultvalue": 0})
    preprocessor = AtlasCentricPreprocessor(
        center_modality=center,
        moving_modalities=moving_modalities,
        registrator=registrator,
    )
    preprocessor.run()

if __name__ == "__main__":
    main_no_skullstrip()

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions