Page MenuHomePhabricator

mitkPaintbrushTool unusable due to inefficient code
Closed, ResolvedPublic

Description

Paint and Wipe tools try to update too many things at once when painting:

  • if "showVolume" property is set to true for the segmentation (default), each update will trigger Image::ComputeImageStatistics() for the whole volume
  • the working slice is extracted using SegTool2D::GetAffectedImageSliceAs2DImage everytime, although extracting the slice once should be sufficient
  • undo information is collected and saved for every modified pixel
  • the feedback contour seems to be initialized and copied a bit more than necessary

Alltogether, this leads to painfully slow updates which make both tools completely unusable.

Suggestions:

  • switch off "showVolume" property while painting
  • extract slice only once when mouse button is pressed and work on that one the whole time
  • only update the 3D image (with undo info) when mouse button is released, until then try to use the working slice for feed-back

Event Timeline

(In reply to comment #0)

Paint and Wipe tools try to update too many things at once when painting:

  • if "showVolume" property is set to true for the segmentation (default), each

update will trigger Image::ComputeImageStatistics() for the whole volume

  • the working slice is extracted using

SegTool2D::GetAffectedImageSliceAs2DImage everytime, although extracting the
slice once should be sufficient

  • undo information is collected and saved for every modified pixel
  • the feedback contour seems to be initialized and copied a bit more than

necessary

Alltogether, this leads to painfully slow updates which make both tools
completely unusable.

Suggestions:

  • switch off "showVolume" property while painting

Sounds good. I'd love to have a means of graphical testing so this could be run in a unit test to ensure a certain speed.

  • extract slice only once when mouse button is pressed and work on that one the

whole time

  • only update the 3D image (with undo info) when mouse button is released,

until then try to use the working slice for feed-back

I just checked the code. Should have been implemented as you describe it. My fault that I overlooked that. Changing that should be simple, however.

Resetting all bugs without active assignee flag to "CONFIRMED". Change status to IN_PROGRESS if you are working on it.

[2d1f43]: Merge branch 'bug-6589-Make-PaintTool-More-Efficient'

Merged commits:

2011-11-21 16:48:11 Andreas Fetzer [9fe660]
Prevented calculation of image statistics

Set properties isBinary and LevelWindow to prevent the calculation of
image statistics.

Made some code cleaning


2011-11-21 15:55:17 Andreas Fetzer [fdd1a9]
Optimized paintbrush tool

Now the slice in which should be painted is stored in a data node as soon as
the user moves the mouse cursor into a renderwindow.

When the user presses the left mouse button and moves the mouse the contour
is filled into the 2D slice.

When the user releases the left mouse button the slice is written back into
the image volume