[vtkusers] Molding an image slice

Shark m.nunes at fratoria.com
Wed Apr 5 07:23:41 EDT 2017


Hello David Gobbi,

Thank you for your reply. I have been busy with other things, lately, but I
have managed to make it work. 
I can generate a plane out of the slice, apply a 3D transformation per point
of the plane. Before applying the vtkTexture extracted from the slice, I am
able to see it and it looks correct. 

However, when the I pass the texture to the actor, it seems that the texture
is not well mapped to the plane. This is very noticeable in some corners of
the image where the texture is simply cut, because the plane is retracted in
that corner. So, instead of the color texture being molded to the deformed
plane, it is simply applied on top of it without any other consideration. 

Another thing I have noticed is when I set up the resolution of the plane, I
have to reduce a unit from its dimensions, so I can match the number of
points in the displacement field:

vtkPlaneSource* plane = vtkPlaneSource::New();
plane->SetXResolution(img->GetDimensions()[0] - 1);
plane->SetYResolution(img->GetDimensions()[1] - 1);

In this way, both the plane and the warpVector will have the same number of
points. Is this expected? or is it that my displacement field could have
some issue?

Another thing I have noticed is that when I am setting the vtkDoubleArray to
pass to the warpVector, if I set 3 components, and set the Z, there is a
crazy behavior of how the texture is applied to the plane. With the Z
coordinate, things get strange and the texture gets randomly inverted X <->
Y in different slices. 

If I only pass the X and Y coords of the points' transformations (and keep
Z=0), everything looks good. But only 2D transformation. Howevever, when I
set the component to 2 (X and Y, no Z), the plane is not transformed.


I think I am almost there, but something is just not quite right. 
Cheers,
Shark



--
View this message in context: http://vtk.1045678.n5.nabble.com/Molding-an-image-slice-tp5742555p5742725.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list