[vtkusers] Scaling with VtkTransform and VtkLookupTable
David Gobbi
david.gobbi at gmail.com
Fri Feb 17 09:46:57 EST 2017
Hi Bea,
Then the answer is simple: vtkTransformFilter does not change the
"DepthArray" because the transform only operates on point coordinates. It
does not operate on the scalars that are associated with those points.
- David
On Fri, Feb 17, 2017 at 7:31 AM, Schober Beatrix [STEMMER IMAGING GmbH] <
b.schober at stemmer-imaging.de> wrote:
> Hi David,
>
>
>
> I do have x, y and z values (e.g. as txt file or as a grayscale image):
>
>
>
> vtkPoints = vtkSmartPointer<vtkPoints>::New();
>
> vtkCells = vtkSmartPointer<vtkCellArray>::New();
>
> vtkDepths = vtkSmartPointer<vtkDoubleArray>::New();
>
>
>
>
>
> void addPoint(double x, double y, double z)
>
> {
>
> vtkIdType id = vtkPoints->InsertNextPoint(x, y, z);
>
> vtkDepths->InsertNextValue(z);
>
> vtkCells->InsertNextCell(1);
>
> vtkCells->InsertCellPoint(id);
>
> vtkCells->Modified();
>
> vtkPoints->Modified();
>
> vtkDepths->Modified();
>
> }
>
>
>
>
>
> vtkDepths->SetName("DepthArray");
>
> vtkPolyData->SetPoints(m_vtkPoints);
>
> vtkPolyData->SetVerts(m_vtkCells);
>
> vtkPolyData->GetPointData()->SetScalars(m_vtkDepths);
>
> vtkPolyData->GetPointData()->SetActiveScalars("DepthArray");
>
>
>
> Regards,
>
>
>
> Bea
>
>
>
>
>
>
>
> *Von:* David Gobbi [mailto:david.gobbi at gmail.com]
> *Gesendet:* Freitag, 17. Februar 2017 14:57
> *An:* Schober Beatrix [STEMMER IMAGING GmbH] <b.schober at stemmer-imaging.de
> >
> *Cc:* vtkusers at vtk.org
> *Betreff:* Re: [vtkusers] Scaling with VtkTransform and VtkLookupTable
>
>
>
> Hi Bea,
>
>
>
> There is something missing from your explanation: how are you setting the
> scalars for your points? The lookup table maps scalars to colors, and
> scalars are not changed by vtkTransformFilter.
>
>
>
> - David
>
>
>
>
>
> On Fri, Feb 17, 2017 at 12:50 AM, Schober Beatrix [STEMMER IMAGING GmbH] <
> b.schober at stemmer-imaging.de> wrote:
>
> Good morning!
>
>
>
> I am a bit confused about following behaviour. I tried to find an answer /
> solution, but spent already more than a day with that. Maybe the behaviour
> is correct, I just misunderstand it?
>
>
>
> I have a point cloud (VtkPolyData), using a VtkTransform Filter to scale
> the z-values. As I want the points to be displayed colored, I use the
> vtkLookupTable as well as the ScalarBarWidget to display the lookup table.
>
> Before scaling my z-range is 98 – 255, after scaling (2*) the range is 196
> – 510.
>
>
>
> If I do not change the VtkLookupTable’s table range (it is still 98 –
> 255), the colors are mapped correctly from 196 to 510. If I change the
> table range to 196 – 510 and the mapper’s scalar range to 196 – 510, in
> order to get a correct valued ScalarBarWidget (range 196 – 510), only
> colors from 196 to 255 are mapped, everything else not. (The picker shows
> the correctly scaled point data.)
>
>
>
> My questions: Why is the mapping wrong if I update the scalar range /
> lookup table range? How can I achieve a correctly scaled ScalarBarWidget
> (196 – 510)?
>
>
>
> Thank you very much in advance for your support!
>
>
>
> Bea
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170217/e508bac1/attachment.html>
More information about the vtkusers
mailing list