[vtkusers] MarchingCubes missunderstandig GenerateValues and Contours
Cory Quammen
cory.quammen at kitware.com
Sun Dec 6 10:22:42 EST 2015
On Sat, Dec 5, 2015 at 1:15 PM, Imre Goretzki <goretzki.imre at gmail.com>
wrote:
> 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?
>
Not exactly. vtkMarchingCubes will extract individual isocontours -
surfaces that represent the locations in a dataset with a particular value.
vtkMarchingCubes and other isocontour filters in VTK can generate surfaces
from more than one isovalue. GenerateValues() is a convenience function to
specify a range of isovalues.
A vtkThreshold filter will extract all points in the dataset in a value
range and may be what you want.
> 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.
>
You can't set up two different isocontour surfaces and get two different
outputs this way. Using two separate vtkMarchingCubes instances is the
right way to go.
HTH,
Cory
>
> I hope you can help me
>
> Greetings
> Imre
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
--
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151206/a2d082bf/attachment.html>
More information about the vtkusers
mailing list