Skip to content

Add option for global image filtering before particle extraction#101

Closed
mgiammar wants to merge 3 commits intoLucaslab-Berkeley:development_v1.1from
mgiammar:mdg_global_whitening
Closed

Add option for global image filtering before particle extraction#101
mgiammar wants to merge 3 commits intoLucaslab-Berkeley:development_v1.1from
mgiammar:mdg_global_whitening

Conversation

@mgiammar
Copy link
Member

Resolves #99

@mgiammar mgiammar self-assigned this Oct 14, 2025
@mgiammar mgiammar changed the base branch from main to development_v1.1 October 14, 2025 19:01
@mgiammar mgiammar added the bugfix Something that fixes a bug in the code label Oct 14, 2025
@mgiammar mgiammar requested review from Copilot and jdickerson95 and removed request for jdickerson95 October 14, 2025 19:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds an option for global image filtering before particle extraction as an alternative to the existing post-extraction filtering approach. The change allows users to choose between applying preprocessing filters to the full micrograph before cropping particles or to the individual cropped particle images after extraction.

Key changes:

  • Added apply_global_filtering parameter with default value True to maintain backward compatibility
  • Modified particle extraction workflow to conditionally apply filtering at different stages
  • Updated manager classes to expose the new filtering option

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/leopard_em/pydantic_models/utils.py Removed post-extraction filtering logic and added apply_global_filtering parameter
src/leopard_em/pydantic_models/managers/refine_template_manager.py Added apply_global_filtering field and passed it to backend functions
src/leopard_em/pydantic_models/managers/optimize_template_manager.py Added apply_global_filtering field and passed it to backend functions
src/leopard_em/pydantic_models/data_structures/particle_stack.py Implemented conditional filtering logic in construct_image_stack method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Renames items in docstring without any functionality change

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mgiammar mgiammar requested a review from jdickerson95 October 14, 2025 19:55
@jdickerson95
Copy link
Contributor

I think we keep this open for a v1.2 since there will be significant changes with extraction from movies.
At the moment the filter stack is calculated based on the entire micrograph. This will change to allow local filtering for the movie extraction, so I think decisions about how to structure the filtering and pre-process and what control to expose to the user should be made when incorporating that.

@jdickerson95 jdickerson95 marked this pull request as draft October 29, 2025 16:25
@jdickerson95
Copy link
Contributor

I've made some changes to this PR that is now here (https://github.com/Lucaslab-Berkeley/Leopard-EM/tree/mdg_global_whitening).

I propose making this a part of the v1.2 release. and starting a new branch and PR once the v1.1 is merged into main.

@mgiammar
Copy link
Member Author

mgiammar commented Mar 6, 2026

Stale PR, functionality discussed here in #103

@mgiammar mgiammar closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Something that fixes a bug in the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants