Comments (3)
what is your use case ?
I can imagine that if you want to train a coregistration task then you want to know the Affine transform that has been applied with the RadomAffine transform
Well all information is in the subject history
import torchio as tio
s=tio.datasets.Colin27()
tr=tio.RandomAffine()
st=tr(s)
st.history
Out[13]: [Affine(scales=(1.0134488344192505, 0.9747917056083679, 0.9191530346870422), degrees=(-6.250537872314453, 9.650617599487305, -0.15413999557495117), translation=(0.0, 0.0, 0.0), center=image, default_pad_value=minimum, default_pad_label=-1, image_interpolation=linear, label_interpolation=nearest, check_shape=True)]
Now having this information is just half of the job, you then need to construct the corresponding Affine matrix
Unfortunately this will depend on the software used to apply it
for instance sitk or nibabel ... since they have a different convention (on the voxel order) they have different Affine (for coding the same displacement)
Going trough this is always a lot of pain ... good luck if you need it ...
from torchio.
hello
your code for reproduction is difficult to understand ...
if I understand correctly the question: why the volume affine does not change after deformation (RandomAffine or RandomElastic)
Yes it is expected
For pure translation for instance, I can understand the question. (it has something to do with a passive or active referential choice)
If you change the affine (to account for the translation) then technically both volume are then identical ... (ie the vixek grid data will not changed ... just the header)
This is not what we want. We want to simulate to subject translation while acquiring the same FOV, so a translation of the object within the same FOV (so the Volume affine does not change)
for non linear deformation like RandomElastic there is no other solution ... (we locally deformed the shape) but still keeping the same grid
does it make sense ?
from torchio.
Hi @romainVala,
excuse me for the "code reproduction", I did not really know how to describe it properly with code.
Thank you very much for the answer, I see your point.
The reason I was asking is that I would like to have both the transformed image and the transformation after applying e.g. RandomAffine to one of my images. I was expecting that this will be somehow reflected in the header affine, but now I understand your point.
Thank you once again for your answer :)
from torchio.
Related Issues (20)
- Suggestions the modifying default value of prefetch_factor and the argument to set it for minimize the blocking-bottleneck between fetch subject and generate patch in Queue HOT 1
- Different transforms applied to CT and label HOT 11
- Custom loader not used when loading data lazily HOT 2
- Seed is not working HOT 2
- Silenced exception makes it harder to debug custom Transforms HOT 5
- Resample
- tio.Resample does not work with custom image class HOT 2
- Setting NUM_SAMPLES when using sampler with Queue HOT 3
- RescaleIntensity - multiple calls HOT 9
- Return sampled parameters upon request HOT 3
- Halve queue length when using DDP HOT 2
- bug in rotation part of tio.transforms.RandomAffine HOT 4
- get_subjects_from_batch has a hick-up with int metadata HOT 5
- masking_method in Mask class is not saved as argument (preventing applying the inverse transform)
- RandomAffine raises an error when isotropic=True and 3 elements are given for scales HOT 10
- Queue is not respecting the batch size HOT 1
- Resample an image by providing only the target affine HOT 1
- Supporting PyTorch 2.3 HOT 17
- Cannot copy subclass of Subject with keyword arguments HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchio.