Page MenuHomePhabricator

PointSet Interaction confuses point indices and number of points
Closed, ResolvedPublic


To reproduce the bug do the following steps:

  • create new PointSet
  • add 2 or more points
  • remove a point that is not the last point
  • manually add a point

-> dialog will open up with values of last point in PointSet and changes will only modify that point instead of adding a new point

possible cause:

  • example: add 3 points and remove point with index 1

problem: manually adding a point opens dialog for point with index 2
-> QmitkEditPointDialog takes PointSet.size() which is 2 and therefore thinks index of new point should be 2 (first point index = 0, second point index = 1)
-> but in reality the index of second point is still 2 and point with index 1 is removed, that leads to dialog opening up with second point instead of new point

Event Timeline

The reason for the bug lies within mitk::PointListWidget::OnBtnAddPointManually(), where the max point id is being determined using mitk::PointSet::GetSize(). If a non-max id point has been deleted beforehand, a false max id is delivered, and the actual max-id point is modified instead of a new point insertion.

Bug is solved using mitk::PointSet::GetMaxId() where proper max id is delivered regardless of prior point deletion.

[6937b5]: Merge branch 'bug-19180-PointSet-ManuallyAddPointBug'

Merged commits:

2015-08-05 14:30:21 Tobias Norajitra [fac6ba]
Use max id convenience method instead of faulty size id.

User norajitr has pushed new remote branch: