Skip to content

incorrect spatial moments #293

@retogerber

Description

@retogerber

The calculation of the spatial moments is incorrect:

import nyxus
import numpy as np
outmask = np.array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
outmask
>>> array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>>>             [0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
>>>             [0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
>>>             [0, 0, 0, 0, 1, 1, 1, 1, 0, 0],
>>>             [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
>>>             [0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
>>>             [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
>>>             [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
>>>             [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
>>>             [0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
>>>             [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
nyx = nyxus.Nyxus(["AREA_PIXELS_COUNT","SPAT_MOMENT_00"])
nyx.featurize(outmask,outmask)[["AREA_PIXELS_COUNT","SPAT_MOMENT_00"]]
>>>    AREA_PIXELS_COUNT  SPAT_MOMENT_00
>>> 0               43.0             0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions