Skip to content

Is there a way to perform an inverse transformation on data that is not in tio format? #1168

Answered by romainVala
Bigsealion asked this question in Q&A
Discussion options

You must be logged in to vote

Hello
the parameters, needed for the inverse_transform are stored in torchio subject (that has been transformed)
So you need to go with a torchio subject, you can adapt your code like that:

array = np.random.rand(1, 256, 256, 159)
suj_tio = torchio.Subject(t1=torchio.ScalarImage(tensor=array))
suj_aug = tio_transform(suj_tio)

mask_predicted = model(suj_aug.t1.data)
suj_aug.add_image(torchio.ScalarImage(tensor = mask_predicted),'predicted_mask')
suj_back = suj_aug.apply_inverse_transform() #so it should apply to both image in subject (t1 and predicted_mask)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Bigsealion
Comment options

Answer selected by fepegar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants