Skip to content

[BUG] Invert after intensity normalisation #982

@qin-yu

Description

@qin-yu

Describe the Bug (might not be a bug tho)

Hi @carsen-stringer!

I found three suspicious implementations in intensity normalization but could only identify two as potential bugs. I attempted to fix these two in #981, but I still wonder if the third issue should be addressed:

To invert the image so that dark cells become bright cells while the bright background becomes darker, the current implementation is:

if (tile_norm_blocksize > 0 or normalize) and invert:
img_norm[..., c] = -1 * img_norm[..., c] + 1

essentially:

image = -1 * image + 1

However, image here is usually the output of a percentile-based normalization like normalize99() and is not strictly within the [0, 1] range. I guess most pixels are in [0, 1] so this inversion makes sense, but still some are outside [0, 1]. I haven't thoroughly thought this through. Is this a problem, or is it working as intended?

Many thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions