Each topic folder (croppad, intensity, io, post, signal, and the
others) splits into array.py and dictionary.py. The array class works on a
single array or MetaTensor (for example LoadImage in io/array.py); the
dictionary class applies the same operation per key of a dict and usually ends
in d (LoadImaged in io/dictionary.py). A fix for a transform almost
always needs both variants, plus their tests.
- Random transforms derive from
RandomizableTransformand draw fromself.R, set throughset_random_state. Never use the globalrandomornumpy.randominside a transform:Composeand the data loaders seed each transform per sample, and global state breaks reproducibility and worker safety. - Transforms run in multiple data loader worker processes.
RandomizableTransformmay store sampled parameters onselffor the current call or for explicitrandomize=Falsereuse. Do not share one transform instance across concurrent calls or rely on prior-call state unless the API explicitly requests reuse. - Many transforms are invertible and record what they did through
MetaTensorapplied operations andInvertibleTransformtracing. If you change a transform's parameters or geometry handling, check the inverse path (monai/transforms/inverse.py) andInvertdtests still make sense. - Lazy transforms live in
lazy/; changes to resampling behavior can affect both the eager and the lazy execution of the same transform. Readdocs/source/lazy_resampling.rstbefore touching resample logic. - Dictionary transforms take
keysand share one code path throughMapTransform; missing-key behavior is controlled byallow_missing_keys, do not invent a new flag for it. - New transforms must be exported from the topic folder and from
monai/transforms/__init__.py, and listed indocs/source/transforms.rst.