Skip to content

Different image_interpolation arguments for each element of a dictionary input #421

Answered by fepegar
stalhabukhari asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, I think I was right to suspect that you don't need a dict at all. If you run:

input_subj = torchio.Subject({'data': torchio.ScalarImage(tensor=data_volume), 'label': torchio.LabelMap(tensor=label_volume)})
# Alternative syntax
input_subj = torchio.Subject(data=torchio.ScalarImage(tensor=data_volume), label=torchio.LabelMap(tensor=label_volume))
fn = torchio.transforms.RandomAffine()
output_subj = fn(input_subj)

you will have applied the same transform to both images. The resampling is nearest neighbor for label maps, and linear by default for everything else. And the transform is applied to all images by default, so you don't need include at all.
Basically, you don't need to specify a…

Replies: 3 comments 2 replies

Comment options

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

Comment options

You must be logged in to vote
0 replies
Answer selected by fepegar
Comment options

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

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