Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] inpainting metrics are not computed correctly #957

Open
neuronflow opened this issue Oct 10, 2024 · 1 comment
Open

[BUG] inpainting metrics are not computed correctly #957

neuronflow opened this issue Oct 10, 2024 · 1 comment

Comments

@neuronflow
Copy link

GNDLF produces metrics that are different from our official inpainting package (https://pypi.org/project/inpainting/).

To compute metrics with the official package:

pip install inpainting
from inpainting.challenge_metrics_2023 import generate_metrics, read_nifti_to_tensor


def compute_image_quality_metrics(
    prediction: str,
    healthy_mask: str,
    reference_t1: str,
    voided_t1: str,
) -> dict:
    print("computing metrics!")
    print("prediction:", prediction)
    print("healthy_mask:", healthy_mask)
    print("reference_t1:", reference_t1)
    print("voided_t1:", voided_t1)

    prediction_data = read_nifti_to_tensor(prediction)
    healthy_mask_data = read_nifti_to_tensor(healthy_mask).bool()
    reference_t1_data = read_nifti_to_tensor(reference_t1)
    voided_t1_data = read_nifti_to_tensor(voided_t1)

    metrics = generate_metrics(
        prediction=prediction_data,
        target=reference_t1_data,
        normalization_tensor=voided_t1_data,
        mask=healthy_mask_data,
    )

    return metrics


if __name__ == "__main__":
    official_metrics = compute_image_quality_metrics(
    prediction="path_to_prediction.nii.gz",
    healthy_mask"path_to_healthy_mask.nii.gz",
    reference_t1"path_to_reference.nii.gz",
    voided_t1"path_to_voided.nii.gz",
    )
    
    print(official_metrics)


@MarcelRosier will upload some test data to reproduce.

@MarcelRosier
Copy link

MarcelRosier commented Oct 10, 2024

Test data: INP-BraTS-GLI-00000-000.zip
(The Prediction was generated using last years winning algorithm)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants