question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RandomAffine and RandomElasticDeformation on differently sized and oriented images

See original GitHub issue

🚀 Feature We have a full size image and then small FoV labels with a higher resolution. Sadly the RandomAffine and RandomElasticDeformation augmentations do not run for this due to the size difference. We can not upscale the labels since this would not fit the RAM. We have to perform all augmentations on the individually sized images.

Motivation

For us this would be very helpful. We are mostly working with MONAI but frankly, the augmentations of torch.io are just better. The respective MONAI augmentations also do not support this. They do not throw an error like torch.io does (which in this case is better) but they output images which longer fit in terms of their affine (and probably also not in terms of the augmentation).

Would you need example files for that? Is this something to consider?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Spenhouetcommented, Nov 12, 2021

@romainVala After the data augmentations (and some other operations) we perform a crop on the T1 (and respectively on the labels) based on the bounding box of the labels. We then also upscale the T1 and merge all labels (which still have different box sizes and affines). So in the end we have a small FoV for the image and the labels with matching shapes. But the augmentations are performed globally. Performing the augmentations only on the FoV would give unrealistic results.

Example output (augmented): image Same image, heavier augmentations: image

1reaction
fepegarcommented, Nov 11, 2021

@fepegar I’m happy with what ever you have time for +1

Ok, I’ll open the PR and ping you.

I can split it of into a separate feature request?

I think we don’t need to. However, I really won’t be able to tackle the elastic one. Contributions are of course welcome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Augmentation - TorchIO - Read the Docs
Augmentation transforms generate different results every time they are called. ... Apply a random affine transformation and resample the image. Parameters:.
Read more >
TorchIO: A Python library for efficient loading ... - arXiv
Images are incorrectly superimposed if (b) origin, (c) orientation or (d) spacing are ignored. the size of the training dataset artificially ...
Read more >
Transforms — MONAI 1.1.0 Documentation
This allows, for example, images to be cropped, rotated, padded, etc., during training and inference, and after be returned to their original size...
Read more >
How to perform random affine transformation of an image?
RandomAffine () transformation accepts both PIL and tensor images. ... output image transformed with different degrees because RandomAffine() ...
Read more >
torchio - PyPI
Tools for loading, augmenting and writing 3D medical images on PyTorch. ... vision operations such as random affine transformations and also domain-specific ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found