Crop
Bases: SpatialTransform
Remove a border of voxels from each side of the volume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cropping
|
CroppingParam
|
Tuple \((i_\text{ini}, i_\text{fin}, j_\text{ini}, j_\text{fin}, k_\text{ini}, k_\text{fin})\) defining the number of voxels cropped from the edges of each axis. If the initial shape of the image is \(I \times J \times K\), the final shape will be \((I - i_\text{ini} - i_\text{fin}) \times (J - j_\text{ini} - j_\text{fin}) \times (K - k_\text{ini} - k_\text{fin})\). If only three values \((i, j, k)\) are provided, then \(i_\text{ini} = i_\text{fin} = i\), \(j_\text{ini} = j_\text{fin} = j\) and \(k_\text{ini} = k_\text{fin} = k\). If only one value \(n\) is provided, then \(i_\text{ini} = i_\text{fin} = j_\text{ini} = j_\text{fin} = k_\text{ini} = k_\text{fin} = n\). |
required |
**kwargs
|
Any
|
See |
{}
|
Examples:
>>> import torchio as tio
>>> transform = tio.Crop(cropping=10)
>>> # Equivalent to
>>> transform = tio.Crop(cropping=(10, 10, 10))
>>> # Equivalent to
>>> transform = tio.Crop(cropping=(10, 10, 10, 10, 10, 10))
Source code in src/torchio/transforms/spatial/crop.py
forward(data)
Apply the transform.
The output type always matches the input type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
Input data to transform. |
required |
Source code in src/torchio/transforms/transform.py
to_hydra()
Export as a Hydra-compatible config dict.
Returns a dict with _target_ set to the fully qualified
class name and only non-default field values included.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict suitable for |