MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / Transpose

Class Transpose

monai/transforms/utility/array.py:571–586  ·  view source on GitHub ↗

Transposes the input image based on the given `indices` dimension ordering.

Source from the content-addressed store, hash-verified

569
570
571class Transpose(Transform):
572 """
573 Transposes the input image based on the given `indices` dimension ordering.
574 """
575
576 backend = [TransformBackends.TORCH]
577
578 def __init__(self, indices: Sequence[int] | None) -> None:
579 self.indices = None if indices is None else tuple(indices)
580
581 def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
582 """
583 Apply the transform to `img`.
584 """
585 img = convert_to_tensor(img, track_meta=get_track_meta())
586 return img.permute(self.indices or tuple(range(img.ndim)[::-1])) # type: ignore
587
588
589class SqueezeDim(Transform):

Callers 4

__init__Method · 0.90
inverseMethod · 0.90
run_training_testFunction · 0.90
test_transposeMethod · 0.90

Calls

no outgoing calls

Tested by 2

run_training_testFunction · 0.72
test_transposeMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…