I/O Module

I/O Functions

The IO module in the ExR Tools is designed to streamline the process of reading, converting, and managing image data files for expansion microscopy

exr.io.io.create_folder_structure(processed_dir, rois, rounds)[source]

Creates a results folder for the specified code.

Parameters:
  • processed_dir (Path) – The directory where all results for the specified code should be stored.

  • rounds (List[int]) – The list of rounds to create the folder structure for.

  • rois (List[int]) –

Return type:

None

exr.io.io.load_json(file_path)[source]

Loads a JSON file from the specified path and returns the data.

Parameters:

file_path (str) – The path to the JSON file to load.

Returns:

The data loaded from the JSON file or None if an error occurs.

Return type:

Union[Dict, None]

exr.io.io.nd2ToVol(filename, channel_name='640 SD', ratio=1)[source]

Generate a volume from ND2 file.

Parameters:
  • filename (str) – The name of the ND2 file.

  • channel_name (str, optional) – The name of the channel, defaults to ‘633’

  • ratio (int, optional) – The ratio for downsampling, defaults to 1 (no downsampling)

Returns:

A 3D numpy array representing the volume, if successful. None otherwise.

Return type:

np.ndarray, optional

exr.io.io.save_json(data, file_path)[source]

Saves the provided data as a JSON file to the specified path.

Parameters:
  • data (Dict) – The data to save as a JSON file.

  • file_path (str) – The path where the JSON file should be saved.