mantidimaging.gui.windows.main.model module#

class mantidimaging.gui.windows.main.model.MainWindowModel[source]#

Bases: object

add_dataset_to_model(dataset: Dataset) → None[source]#
add_log_to_sample(images_id: UUID, log: InstrumentLog) → None[source]#

Add log file to a stack, checking for projection angles and pixel size, adding them if missing from image stack.

add_projection_angles_to_sample(images_id: UUID, proj_angles: ProjectionAngles) → tuple[UUID, ProjectionAngles][source]#
add_shutter_counts_to_sample(images_id: UUID, shutter_counts_file: Path) → None[source]#

Adds the shutter counts file to the sample associated with the given images ID. :param images_id (uuid.UUID): The ID of the images. :param shutter_counts_file (Path): The path to the shutter counts file. :raises RuntimeError: If the images with the given ID cannot be found. :returns None

create_gif_from_stack(image_stack: ImageStack, output_path: str, frame_skip: int, rotation_duration: float) → None[source]#

Create an animated GIF from an image stack.

Applies percentile-based auto-scaling (2-98 percentile) for improved contrast, similarly to the image viewer, filling with mid-gray if data is uniform - required for GIF format. Converted to 8-bit for GIF compatibility.

Parameters:
  • image_stack – The ImageStack to create GIF from

  • output_path – Path where the GIF will be saved

  • frame_skip – Show every Nth frame (e.g., 10 = every 10th frame)

  • rotation_duration – Duration in seconds for the complete rotation (assumes 360 degrees)

do_images_saving(images_id: uuid.UUID, save_as_sino: bool, output_dir: str | Path, name_prefix: str, image_format: str, overwrite: bool, pixel_depth: str, progress: Progress) → bool[source]#
do_load_dataset(parameters: LoadingParameters, progress: Progress) → Dataset[source]#

Load a dataset based on loading parameters. Determines if stacks should be treated as sinograms or regular projections Handles setting pixel size from logs or user definned overide, falling back to default

Parameters:
  • parameters – Loading parameters containing information about the dataset to load

  • progress – Progress reporting instance

Returns:

Loaded Dataset instance

do_nexus_saving(dataset_id: UUID, path: Path, sample_name: str, save_as_float: bool) → bool[source]#
get_existing_180_id(dataset_id: UUID) → UUID | None[source]#

Gets the ID of the 180 projection object in a Dataset. :param dataset_id: The Dataset ID. :return: The 180 ID if found, None otherwise.

get_images_by_uuid(images_uuid: UUID) → ImageStack | None[source]#
get_parent_dataset(member_id: UUID) → UUID[source]#

Takes the ID of an image stack and returns the ID of its parent dataset. :param member_id: The ID of the image stack. :return: The ID of the parent dataset if found.

get_recon_list_id(parent_id: UUID) → UUID[source]#
property image_ids: list[UUID]#
property images: list[ImageStack]#
load_image_stack(file_path: str, progress: Progress) → ImageStack[source]#
load_image_stack_to_new_dataset(file_path: str, progress: Progress) → Dataset[source]#
overwrite_pixel_size_from_log(images_id: UUID, log: InstrumentLog) → None[source]#
property proj180s: list[ImageStack]#
raise_error_when_images_not_found(images_id: UUID) → NoReturn[source]#
raise_error_when_parent_dataset_not_found(images_id: UUID) → NoReturn[source]#
property recon_list_ids: list[UUID]#
remove_container(container_id: UUID) → list[UUID][source]#

Removes a container from the model.

Parameters:

container_id – The ID of the dataset or image stack.

Returns:

A list of the IDs of all the image stacks that were deleted from the model if a match was found, None otherwise.