[vtkusers] Isosurface Extraction

Amy Squillacote ahs at cfdrc.com
Mon Apr 14 09:24:06 EDT 2008


Does your data set have more than one point scalar array? Is it possible 
that the contour filter is actually operating on an array with a 
different scalar range?

- Amy

r.jamieson at reading.ac.uk wrote:
> HI Bill,
>
> My values range from 1 to 562043.31.
>
> Ronan
>
>
> On Apr 13 2008, Bill Lorensen wrote:
>
>> What is the scalar range of your input?
>>
>> Bill
>>
>> On Sun, Apr 13, 2008 at 9:34 AM, ronan <r.jamieson at reading.ac.uk> wrote:
>>> Hi,
>>>
>>> I am trying to get my head around isosurfaces extraction and i have 
>>> tried to write a c++ program to do a simple extraction, but i cannot 
>>> see any isosurfaces, i have got a wireframe box around the 
>>> space...but no isosurface, i have attached my code
>>>
>>> I would be greatful if some one could point out where i have gone 
>>> wrong.
>>>
>>> Thanks in advance
>>>
>>> Ronan
>>>
>>> int main()
>>> {
>>>
>>> char *c1;
>>> // Setup standard rendering
>>>
>>> vtkRenderer *ren1 = vtkRenderer::New();
>>>   ren1->SetBackground(0.8,0.8,0.8);
>>>
>>> vtkRenderWindow *renWin = vtkRenderWindow::New();
>>>   renWin->AddRenderer(ren1);
>>>   renWin->SetSize(400,300);
>>>
>>> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>>> iren->SetRenderWindow(renWin);
>>>
>>> //Read data from office simulation data file
>>>
>>> vtkDataSetReader *dataSource = vtkDataSetReader::New();
>>>   dataSource->SetFileName("/home/ronan/Develop/Data/office.vtk");
>>>   dataSource->DebugOn();
>>>   dataSource->SetScalarsName(c1);
>>>   dataSource->Update();
>>>
>>> // Create and initialize a dataset outline
>>> // The outline of the data puts the data in context.
>>>
>>> vtkOutlineFilter *outline = vtkOutlineFilter::New();
>>>   outline->SetInputConnection(dataSource->GetOutputPort());
>>>
>>> vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();
>>>   outlineMapper->SetInputConnection(outline->GetOutputPort());
>>>
>>> vtkActor *outlineActor = vtkActor::New();
>>>   outlineActor->SetMapper(outlineMapper);
>>>   outlineActor->GetProperty()->SetColor(0, 0, 0);
>>>
>>> ren1->AddActor(outlineActor);
>>>
>>> //Create an iso-surface using Marching Cubes
>>> vtkContourFilter *iso = vtkContourFilter::New();
>>>   iso->SetInputConnection(dataSource->GetOutputPort());
>>>   iso->ComputeScalarsOn();
>>>   iso->SetValue(0, 14);
>>>   iso->Update();
>>>
>>> //vtkDataSetMapper *isoMapper = vtkDataSetMapper::New();
>>> vtkPolyDataMapper *isoMapper = vtkPolyDataMapper::New();
>>>   isoMapper->SetInputConnection(iso->GetOutputPort());
>>>   isoMapper->ScalarVisibilityOn();
>>>   isoMapper->SetScalarModeToUsePointFieldData();
>>>   isoMapper->SetScalarRange(0, 1200);
>>>
>>> vtkActor *isoActor = vtkActor::New();
>>>   isoActor->SetMapper(isoMapper);
>>>   isoActor->GetProperty()->SetColor(0.9804, 0.9216, 0.8431);
>>>
>>> ren1->AddActor(isoActor);
>>>
>>> renWin->Render();
>>>  iren->Start();
>>> _______________________________________________
>>> This is the private VTK discussion list.
>>> Please keep messages on-topic. Check the FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: 
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list