ormir-mids.utils package

Module contents

ormir_mids.utils.concatenate_volumes_3d(volumes_list)[source]

This function concatenates a list of 3d volumes into one single 3D volume

Parameters:

volumes_list (list): the list of volumes to concatenate

Returns:

MedicalVolume: the concatenated volume

ormir_mids.utils.copy_headers(medical_volume_src, medical_volume_dest)[source]

Copies the headers from one volume to another

Parameters:

medical_volume_src (MedicalVolume): the source volume medical_volume_dest (MedicalVolume): the destination volume

Returns:

No return value

ormir_mids.utils.copy_volume_with_omids_headers(medical_volume)[source]

Creates a copy of a medical volume with the BIDS headers

Parameters:

medical_volume (MedicalVolume): the volume to copy

Returns:

(MedicalVolume): the copy of the volume

ormir_mids.utils.get_manufacturer(med_volume: OMidsMedVolume)[source]

Gets the scanner manufacturer

Parameters:

med_volume (MedicalVolume): the volume to test

Returns:

str: the manufacturer always uppercase

ormir_mids.utils.group(medical_volume, key)[source]

Converts a 3D medical volume to a 4D one by grouping the slices according to the key.

Parameters:

medical_volume (MedicalVolume): the 3D medical volume key (str): the key to group the slices by. Must be an entry in BIDS header

Returns:

MedicalVolume: the 4D medical volume with headers

ormir_mids.utils.reduce(med_volume, index)[source]

Reduces the dimension of a medical volume by only keeping the volume at the given index and fixing the headers accordingly

Parameters:

med_volume (MedicalVolume): the 4D medical volume to reduce index (int): The volume index to keep

Returns:

MedicalVolume: the 3D medical volume with headers

ormir_mids.utils.replace_volume(medical_volume, new_data)[source]

Replaces the volume of a medical volume with a new volume leaving the tags intact

Parameters:

medical_volume (MedicalVolume): the volume to replace new_data (np.ndarray): the new volume

Returns:

(MedicalVolume): the new volume

ormir_mids.utils.slice_volume_3d(medical_volume, slices_list)[source]

This function extracts slices specified from the slices_list from the medical volume.

Parameters:

medical_volume (MedicalVolume): the medical volume slices_list (list): the list of slices to extract

Returns:

MedicalVolume: the extracted volume

ormir_mids.utils.ungroup(medical_volume)[source]

Converts a 4D medical volume to a 3D one by ungrouping the slices.

Parameters:

medical_volume (MedicalVolume): the 4D medical volume

Returns:

MedicalVolume: the 3D medical volume with headers