Skip to content

Commit

Permalink
removed some static methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeigh committed Jun 20, 2024
1 parent 8ea30a7 commit afb62c8
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions mantidimaging/core/operations/flat_fielding/flat_fielding.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,21 @@ def enable_correct_fields_only(selected_flat_fielding_widget, flat_before_widget

class FlatFieldFilter(BaseFilter):
"""Uses the flat (open beam) and dark images to normalise a stack of images (radiograms, projections),
and to correct for a beam profile, scintillator imperfections and/or detector inhomogeneities. This
operation produces images of transmission values.
In practice, several open beam and dark images are averaged in the flat-fielding process.
Intended to be used on: Projections
When: As one of the first pre-processing steps
Caution: Make sure the correct stacks are selected for flat and dark.
Caution: Check that the flat and dark images don't have any very bright pixels,
or this will introduce additional noise in the sample. Remove outliers before flat-fielding.
"""
filter_name = 'Flat-fielding'
Expand Down Expand Up @@ -140,20 +148,6 @@ def _compute_flat_field(index: int, array: np.ndarray, params: dict):
array[index] -= dark_avg
array[index] /= norm_divide

@staticmethod
def _divide(data, norm_divide):
np.true_divide(data, norm_divide, out=data)

@staticmethod
def _subtract(data, dark=None):
# specify out to do in place, otherwise the data is copied
np.subtract(data, dark, out=data)

@staticmethod
def _norm_divide(flat: np.ndarray, dark: np.ndarray) -> np.ndarray:
# subtract dark from flat
return np.subtract(flat, dark)

@staticmethod
def register_gui(form, on_change, view) -> dict[str, Any]:
from mantidimaging.gui.utility import add_property_to_form
Expand Down

0 comments on commit afb62c8

Please sign in to comment.