Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Image Stack Loading and Operation Handling for Flat-fielding Tests #2176

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ashmeigh
Copy link
Collaborator

Description

Conditional Loading: The load_image_stack function has been modified to conditionally load flat and dark images along with the main image stack if the test case is for "Flat-fielding".
FilenameGroup Integration: Utilizes FilenameGroup for managing file paths and ensuring that required files (e.g., log files, flat, and dark images) are correctly loaded.
Enhanced Parameter Handling: Parameters for the operations are dynamically updated to include loaded flats and darks which are essential for "Flat-fielding".

Testing

Flat-fielding with Complete Data: All required flats and darks are specified and available. The function should correctly load these images and use them in the operation.

Acceptance Criteria

Run tests using both "Flat-fielding" and other operations to ensure the function reacts appropriately.
Specifically, test with missing files for "Flat-fielding" to see that the function handles errors as expected.
Integration Check: Confirm that changes do not disrupt the existing setup and integrate cleanly with the current test suite

@coveralls
Copy link

coveralls commented May 14, 2024

Coverage Status

coverage: 72.642% (-0.09%) from 72.735%
when pulling b8715d0 on flat_op_test
into 619bdd4 on main.

if frame_type in params:
filename_group = FilenameGroup.from_file(config_manager.load_sample)
filename_group.find_all_files()
filename_group.find_related(getattr(FILE_TYPES, frame_type.upper()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related_filename_group =  filename_group.find_related(getattr(FILE_TYPES, frame_type.upper()))
related_filename_group.find_all_files()
image_stack = loader.load(filename_group=related_filename_group)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running tests for Flat-fielding:
No related files found for dark_after
raise ValueError("selected_flat_fielding not in:", valid_methods)
ValueError: ('selected_flat_fielding not in:', ['Only Before', 'Only After', 'Both, concatenated'])
(mantidimaging-dev) PS C:\Users\44770\PycharmProjects\mantidimaging>

if frame_type in params:
filename_group = FilenameGroup.from_file(config_manager.load_sample)
related_filename_group = filename_group.find_related(getattr(FILE_TYPES, frame_type.upper()))
related_filename_group.find_all_files()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get AttributeError: 'NoneType' object has no attribute 'find_all_files, so looks like you need to check if related_filename_group is None (which will happen if it does not find that sort of related stack)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test dataset only has Flat_Before, Flat_After, Dark_Before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants