Skip to content

Flexible Image Filter Stack Implementation#95

Open
PiMaV wants to merge 2 commits intomainfrom
feature/flexible-filter-stack-18266554408969951646
Open

Flexible Image Filter Stack Implementation#95
PiMaV wants to merge 2 commits intomainfrom
feature/flexible-filter-stack-18266554408969951646

Conversation

@PiMaV
Copy link
Owner

@PiMaV PiMaV commented Feb 21, 2026

This change introduces a significant enhancement to the image processing capabilities of BLITZ.

Key Changes:

  1. Dynamic Filter Stack: The "Ops" tab now features a list-based interface where users can add, remove, and reorder image processing filters. This replaces the rigid "Subtract" and "Divide" sliders.
  2. Expanded Filter Set: New filters have been added using opencv and numpy:
    • Median: For hotpixel removal.
    • Min/Max: Morphological erosion/dilation.
    • Lowpass/Highpass: Gaussian blur and difference-of-gaussians.
    • Local Normalization: CLAHE and Mean-based normalization.
    • Thresholding & Clipping: Binary thresholding and histogram value clipping.
  3. Refactored Pipeline: The backend ImageData class now processes a list of operations sequentially on float32 data, ensuring precision and flexibility.
  4. UI Integration: The new FilterStackWidget allows precise control over filter parameters (kernel sizes, sigma, thresholds) using numeric inputs instead of sliders for arithmetic operations.

This update fulfills the user requirement for a "cleaner" way to handle operations and extends the tool's utility for scientific image analysis.


PR created automatically by Jules for task 18266554408969951646 started by @PiMaV

- Replaced fixed Subtract/Divide operations with a dynamic filter stack UI.
- Implemented new filters: Median, Min, Max, Gaussian Blur, Highpass, Local Normalization (CLAHE/Mean), Threshold, Clip.
- Refactored `ImageData` pipeline to support sequential list-based operations.
- Added `FilterStackWidget` for managing filter order and parameters.
- Updated `MainWindow` to handle reference image loading for arithmetic ops within the stack.

Co-authored-by: PiMaV <93649984+PiMaV@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@PiMaV
Copy link
Owner Author

PiMaV commented Feb 22, 2026

i like the concept ; yet the implementation is buggy.
we postpone this for now.
give a clean prompt of the idea and what was the main concept and basics and we will implement this later on. this branch will thus be never merged but we shall use your comments here to start a new thread later an

@google-labs-jules
Copy link
Contributor

i like the concept ; yet the implementation is buggy.
we postpone this for now.
give a clean prompt of the idea and what was the main concept and basics and we will implement this later on. this branch will thus be never merged but we shall use your comments here to start a new thread later an

Understood. Here is the summary of the concept and implementation basics for future reference:

Main Concept: The "Filter Stack"

The goal was to replace the fixed "Subtract" and "Divide" operations with a flexible, user-definable pipeline. Users can add multiple filters, reorder them freely, and adjust parameters individually. This allows for complex workflows like Median (Hotpixel Removal) -> Subtract (Background) -> Local Normalization.

Implementation Basics

  1. Data Structure (blitz/data/image.py):

    • The _ops_pipeline attribute in ImageData was refactored from a dictionary (fixed slots) to a list of dictionaries.
    • Each dictionary represents a step: {'type': 'median', 'ksize': 3} or {'type': 'subtract', 'source': 'file', ...}.
    • The _apply_ops_pipeline method iterates through this list sequentially, modifying the image data (converted to float32 for precision).
  2. Filter Logic (blitz/data/filters.py):

    • A new module containing static functions for each filter type (Median, Min/Max, Gaussian, CLAHE, Threshold, etc.).
    • Implemented using opencv-python-headless and numpy.
    • All functions accept and return float32 arrays to prevent overflow/underflow during processing.
  3. User Interface (blitz/layout/filter_stack.py):

    • FilterStackWidget: A container that manages the list of active filters.
    • FilterItemWidget: Represents a single row in the stack with controls specific to that filter (e.g., Kernel Size spinner for Median, Sigma for Gaussian).
    • Supports Drag-and-Drop (via Up/Down buttons) to reorder the pipeline.
    • Handles loading reference images for arithmetic operations on a per-item basis.
  4. Integration (blitz/layout/main.py):

    • The apply_ops function gathers the current configuration from the FilterStackWidget and pushes it to the ImageData backend.
    • It injects global context (like current crop bounds for "Aggregate" operations) into the pipeline steps just before application.

This architecture decouples the UI from the processing logic, making it easy to add new filter types in the future by simply registering them in filters.py and the UI map.

The feature is postponed and the implementation will not be merged at this time. The concept and implementation details have been documented in the PR comments for future reference.
This commit restores the repository to its original state.

Co-authored-by: PiMaV <93649984+PiMaV@users.noreply.github.com>
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.

1 participant