Axes
AxesType
validate_axes(axes)
Validate a 3-character axis string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axes
|
str
|
Axis string to validate. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated string (unchanged). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the string is not a valid axis specification. |
Source code in src/torchio/data/axes.py
axes_type(axes)
Return whether axes is a voxel or anatomical axis string.
The string must already be valid (call
validate_axes first).
Source code in src/torchio/data/axes.py
get_axis_mapping(src, tgt)
Compute the column permutation and flips to go from src to tgt.
Both strings must be the same type (both voxel or both anatomical).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
str
|
Source axis string. |
required |
tgt
|
str
|
Target axis string. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, int, int]
|
A tuple |
tuple[bool, bool, bool]
|
source column index for each target column and flips indicates |
tuple[tuple[int, int, int], tuple[bool, bool, bool]]
|
whether each target column should be negated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the two strings are not the same type. |