[vtkusers] MarchingCubes missunderstandig GenerateValues and Contours

Imre Goretzki goretzki.imre at gmail.com
Sat Dec 5 13:15:55 EST 2015


Hey guys,

I have a question about the "GenerateValues" method of MarchingCubes. My 
image has several points that have intensity values that lie between 928 
and 1600.

My understand of

int idxContour = 1;
double from = 920;
double to = 930;

ImageToVTKImageFilter con = ...

marchingCube->setInputData(con->GetOutput());
marchingCube->GenerateValues(idxContour, from, to);
marchingCube->Update();

is that the algorithm will take all points that have an intensity value 
that lies between 920 and 930. These points are combined to one contour. 
Via MATLAB and ITK's histogram I can validate the amout of points that 
have a specific intensity value.

If I plot the points that were generated by marching cubes, I do not get 
all of them (I cannot see all of them), e.g.
the histogram says that there are about 200000 points that have an 
intensity value 928. If I use 928 as the lower bound for the 
GenerateValues method, there are just some of them plotted - approximately.

Is my understanding of GenerateValues correct?

Next question: (more than 1 contour)

If I want to generate more than 1 contour. How do I initialize the 
marchingCube and, more interesting, how do I get the output of a 
specific contour. I'm thinking about the following:


marchingCube->SetNumberOfContours(2);
marchingCube->GenerateValues(1, from_1, to_1);
marchingCube->GenerateValues(2, from_2, to_2);

vtkSmartPointer<vtkOutlineFilter> outline = 
vtkSmartPointer<vtkOutlineFilter>::New();
outline->SetInputConnection(marchingCube->GetOutput(1));

vtkSmartPointer<vtkPolyDataMapper> outlineMapper = 
vtkSmartPointer<vtkPolyDataMapper>::New();
outlineMapper->SetInputConnection(outline->GetOutputPort());

vtkSmartPointer<vtkPolyDataMapper> data1 = 
vtkSmartPointer<vtkPolyDataMapper>::New();
data1->SetInputConnection(marchingCube->GetOutput(1));

vtkSmartPointer<vtkPolyDataMapper> data2 = 
vtkSmartPointer<vtkPolyDataMapper>::New();
data2->SetInputConnection(marchingCube->GetOutput(2));

I know that the above lines are not working like this, but I actually do 
not know how to do that. Right now I have 2 marchingCube instances that 
do the work for data1/data2 but that should not do the trick.

I hope you can help me

Greetings
Imre


More information about the vtkusers mailing list