[vtkusers] Contouring (again)

Robbie Banks robbie.banks at gmail.com
Tue Jul 20 13:12:49 EDT 2010


OK, so I'm still having some issues. This may be a stupid question, but how
can I get the grid back?

This is volumetric extrapolation of a pressure field.

This is a C++ application, so the generation of the rectilinear grid is
local to a subroutine. I create the grid, and then transform it to move it
to the correct rotation, send to a mapper then actor to display this grid as
polydata.

At a later time, after a calculation, I add the volumetric data for
pressures as scalars to the existing actor.

Can I recreate the grid from GetMapper()->GetInput() on the actor, or have I
completely lost the original volumetric data? 

The only way I can see is to create the grid as a global variable and keep
it throughout, but I not sure this is best practice, as I have to ensure it
is deleted at some point and it may cause a memory leek.

Thanks
Robbie
 

-----Original Message-----
From: Bill Lorensen [mailto:bill.lorensen at gmail.com] 
Sent: Monday, July 19, 2010 9:05 PM
To: Robbie Banks
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Contouring (again)

Run the contour filter directly on the rectilinear grid. The PolyData
is not a volumetric model.

On Mon, Jul 19, 2010 at 11:59 PM, Robbie Banks <robbie.banks at gmail.com>
wrote:
> Sorry, I did have it at 0.25 of the max scalar value. Just didn't add in
the
> email
>
> R
>
> On Jul 19, 2010, at 8:45 PM, Bill Lorensen <bill.lorensen at gmail.com>
wrote:
>
>> Setting the isosurface value to the maximum of your scalars seems
>> strange. Try setting to another value, e.g. .75*range[1];
>>
>>
>> On Mon, Jul 19, 2010 at 8:52 PM, Robbie Banks <robbie.banks at gmail.com>
>> wrote:
>>>
>>> Hi all,
>>>
>>> Sorry to bring up contouring again, but I have a little problem.
>>>
>>> I have created a PolyDataMapper from a RectilinearGrid in 3D, each point
>>> has
>>> a location and a scalar value associated with it. I wish to create a
>>> Contour
>>> filter to create an isosurface in the plot for a given scalar value.
>>>
>>> I create the contour filter and read in the data like below:
>>>
>>>       vtkSmartPointer<vtkContourFilter> pContourFilter =
>>> vtkSmartPointer<vtkContourFilter>::New();
>>>       pContourFilter->SetInput(pActor->GetMapper()->GetInput());
>>>       double range[2];
>>>       pActor->GetMapper()->GetInput()-GetScalarRange(range);
>>>       pContourFilter->SetValue(0,range[1]);
>>>
>>>       vtkSmartPointer<vtkPolyDataMapper> pMapper =
>>> vtkSmartPointer<vtkPolyDataMapper>::New();
>>>       pMapper->SetInputConnection(pContourFilter->GetOutputPort());
>>>
>>>       etc.....
>>>
>>> This forms a single line round the outside of the volume at the value
>>> specified. However, as stated I'm after a contour surface. Where am I
>>> going
>>> wrong?
>>>
>>> Is the GetMapper()->GetInput() only returning the outer values of the
>>> PolyData.
>>>
>>> How can I create the whole surface?
>>>
>>> Thanks
>>> Robbie
>>>
>>> _______________________________________________
>>> 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
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>




More information about the vtkusers mailing list