Utilities#
MRC Handles#
- class fouriercrop.load_mrc(load_path: str | Path, as_tensor: bool = False, get_voxel_size: bool = False)[source]#
Loads data from an MRC file and optionally retrieves voxel size.
- Parameters:
load_path (Union[str, Path]) – Path to the MRC file.
as_tensor (bool, optional) – If True, returns tensor (default=False).
get_voxel_size (bool, optional) – If True, returns voxel size (default=False).
- Returns:
The MRC data and voxel size.
- Return type:
Tuple[Union[np.ndarray, torch.Tensor], np.ndarray]
- Raises:
FileNotFoundError – If the input file does not exist.
- class fouriercrop.save_mrc(save_path: str | Path, save_data: ndarray | Tensor, voxel_size: float = 1.0)[source]#
Saves data to an MRC file.
- Parameters:
save_path (Union[str, Path]) – Path to save the MRC file.
save_data (Union[np.ndarray, torch.Tensor]) – Data to save.
voxel_size (float, optional) – Voxel size of the data (default=1.0).