List of commands

This page contains auto-generated documentation from the source code docstrings.

NeuroSlice package initialization.

neuroslice.mask2cuboid(mask: ndarray) ndarray[source]

Convert a binary mask to its bounding cuboid mask.

Parameters:

mask (numpy.ndarray) – 3D binary mask.

Returns:

3D binary mask of the bounding cuboid.

Return type:

numpy.ndarray

neuroslice.predict(data: ndarray, axis: int, verbose: bool = False) ndarray[source]

Generate a binary tumor mask from a 3D image array using a trained YOLO model.

Parameters:
  • data (numpy.ndarray) – 3D image array (e.g., FLAIR image).

  • axis (int) – Axis along which to slice the 3D image (0: sagittal, 1: coronal, 2: axial).

  • verbose (bool) – Whether to print statistics.

Returns:

Binary mask of detected tumor regions.

Return type:

numpy.ndarray

neuroslice.predict_mask(nifti_path: str, axis: int | list, verbose: bool = False, mode: str = None, save_path: str = None)[source]

Generate a binary tumor mask from a 3D NIfTI image using a trained YOLO model.

Parameters:
  • nifti_path (str) – Path to the input NIfTI file (e.g., FLAIR image).

  • axis (int or list of int) – Axis or list of axes along which to slice the 3D image (0: sagittal, 1: coronal, 2: axial).

  • verbose (bool) – Whether to print statistics.

Returns:

Binary mask of detected tumor regions.

Return type:

numpy.ndarray

neuroslice.predict_multi_axis(data: ndarray, axes: list, verbose: bool = False)[source]

Generate a binary tumor mask from a 3D image array using a trained YOLO model along multiple axes.

Parameters:
  • data (numpy.ndarray) – 3D image array (e.g., FLAIR image).

  • axes (list of int) – List of axes along which to slice the 3D image (0: sagittal, 1: coronal, 2: axial).

  • verbose (bool) – Whether to print statistics.

Returns:

Combined binary mask of detected tumor regions.

Return type:

numpy.ndarray

neuroslice.unite_masks(*masks: ndarray) ndarray[source]

Combine multiple binary masks into one using union or cuboid.

Parameters:

*masks (numpy.ndarray) – Multiple binary masks to combine.

Returns:

Union of the binary masks listed.

Return type:

numpy.ndarray