[vtkusers] vtkUnstructuredGrid to vtkImageData
Dan Lipsa
dan.r.lipsa at gmail.com
Fri Jun 29 06:53:46 EDT 2012
Note that the tetrahedral dataset has cell scalar attribute but it
seems (I started looking at the vtk code using a debugger) that the
vtkProbeFilter looks for point attributes.
On Fri, Jun 29, 2012 at 10:27 AM, Dan Lipsa <dan.r.lipsa at gmail.com> wrote:
> Hi,
>
> I am trying to convert a tetrahedral grid (tetraFoam) into a (3D)
> vtkImageData (regularFoam) because I try to compute an average of all
> attributes of this dataset over several time-steps.
> I use vtkProbeFilter to do the conversion and do the following steps:
>
> VTK_CREATE (vtkImageData, regularFoam);
> regularFoam->SetExtent (0, pointsPerAxis - 1,
> 0, pointsPerAxis - 1,
> 0, pointsPerAxis - 1);
> regularFoam->SetOrigin (origin.x, origin.y, origin.z);
> regularFoam->SetSpacing (spacing.x, spacing.y, spacing.z);
>
> VTK_CREATE (vtkProbeFilter, regularProbe);
> regularProbe->SetSource (tetraFoam);
> regularProbe->SetInput (regularFoam);
>
> VTK_CREATE (vtkShrinkFilter, shrink);
> shrink->SetInputConnection (regularProbe->GetOutputPort ());
> shrink->SetShrinkFactor (0.9);
>
> m_actor->SetUserMatrix (modelView);
> m_mapper->SetLookupTable (colorTransferFunction);
> m_mapper->SetInputConnection (shrink->GetOutputPort ());
> update ();
>
>
> The origin, and spacing for vtkImageData are set from the bounding box
> of the tetrahedral grid.
>
> The tetrahedral dataset looks right when I display it, however the
> regular grid is displayed gray (no color map is applied) which leads
> me to believe that no attributes were set by the probe filter.
> Does anyone have any suggestions on what could be wrong here.
>
> Thanks a lot,
> Dan
More information about the vtkusers
mailing list