[ITK-users] [vtkusers] Undo vtkImageFlip effects
Marcos
fotosentido at gmail.com
Mon Sep 14 14:36:03 EDT 2015
Well, I tried with an 3x3 matrix, and, as you said it flipped around the
origin I guess.
So I guess I have to locate the center or use 4x4 matrix.
I was trying to use 4x4 matrix, creating a vtkMatrix4x4, but I don't know
what values to insert.
I checked the ImageSlicing example but not sure what I have to do.
Reviewing related topics I found an answer of yours:
"The first three columns are the the direction cosine vectors (for these,
the 4th component should be zero). The three direction cosine vectors
should be perpendicular to each other.
The fourth column (whose 4th component must be 1.0) gives a translation,
defined with respect to the coordinate system of the input of
vtkImageReslice."
So I tried this code:
//flipperX->SetResliceAxesDirectionCosines(1,0,0, 0,-1,0, 0,0,1);
vtkSmartPointer<vtkMatrix4x4> matriz = vtkSmartPointer<vtkMatrix4x4>::New();
matriz->SetElement(0,0,1);
matriz->SetElement(0,1,0);
matriz->SetElement(0,2,0);
matriz->SetElement(0,3,0);
matriz->SetElement(1,0,0);
matriz->SetElement(1,1,-1);
matriz->SetElement(1,2,0);
matriz->SetElement(1,3,0);
matriz->SetElement(2,0,0);
matriz->SetElement(2,1,0);
matriz->SetElement(2,2,1);
matriz->SetElement(2,3,0);
matriz->SetElement(3,0,0);
matriz->SetElement(3,1,0);
matriz->SetElement(3,2,0);
matriz->SetElement(3,3,0);
flipperX->SetResliceAxes(matriz);
flipperX->Update();
The image disappeared :(
Not sure if I'm doing well.
2015-09-14 19:19 GMT+02:00 David Gobbi <david.gobbi at gmail.com>:
> Hi Marcos,
>
> It might be more convenient to use vtkImageReslice to flip the images. It
> can take a 3x3 or 4x4 matrix that describes the transformation.
>
> For a 3x3 matrix that flips the Y axis, you would use this:
>
> reslice->SetResliceAxesDirectionCosines(
> 1, 0, 0,
> 0, -1, 0,
> 0, 0, 1);
>
> Be careful, though, because this flips the image around the origin, rather
> than flipping it around its center.
>
> For a 4x4 matrix, use reslice->SetResliceAxes(vtkMatrix4x4 *). By using a
> 4x4 matrix, you can make sure that the correct center-of-rotation is
> applied.
>
> - David
>
>
> On Mon, Sep 14, 2015 at 11:03 AM, Marcos <fotosentido at gmail.com> wrote:
>
>> Hi,
>>
>> I attached a vtkImageFlip filter to my pipeline, but I can't find the way
>> to "switch off" this filter or revert its effects.
>>
>> I just want to flip my image when I press a button.
>>
>> Any suggestions?
>> Thank you.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150914/7217adde/attachment.html>
More information about the Insight-users
mailing list