Page MenuHomePhabricator

In SegTool2D provide mechanism to enable the 3D interpolation to be turned off
Closed, ResolvedPublic

Description

There used to be (in MITK c855dedda4) the method

mitk::SegTool2D::Enable3DInterpolation

which is now removed as functionality has moved onto QmitkSlicesInterpolator.
Please can be have this functionality back.

More specifically:

I have a View, where I want to use the segmentation tools such as Add, Subtract, Paint etc, and I only want 2D mode. This used to be possible, as I would get a pointer to the tool and call SegTool2D::Enable3DInterpolation(false).

This is no longer possible, and my current View now crashes because in:

mitk::SegTool2D::WriteBackSegmentationResult

we call

mitk::SurfaceInterpolationController::GetInstance()->AddNewContour( contour, service->GetPlanePosition(pos));

which calls

for (unsigned int i = 0; i < m_ListOfContourLists.at(m_CurrentContourListID).size(); i++)

when m_CurrentContourListID is zero, and m_ListOfContoursLists has no lists.

As I was keen to keep my MITK modifications to a minimum I tried to use the current framework, without modifying mitk::SegTool2D. However, this turned out to be difficult. The QmitkSegmentationView is now dependent on QmitkSlicesInterpolator, which I don't really want. This QmitkSlicesInterpolator creates lots of new nodes that I don't want, and it is the QmitkSlicesInterpolator::OnToolManagerWorkingDataModied is the method that calls SetCurrentContourListID which is the thing that increments the Contour ID on the SurfaceInterpolator. The code also assumes certain data types for each working node.

So, the simple solution is to not try and interpolate the 3D stuff. The logic in mitk::SegTool2D for determining the affected slice and for painting voxels in a slice should be separated from the logic to do the interpolation. This can't be achieved using an intermediate class in the hierarchy, so perhaps a member variable to simply turn it off is the way to go for now.

(or, after filling the voxels in the current slice, the class could use a Strategy Pattern to delegate to a whole new hierarchy if interpolation type algorithms, and only do this if the strategy had been set via injection).

For the time being I have provided a simple member variable.

Event Timeline

Hi Matt, I can see the problem. You are right it should be possible (especially for external users) to deactivate the 3D interpolation within the segmentation tool. I will take a look at it but as you said you quick fix will do it for now.

[0bc212]: Merge branch 'bug-13133-allow-disabling-3D-interpolation'

Merged commits:

2012-09-18 14:10:49 MattClarkson [598ee1]
Added the word Set to the SegTool2D::Enable3DInterpolation method name


2012-09-18 13:58:56 MattClarkson [fe3434]
Re-introduced mitk::SegTool2D::Enable3DInterpolation