nondefaced_detector.prediction._structural_slice¶
-
_structural_slice(x, plane, n_slices=16)[source]¶ Transpose dataset and get slices from the volume based on the plane.
- Parameters
x (
tf.Tensor) – The input MRI volume/dataset to sample slices from.plane (one of ["sagittal", "coronal", "axial", "combined"]) – The axes of the plane to get the slices for. If “combined”, the input is sliced for all 3 axes.
n_slices (int, optional, default=16) – The number of 2D slices to cut along the input plane. n_slices are randomly sampled from the input volume.
- Returns
A tensor of shape (n_slices, x.shape) or A dict with keys [‘sagittal’, ‘coronal’, ‘axial’] each with a value of tensors of shape (n_slices, x.shape)
- Return type
tf.Tensor