Image Io#

Image IO

Classes#

ImageIO

ImageIO to handle reading and writing imaging data and metadata.

Functions#

write_dict_to_json(meta_data_dict, out_path)

Save a metadata file in python to a directory.

gen_meta_data_filepath_for_nifti(nifty_path)

Generates the corresponding metadata file path for a given nifti file path.

safe_load_meta(→ dict)

Function to load a generic metadata json file.

load_metadata_for_nifti_with_same_filename(→ dict)

Static method to load metadata. Assume same path as input image path.

flatten_metadata(→ dict)

Given a metadata dictionary, return an identical dictionary with any list-like or dict-like

safe_copy_meta(input_image_path, out_image_path)

Copy the metadata file from input image, to one with the same name as the

get_half_life_from_radionuclide(→ float)

Extracts the radionuclide half-life in seconds from a nifti metadata file. This function

get_half_life_from_meta(meta_data_file_path)

Extracts the radionuclide half-life (usually in seconds) from a nifti metadata file.

get_half_life_from_nifti(image_path)

Retrieves the radionuclide half-life from a nifti image file.

read_label_map_tsv(→ dict | pandas.DataFrame)

Static method to read a label map, translating region indices to region names,

safe_load_4dpet_nifti(→ nibabel.nifti1.Nifti1Image)

Safely load a 4D PET NIfTI file.

validate_two_images_same_dimensions(image_1, image_2)

Check the dimensions of two Nifti1Image objects and verify they have the same shape.

infer_sub_ses_from_tac_path(tac_path)

Infers subject and session IDs from a TAC file path by analyzing the filename.

km_regional_fits_to_tsv(fit_results_dir, out_tsv_dir)

Tidies the output of regional kinetic modeling results by converting JSON files into a TSV file