liom_toolkit.visualization.slice_extraction module

liom_toolkit.visualization.slice_extraction.colour_image(slice_image: ndarray, colour_dict: list)

Colour an image based on a colour dictionary

Parameters:
  • slice_image (np.ndarray) – The slice to colour

  • colour_dict (list) – The colour dictionary

Returns:

The coloured image

Return type:

np.ndarray

liom_toolkit.visualization.slice_extraction.extract_and_save_slice_form_zarr(zarr_file: str, z: int, data_dir: str, channel: int = 0, resolution_level: int = 0, name: str = 'S1')

Extracts a single slice from a 3D volume and saves it to disk

Parameters:
  • zarr_file (str) – Path to the zarr file

  • z (int) – Z index of the slice

  • data_dir (str) – Directory to save the slice

  • channel (int) – Channel to extract

  • resolution_level (int) – Resolution level to extract

  • name (str) – Name of the volume

Returns:

The extracted slice

Return type:

np.ndarray

liom_toolkit.visualization.slice_extraction.extract_and_save_slices_form_zarr(zarr_file: str, start_z: int, num_slices: int, data_dir: str, channel: int = 0, resolution_level: int = 0, name: str = 'S1', save_mip: bool = False) ndarray

Extracts slices from a 3D volume and saves them to disk

Parameters:
  • zarr_file (str) – Path to the zarr file

  • start_z (int) – Z index of the slice

  • num_slices (int) – Number of slices to extract

  • data_dir (str) – Directory to save the slices

  • channel (int) – Channel to extract

  • resolution_level (int) – Resolution level to extract

  • name (str) – Name of the volume

  • save_mip (bool) – Whether to save the maximum intensity projection

Returns:

3D volume with the extracted slices

Return type:

np.ndarray

liom_toolkit.visualization.slice_extraction.extract_label_slice(zarr_file: str, z: int, label: str, resolution_level: int = 0) ndarray

Extracts a single slice from a 3D volume

Parameters:
  • zarr_file (str) – Path to the zarr file

  • z (int) – Z index of the slice

  • label (str) – The type of label

  • resolution_level (int) – Resolution level to extract

Returns:

The extracted slice

Return type:

np.ndarray

liom_toolkit.visualization.slice_extraction.extract_single_slice_from_zarr(zarr_file: str, z: int, channel: int = 0, resolution_level: int = 0) ndarray

Extracts a single slice from a 3D volume

Parameters:
  • zarr_file (str) – Path to the zarr file

  • z (int) – Z index of the slice

  • channel (int) – Channel to extract

  • resolution_level (int) – Resolution level to extract

Returns:

The extracted slice

Return type:

np.ndarray

liom_toolkit.visualization.slice_extraction.extract_slices_form_zarr(zarr_file: str, start_z: int, num_slices: int, channel=0, resolution_level=0) ndarray

Extracts slices from a 3D volume

Parameters:
  • zarr_file (str) – Path to the zarr file

  • start_z (int) – Z index of the slice

  • num_slices (int) – Number of slices to extract

  • channel (int) – Channel to extract

  • resolution_level (int) – Resolution level to extract

Returns:

3D volume with the extracted slices

Return type:

np.ndarray

liom_toolkit.visualization.slice_extraction.save_atlas_slice(zarr_file: str, z: int, data_dir: str, resolution_level: int = 0, name: str = 'S1') ndarray

Extracts a single slice from a 3D volume and saves it to disk

Parameters:
  • zarr_file (str) – Path to the zarr file

  • z (int) – Z index of the slice

  • data_dir (str) – Directory to save the slice

  • resolution_level (int) – Resolution level to extract

  • name (str) – Name of the volume

Returns:

The extracted slice

Return type:

np.ndarray

liom_toolkit.visualization.slice_extraction.save_vessel_slice(zarr_file: str, z: int, data_dir: str, colour_vessels: bool, resolution_level: int = 0, name: str = 'S1') ndarray

Extracts a single vessel slice from a 3D volume and saves it to disk

Parameters:
  • zarr_file (str) – Path to the zarr file

  • z (int) – Z index of the slice

  • data_dir (str) – Directory to save the slice

  • colour_vessels (bool) – Whether to colour the vessels according to the allen atlas

  • resolution_level (int) – Resolution level to extract

  • name (str) – Name of the volume

Returns:

The extracted slice

Return type:

np.ndarray