Skip to content

Radiology inference breaks on MONAI 1.6 (Spacingd and NibabelWriter regressions upstream) #1921

Open

Description

@garciadias

Problem

requirements.txt pins only monai>=1.4.0, so a fresh install picks up MONAI 1.6.x. Two MONAI core regressions in 1.6 affect MONAI Label:

  1. Spacingd (Spacingd crashes when the data dict has a non-dict key starting with '<key>_' (regression in 1.6.0) MONAI#9165, fix proposed in Fix Spacingd updating non-metadata entries that share the key prefix MONAI#9167). Spacingd now calls .update() on every "<key>_*" entry. BasicInferTask always adds the string data["image_path"] (monailabel/tasks/infer/basic_infer.py), and the radiology sample app uses Spacingd("image", ...) in many infer and train pipelines. As a result, NIfTI inference raises AttributeError: 'str' object has no attribute 'update'. This is what made tests/unit/scribbles/test_transforms_infer.py::test_histogram_graphcut_inferer_* fail.

  2. NibabelWriter with 2D arrays (NibabelWriter fails on 2D channel-less arrays with no target affine (regression in 1.6.0) MONAI#9166). Writing a 2D channel-less array with NibabelWriter and no target affine raises TypeError: '>=' not supported between 'NoneType' and 'int'. This affects monailabel.transform.writer.write_nifti.

Both work on MONAI 1.5.1.

Status

  • Item 2 has a behaviour-preserving workaround in write_nifti: pass the input spatial shape explicitly when there is no target affine. Output is identical on 1.5.1 and 1.6.1.
  • Item 1 must be fixed in MONAI (Fix Spacingd updating non-metadata entries that share the key prefix MONAI#9167). Until a fixed MONAI is released, the two graphcut tests are marked non-strict xfail on MONAI >= 1.6. Once MONAI releases the fix, remove the xfail and consider raising the minimum MONAI version.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions