Questions about lazy transforms #6710
Replies: 3 comments
-
Hi @function2-llx, thanks for your interest here!
FYI, we also have several tutorials that you can refer to. Thanks! |
Beta Was this translation helpful? Give feedback.
-
yes, the src/dst and transform conversion is mainly to make the API generic, it's also used here MONAI/monai/data/image_writer.py Line 208 in 17c1e3a and indirectly here MONAI/monai/data/itk_torch_bridge.py Line 68 in 17c1e3a |
Beta Was this translation helpful? Give feedback.
-
Hi @function2-llx, just seen this referenced from #7139. I'll address each point in turn:
|
Beta Was this translation helpful? Give feedback.
-
Dear MONAI team and community,
I recently tried the feature of lazy transform, and it's amazing, thank you for your work on this! Currently, I've got some minor questions.
The first question is about lazy resample. From my understanding, when applying pending transforms, transform affine matrix will be accumulated and a spatial resample will be performed at last. The implementation of
SpatialResample
solves the transform affine fromsrc_affine
todst_affine
:MONAI/monai/transforms/spatial/functional.py
Line 128 in 17c1e3a
This seems a little redundant (and may very slightly lose some numerical precision) since
dst_affine
is obtained by multiplying the initial affine matrix (i.e.,src_affine
) and the accumulated transform affine matrix:MONAI/monai/transforms/lazy/utils.py
Line 191 in 17c1e3a
Well, after all, the current implementation works pretty fine, I'm just curious about this.
The second question (or maybe a feature request) is about the compose transform. It seems that the compose transform always applies all pending transforms at last:
MONAI/monai/transforms/compose.py
Line 114 in 17c1e3a
However, I feel that sometimes I would like it to be optional, e.g., when performing some intermediate transforms, I use
Compose
to construct a series of lazy transforms, and I don't want the pending transforms to be applied at once.Any comments will be appreciated.
Best wishes
Beta Was this translation helpful? Give feedback.
All reactions