-
Notifications
You must be signed in to change notification settings - Fork 240
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
Transforms and samplers order in queue / transformrs after sampling #445
Comments
Hi, @PeterMcGor. Which transforms would you like to use? I suppose a |
Hi! For example, intensity transformations based on the patch stats, or spatial ones. I guess a best example could be an 2D architecture which employ 2D patches. Depending on the setup, some works standardise/normalise the values taking the whole datasets, the volume or the slice. Cheers! |
If it's for 2D patches and speed is not super critical, you might get away with applying the transform with a single process: In [1]: import torchio as tio
In [2]: transform = tio.Compose([tio.RescaleIntensity(), tio.RandomFlip((0, 1))])
In [3]: import torch
In [4]: image = tio.ScalarImage(tensor=torch.rand(1, 256, 256, 1))
In [5]: %timeit transform(image)
1.32 ms ± 54.7 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
In [6]: transform = tio.Compose([tio.RescaleIntensity(), tio.RandomFlip((0, 1)), tio.RandomElasticDeformation()])
In [7]: %timeit transform(image)
54.5 ms ± 3.03 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
In [8]: transform = tio.Compose([tio.RescaleIntensity(), tio.RandomFlip((0, 1)), tio.RandomAffine()])
In [9]: %timeit transform(image)
4.54 ms ± 426 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) |
Closing this unless there is a specific request. Feel free to reopen. |
🚀 Feature
Hey again!
In the current version, the order of transforms and sampling in the queue is fixed as is clearly explained here.
Sometimes, transformations need to be done (or obviously present different results when are applied on...) on the patches instead of the original image, although, there some workarounds, it could be nice to have some built-in option within the
Queue
object to specify some transformation after the patch creation.Motivation
Allow defining patch-based transformations
Alternatives
I have been looking through old issues but I could not find something related, probably I am wrong so please let me know in that case.
Best!
The text was updated successfully, but these errors were encountered: