dosma.core.orientation.get_transpose_inds

dosma.core.orientation.get_transpose_inds(curr_orientation: tuple, new_orientation: tuple)[source]

Get indices for reordering planes from curr_orientation to new_orientation.

Only permuted order of reformatting the image planes is returned. For example, ("SI", "AP", "LR") and ("IS", "PA", "RL") will have no permuted indices because “SI”/”IS”, “AP”/”PA” and “RL”/”LR” each correspond to the same plane.

Parameters
  • curr_orientation (tuple[str]) – Current image orientation.

  • new_orientation (tuple[str]) – New image orientation.

Returns

Axes to transpose to change orientation.

Return type

tuple[int]

Examples

>>> get_transpose_inds(("SI", "AP", "LR"), ("AP", "SI", "LR"))
(1,0,2)
>>> get_transpose_inds(("SI", "AP", "LR"), ("IS", "PA", "RL"))
(0,1,2)