mantidimaging.core.io.utility module

mantidimaging.core.io.utility.find_180deg_proj(sample_dirname: Path, image_format: str) str[source]
mantidimaging.core.io.utility.find_first_file_that_is_possibly_a_sample(file_path: str) Optional[str][source]
mantidimaging.core.io.utility.find_images(sample_dirname: Path, image_type: str, suffix: str, image_format: str, look_without_suffix: bool = False) List[str][source]
mantidimaging.core.io.utility.find_images_in_same_directory(sample_dirname: Path, type: str, suffix: str, image_format: str) Optional[List[str]][source]
mantidimaging.core.io.utility.find_log_for_image(image_file_name: Path) Optional[Path][source]
mantidimaging.core.io.utility.find_projection_closest_to_180(projections: numpy.ndarray, projection_angles: numpy.ndarray) Tuple[numpy.ndarray, float][source]

Finds the projection closest to 180 and returns it with the difference. :param projections: The array of projection images. :param projection_angles: The array of projection angles. :return: The 180 projection/the closest non-180 projection and the difference between its angle and 180.

mantidimaging.core.io.utility.get_candidate_file_extensions(ext: str) List[str][source]

Gets a list of file extensions which can be used to load files. :param ext: User provided file extension :returns: List of extensions in the order they should be tested

mantidimaging.core.io.utility.get_file_extension(file: str) str[source]
>>> get_file_extension("/home/user/file_path.test")
'test'
>>> get_file_extension("/home/user/file.path.test")
'test'
>>> get_file_extension("/home/")
''
mantidimaging.core.io.utility.get_file_names(path: Optional[Union[Path, str]], img_format: str, prefix: str = '', essential: bool = True) List[str][source]

Get all file names in a directory with a specific format. :param path: The path to be checked.

Parameters
  • img_format – The image format used as a postfix after the .

  • prefix – A specific prefix for the images

  • essential – Flag indicating if failure to find file should raise and exception

Returns

All the file names, sorted by ascending

mantidimaging.core.io.utility.get_prefix(path: str, separator: str = '_') str[source]