Page MenuHomePhabricator

Implement binary outline by means of VTK
Closed, ResolvedPublic

Description

This bug depends on the new ImageVtkMapper2D and can be done when T7027 is merged into the master or right away on the branch bug-7027-2DRendering.

The code for rendering contours of a vtkImageData should be something like (inside the ApplyProperties method in the mapper):
if (binaryOutline)

{
  vtkSmartPointer<vtkMarchingSquares> contourFilter = vtkSmartPointer<vtkMarchingSquares>::New();
  contourFilter->SetInput(localStorage->m_ReslicedImage);
  contourFilter->GenerateValues(1, 1.0, 1.0);
  contourFilter->Update();
  localStorage->m_Mapper->SetInputConnection(contourFilter->GetOutputPort());
}

vtkMarchingSquares is a special filter for contouring 2D images. GenerateValues(1, 1.0, 1.0) will draw a contour arround all pixels with the value 1.0.

The method SetInputConnection should pass the output of the filter to the mapper, yet there is nothing rendered. This bug should fix this!

Related Objects

StatusAssignedTask
ResolvedNone
ResolvedNone

Event Timeline

I figured out that the output of the vtkMarchingSquares is not appropreate for our requirements.

Therefore, I implemented binary outline with an algorithm from iil. Some pointer arithmetic is used to calculate very fast the boundaries of the binary image. However, the algorithm is restricted to 2D char images.