Thanks to visit codestin.com
Credit goes to github.com

Skip to content

assd function crashes on different size arrays  #131

@BarY7

Description

@BarY7

Hello, first time using this lib, but I think a bug was introduced in the latest version from yesterday.
We have in the assd function in metric/binary.py:

    assd = numpy.mean(
        (
            __surface_distances(result, reference, voxelspacing, connectivity),
            __surface_distances(reference, result, voxelspacing, connectivity),
        )
    )
    return assd

When the returning arrays are not of the same dim, numpy.mean crashes with the exception:

setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions.

A possible fix:

    assd = numpy.mean(
        (
            np.concatenate([__surface_distances(result, reference, voxelspacing, connectivity),
            __surface_distances(reference, result, voxelspacing, connectivity)])
        )
    )
    return assd

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions