Utils Module
Utility Functions
the Utils module offers a variety of utility functions designed to facilitate image processing tasks in the ExR-Tools package.
- exr.utils.utils.calculate_volume_and_surface_area(labeled_image, label=1, spacing=[1, 1, 1])[source]
Calculates the volume and surface area of a specified object within a 3D labeled image.
- Parameters:
labeled_image (numpy.ndarray) – A 3D array where different objects are distinguished by unique integer labels.
label (int) – The specific label of the object for which the volume and surface area are to be calculated.
- Returns:
A tuple containing two elements - the volume and the surface area of the specified object.
- Return type:
- exr.utils.utils.chmod(path)[source]
Sets permissions so that users and the owner can read, write and execute files at the given path.
- Parameters:
path (pathlib.Path) – Path in which privileges should be granted.
- Return type:
None
- exr.utils.utils.subtract_background_rolling_ball(volume, radius=50, num_threads=40)[source]
Performs background subtraction on a volume image using the rolling ball method.
- Parameters:
- Returns:
The volume image after background subtraction.
- Return type:
np.ndarray
Package Logger
- exr.utils.log.configure_logger(name, log_file_name='ExR-Tools_logs.log')[source]
Configures and returns a logger with both stream and file handlers.
This function sets up a logger to send log messages to the console and to a log file. The console will display messages with a level of INFO and higher, while the file will contain messages with a level of DEBUG and higher.
- Parameters:
- Returns:
Configured logger object.
- Return type:
- Raises:
OSError – If there is an issue with opening or writing to the log file.