liom_toolkit.utils.conversion module
- liom_toolkit.utils.conversion.convert_hdf5_to_nifti(hdf5_file: str, nifti_file: str) None
Convert a HDF5 file to a NIFTI file.
- Parameters:
hdf5_file (str) – Path to the HDF5 file.
nifti_file (str) – Path to the NIFTI file.
- liom_toolkit.utils.conversion.convert_hdf5_to_zarr(hdf5_file: str, zarr_file: str, use_memmap: bool = True, remove_stripes: bool = False, scales: tuple = (6.5, 6.5, 6.5), chunks: tuple = (128, 128, 128), base_key: str = 'reconstructed_frame') None
Convert a HDF5 file from the lightsheet microscope to a zarr file.
- Parameters:
hdf5_file (str) – Path to the HDF5 file.
zarr_file (str) – Path to the zarr file.
use_memmap (bool) – Whether to use a memmap or not.
remove_stripes (bool) – Whether to remove stripes from the data.
scales (tuple) – The resolution of the image, in z y x order.
chunks (tuple) – The chunk size to use.
base_key (str) – The base key of the HDF5 key list.
- liom_toolkit.utils.conversion.convert_nifti_to_zarr(nifti_file: str, zarr_file: str, scales: tuple = (6.5, 6.5, 6.5), chucks: tuple = (128, 128, 128), transpose: bool = False) None
Convert a NIFTI file to a zarr file.
- Parameters:
nifti_file (str) – The NIFTI file to convert.
zarr_file (str) – The zarr file to save to.
scales (tuple) – The resolution of the image, in z y x order.
chucks (tuple) – The chunk size to use in the zarr file.
transpose (bool) – Whether to transpose the data or not.
- liom_toolkit.utils.conversion.convert_nrrd_to_zarr(nrrd_file: str, zarr_file: str, scales: tuple = (6.5, 6.5, 6.5), chucks: tuple = (128, 128, 128)) None
Convert a NRRD file to a zarr file.
- Parameters:
nrrd_file (str) – The NRRD file to convert.
zarr_file (str) – The zarr file to save.
scales (tuple) – The resolution of the image, in z y x order.
chucks (tuple) – The chunk size to use in the zarr file.
- liom_toolkit.utils.conversion.create_full_zarr_volume(auto_fluo_file: str, vascular_file: str, zarr_file: str, template_path: str, scales: tuple = (6.5, 6.5, 6.5), chunks: tuple = (128, 128, 128)) None
Create a full zarr volume from the auto-fluorescence and vascular data. The annotations will be aligned to the auto-fluorescence data and saved to the zarr file. The mask will also be created and saved to the zarr file.
- Parameters:
auto_fluo_file (str) – The path to the auto-fluorescence hdf5 file.
vascular_file (str) – The path to the vascular hdf5 file.
zarr_file (str) – The path to the zarr file to save the volume to.
template_path (str) – The path to the template to align the annotations to.
scales (tuple) – The physical resolution of the volume per axis.
chunks (tuple) – The chunk size to use for the volume.
- liom_toolkit.utils.conversion.create_multichannel_zarr(auto_fluo_file: str, vascular_file: str, zarr_file: str, scales: tuple = (6.5, 6.5, 6.5), chunks: tuple = (128, 128, 128)) None
Create a multichannel zarr file from the auto-fluorescence and vascular data.
- Parameters:
auto_fluo_file (str) – The path to the auto-fluorescence hdf5 file.
vascular_file (str) – The path to the vascular hdf5 file.
zarr_file (str) – The path to the zarr file to save the volume to.
scales (tuple) – The physical resolution of the volume per axis.
chunks (tuple) – The chunk size to use for the volume.
- Returns:
- liom_toolkit.utils.conversion.load_hdf5(hdf5_file: str) Array
Load the data from a HDF5 file. If use_mem_map is True, the data will be saved to a memmap file to save memory.
- Parameters:
hdf5_file (str) – The HDF5 file to load.
- Returns:
The data from the HDF5 file.
- Return type:
da.Array
- liom_toolkit.utils.conversion.save_zarr(data: Array | ndarray, zarr_file: str, scales: tuple = (6.5, 6.5, 6.5), chunks: tuple = (128, 128, 128)) None
Save a numpy array to a zarr file.
- Parameters:
data (np.ndarray) – The data to save.
zarr_file (str) – The zarr file to save to.
scales (tuple) – The resolution of the image, in z y x order.
chunks (tuple) – The chunk size to use.