<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 5, 2017 at 5:23 AM, Shark <span dir="ltr"><<a href="mailto:m.nunes@fratoria.com" target="_blank">m.nunes@fratoria.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
However, when the I pass the texture to the actor, it seems that the texture<br>
is not well mapped to the plane. This is very noticeable in some corners of<br>
the image where the texture is simply cut, because the plane is retracted in<br>
that corner. So, instead of the color texture being molded to the deformed<br>
plane, it is simply applied on top of it without any other consideration.<br></blockquote><div><br></div><div>If the parts of the plane are folded back, then you might have to use either</div><div>vtkGridTransform or vtkBSplineTransform, instead of using vtkWarpVector.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Another thing I have noticed is when I set up the resolution of the plane, I<br>
have to reduce a unit from its dimensions, so I can match the number of<br>
points in the displacement field:<br></blockquote><div><br></div><div>The resolution of the vtkPlaneSource is the number of facets (little squares)</div><div>that make up the plane.  It's basic math that the number of points will be the</div><div>number of facets plus one.</div><div><br></div><div>The texture coords are associated with the points, so you have two options:</div><div>you can set the number of facets to be equal to the number of pixels in your</div><div>image, and then map the texture coords to the corners of your pixels.  Or you</div><div>can set the number of points to be equal to the number of pixels, and map</div><div>the texture coords to the centers of your pixels.  Both of these methods is</div><div>perfectly valid (you just have to be sure that you set the texture coords</div><div>correctly).</div><div><br></div><div>Also, remember that in texture coordinates, the position (0,0) is at the corner</div><div>of the first texel, whereas in image coordinates, the origin is at the center of</div><div>the first pixel.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Another thing I have noticed is that when I am setting the vtkDoubleArray to<br>
pass to the warpVector, if I set 3 components, and set the Z, there is a<br>
crazy behavior of how the texture is applied to the plane. With the Z<br>
coordinate, things get strange and the texture gets randomly inverted X <-><br>
Y in different slices.<br></blockquote><div><br></div><div>You might have better luck applying the transformation with vtkGridTransform</div><div>and vtkTransformPolyDataFilter.  The vtkGridTransform expects a vector image</div><div>as its input, i.e. an image where each pixel is a displacement vector (dx,dy,dz).</div><div><br></div><div> - David</div></div></div></div>