Skip to content

Commit 9d0d4f0

Browse files
committed
Fix intensity normalization always deleting normalization of default key
...instead of the key we're actually optimizing the intensity for.
1 parent 15da319 commit 9d0d4f0

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

organoid_tracker/position_analysis/intensity_calculator.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,20 @@ def get_normalized_intensity(experiment: Experiment, position: Position, *, inte
292292

293293
def perform_intensity_normalization(experiment: Experiment, *, background_correction: bool = True, z_correction: bool = False,
294294
time_correction: bool = False, intensity_key: str = DEFAULT_INTENSITY_KEY):
295-
"""Gets the average intensity of all positions in the experiment.
296-
Returns None if there are no intensity recorded."""
295+
"""Performs intensity normalization for the given intensity key. The lowest found intensity in the experiment is
296+
used for setting the background, if background_correction is True. In addition, the intensities will be multiplied
297+
to obtain a median intensity of 1 at each z position if z_correction is True, or at every time point if
298+
time_correction is True. If both z_correction and time_correction are False, the intensities will be multiplied to
299+
obtain an overall median intensity of 1.
300+
301+
This method only works for regular intensities, not for ratiometric intensities. It will silently fail if no
302+
regular intensity with the given key is found.
303+
"""
297304
if time_correction and z_correction:
298305
raise UserError("Time and Z correction", "Cannot apply both a time and a z correction.")
299-
remove_intensity_normalization(experiment)
306+
remove_intensity_normalization(experiment, intensity_key=intensity_key)
300307

308+
# Collect existing intensities, volumes, z and time values for this intensity
301309
intensities = list()
302310
volumes = list()
303311
zs = list()

0 commit comments

Comments
 (0)