Skip to content

Image intensity augmentations #1187

@IDoCodingStuffs

Description

@IDoCodingStuffs

🚀 Feature
Transforms that shift voxel intensity, such as intensity flipping (i.e. 1 - val, val in [0, 1]), cluster and remap, contrast jitter etc.

Motivation
I am working on a spine segmentation problem on MRI images where I need to train a model to perform in multiple pulse sequence modalities, but training data has only a single modality. As such, models tend to pick up on intensity features and perform very poorly on different modalities with different intensity distributions. (see the middle image vs others)

image

Pitch
Adding transforms to shift intensity features would allow models to pick up on shapes and contours rather than learning intensity values as features.

Alternatives
One very basic approach could be something like this

class RandomFlipIntensity:
    def __call__(self, input: tio.Subject, p=0.5):
        if np.random.random() <= p:
            max_intensity = torch.max(input["image"].tensor)
            min_intensity = torch.min(input["image"].tensor)
            flipped_intensity = max_intensity - input["image"].tensor + min_intensity
            input = tio.Subject(
                image=tio.ScalarImage(tensor=flipped_intensity),
                segmentation=tio.LabelMap(tensor=input["segmentation"].tensor),
            )
        return input

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions