-
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
Certain Transformations disregard *args and **kwargs (including copy) #1223
Comments
Hi @nicoloesch. Can you please explain why this is important? I'm not sure I understand the practical implications, and your snippet seems to work as expected. |
Hi @fepegar, The main argument of me filling this as a bug is the absence of E.g. if the user instantiates The reason I filled this bug is the relation to #1222 as we can instantiate As mentioned before, it extends beyond the A better way to visualise the potentially faulty outcome would be to utilise |
Yes I agree and the problem is quite general, (and important) because random transform always call non random transform at the end, without passing the copy argument (I should have put the comment here instead) Note that when RandomAffine construct the Affine transform, the include / exclude argument are passed ... For the proba p, I would say this is the only exception : We do not want to pass it through because it has already been taken into account. (So if RandomAffine pass it to Affine, then we would have a probability of p*p instead of p ...) |
Hi @romainVala, Thanks for also having a closer look! I totally agree with your comment and will change the stacking or probabilities such that we are not having a p*p probability for transforms that re-utilise already defined transforms (such as all |
Is there an existing issue for this?
Bug summary
Certain children of the base class
torchio.Transform
do not adhere to the *args and **kwargs provided during__init__
as they utilise already existing transformations inapply_transform
. This mainly includes the kwargcopy
, which is not passed to the transform utilised inapply_transform
. However, other attributes may be required depending on the circumstances.Examples of this are:
torchio.transforms.preprocessing.spatial.crop_or_pad.CropOrPad
: L.282 and L.286 -> no instantiation ofCrop
/Pad
withself.copy
torchio.transforms.preprocessing.label.sequential_labels.SequentialLabels
: L. 55 -> no instantiation ofRemapLabels
withself.copy
torchio.transforms.preprocessing.spatial.ensure_shape_multiple.EnsureShapeMultiple
: L.136 -> no instantiation ofCropOrPad
withself.copy
torchio.transforms.preprocessing.spatial.resize.Resize
: L. 75 -> no instantiation ofCropOrPad
withself.copy
This extends to any transformation that re-utilises an already defined base transformation.
Code for reproduction
Actual outcome
The underlying transform in
apply_transform
is not called withcopy=False
as intended in the Constructor. This results in the copying of the respective copying of theSubject
despite not defined by the user.Error messages
No response
Expected outcome
All *args and **kwargs of any
Transform
should be passed onto each temporary/placeholder transform duringapply_transform
if it utilises an already implementedTransform
opposed to a standalone implementation.System info
The text was updated successfully, but these errors were encountered: