Giter VIP home page Giter VIP logo

Comments (3)

romainVala avatar romainVala commented on August 23, 2024 2

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.

romainVala avatar romainVala commented on August 23, 2024

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.

vasl12 avatar vasl12 commented on August 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.