Project-MONAI / Project-MONAI/MONAI

Lazy resampling: MetaTensor.applied_operations ends up out of order

Open
#6,439 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Design discussions
Dominant language
Python
Stars
8.7k
Forks
1.6k
Avg merge
5d 1h
Merged PRs (30d)
20

Description

Describe the bug
When executing pipelines with lazy resampling, the applied_operations list on a MetaTensor instance can end up out of order.

To Reproduce
Steps to reproduce the behavior:

  1. Run tests/test_integration_lazy_samples.py
  2. Add a breakpoint at https://github.com/Project-MONAI/MONAI/blob/4f291723c4ce1a1baf7efbd499495b777dfb1869/tests/test_integration_lazy_samples.py#L155
  3. Examine the state of batch_data and you'll see that the applied operations are out of order. Lambdad is the last transform in the pipeline, but appears as the first element in the pipeline

Correct order:

[SpatialResample, Orientation, RandRotate90d, RandCropByPosNegLabel, RandRotated, RandZoomd, ResizeWithPadOrCrop, Rotate, Lambdad]

Observed order:

[Lambdad, SpatialResample, Orientation, RandRotate90d, RandCropByPosNegLabel, RandRotated, RandZoomd, ResizeWithPadOrCrop, Rotate]

Note that this issue is fixed in #6257

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/test_integration_lazy_samples.py at line 155 and inspect batch_data during the lazy resampling pipeline. Compare the observed applied_operations order with the expected list in the issue, then review the referenced fix in #6257; done means the integration test shows operations in pipeline order.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.