[vtkusers] Molding an image slice

David Gobbi david.gobbi at gmail.com
Tue Mar 21 09:10:13 EDT 2017


Here is an example of applying a texture map to a plane (the warping step
would have to be added).
https://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/TextureMapPlane

To properly set up the vtkPlaneSource to match the image geometry, it would
be necessary to use these methods:
plane->SetResolution(xdivs, ydivs);
plane->SetOrigin(<coords of image corner (0,0)>)
plane->SetPoint1(<coords of image corner (1,0)>)
plane->SetPoint2(<coords of image corner (0,1)>)

On Tue, Mar 21, 2017 at 6:54 AM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Shark,
>
> I think the most efficient option would be a vtkTexture on a vtkPolyData.
> You can use vtkPlaneSource to make a polydata that has as many points as
> your image has pixels.  If necessary, you can use vtkTransformTextureCoords
> to tweak the texture coords.
>
> Then you can use e.g. vtkGridTransform or vtkBSplineTransform with
> vtkTransformPolyDataFilter to warp the plane, or perhaps vtkWarpVector.
>
> Regards,
>  - David
>
>
> On Tue, Mar 21, 2017 at 6:26 AM, Shark <m.nunes at fratoria.com> wrote:
>
>> Hello,
>>
>> I have been trying for some days to "mold" a 3D image slice. (imagine a
>> towel in the wind)
>>
>> What I mean is that I have a 2D slice, extracted from a 3D vtkImageData,
>> and
>> one 3D vector for each pixel of the slice. I want to
>> translate/transform/move each pixel from the 2D slice to a 3D position
>> (and
>> augmenting the extent of the 2D slice in x,y,z when necessary) while
>> keeping
>> these pixel stitched together. I believe my knowledge of all VTK filters
>> is
>> not that great, so I think something is already implemented for this, but
>> I
>> cannot find it.
>>
>> Currently, my line of thinking is: create an unstructured grid, apply the
>> vectors transformation, create a new vtkImageData from this transformation
>> and map the pixel values through ids (cell IDs? point IDs? ).
>>
>> In the end I would see a slice stretched, compressed and bent up, down and
>> to the sides.
>>
>> Thank you!
>> shark
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170321/c7bab307/attachment.html>


More information about the vtkusers mailing list