mantidimaging.gui.windows.image_load_dialog.presenter module#

class mantidimaging.gui.windows.image_load_dialog.presenter.LoadPresenter(view: ImageLoadDialog)[source]#

Bases: object

do_update_field(field: Field) None[source]#

Called when user clicks select button.

Does nothing if the select file dialog is canceled.

do_update_flat_or_dark(field: Field, selected_file: str) None[source]#

Update the field with the images from the selected file. :param field (Field): The field to update. :param selected_file (str): The path of the selected file. :return None

do_update_sample(selected_file: str) None[source]#

Updates the memory usage and the indices in the dialog.

do_update_sample_log(field: Field, file_name: str) None[source]#

Update the sample log if a sample is set. Check log is consistent with sample and handle field updates.

Parameters:
  • field – The log field in the load dialog to update.

  • file_name – Path to the selected log file.

do_update_shutter_counts(field: Field, selected_file: str) None[source]#

Updates the shutter counts for the selected file.

Parameters:
  • (Field) (field) – The field to update with the shutter counts.

  • (str) (selected_file) – The path of the selected file.

:return None

ensure_sample_shuttercount_consistency(field: Field, file_name: str) None[source]#
get_parameters() LoadingParameters[source]#

Get the loading parameters for the selected sample. :return LoadingParameters: The loading parameters for the selected sample. :raises RuntimeError: If no sample is selected.

sample_fg: FilenameGroup | None = None#
update_field_with_filegroup(file_info: FILE_TYPES, file_group: FilenameGroup) None[source]#

Update the field with the given file group by finding all files in the group and setting them in the field.

Parameters:
  • (FILE_TYPES) (file_info) – The file information.

  • (FilenameGroup) (file_group) – The file group containing the files.

:return None

validate_log_against_current_indices() bool[source]#

Re-validate sample log against the current index selection at load time. Catches cases where the index range was altered after the log was accepted into a no-longer valid state. Returns True if the log is still valid (or no log is set), False and shows an error otherwise.

validate_sample_log(file_name: str, selected_filenames: list[str], full_stack_filenames: list[str]) bool[source]#

Validate that the log file is consistent with the images to be loaded.

Checks the following scenarios: log_count > full_count = reject log_count < selected count = reject log_count == full_count = accept selected_count <= log_count < full_count = warn and accept if user confirms

Parameters:
  • file_name – Path to the selected log file.

  • selected_filenames – Filenames after index selection.

  • full_stack_filenames – All filenames in the full stack.

Returns:

True if the log is accepted, False if rejected.

view: ImageLoadDialog#