InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

`itk::QuadEdgeMeshPolygonCell::PointIdsBegin` should not be creating new point ids if no point is set

Open
#4,158 3 comments 0 reactions 0 assignees View on GitHub
type:Bug
Dominant language
C++
Stars
1.7k
Forks
748
Avg merge
1d 1h
Merged PRs (30d)
64

Description

### Description

The `itk::QuadEdgeMeshPolygonCell::PointIdsBegin` iterator method creates point ids, even if the point container is empty:
https://github.com/InsightSoftwareConsortium/ITK/blob/89d3c3c0158806ab44a33d3c76b436537864398e/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPolygonCell.h#L202

Not sure about that behavior. Also, the Ids created seem to be random. Both the begin and end iterators should be investigated when this case happens.

### Steps to Reproduce

1 Run the [`itkQuadEdgeMeshPolygonCellTest.cxx`](https://github.com/InsightSoftwareConsortium/ITK/blob/f7615d27ac61a453d622f476a333fee99838498b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshPolygonCellTest.cxx) test with `ctest -V -R itkQuadEdgeMeshPolygonCellTest -C Debug` and check that the test passes: the iterator returns a value to some point id despite no point value has been set.
2. Debug and investigate if this behavior is correct; if it is, document it in the method declaration (header file); it is isn't provide a fix, and change the test accordingly.

### Expected behavior

A `begin` iterator method should probably not create new point ids if there is no data in the point container.

### Actual behavior

The `begin` iterator method creates new point data even if there is no data in the point container.

### Reproducibility

%100.

### Versions

Current `HEAD`: 89d3c3c0158806ab44a33d3c76b436537864398e.

### Environment

Any.

### Additional Information

Reported in https://github.com/InsightSoftwareConsortium/ITK/pull/4156#discussion_r1292905860.

Maybe the issue falls into the `Design Impact Report` category or maybe the behavior is correct but needs to be documented; have not investigated enough, but is seems counter-intuitive to create a point id if no point exists.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.