[ITK] [ITK-users] [vtkusers] Undo vtkImageFlip effects

Marcos fotosentido at gmail.com
Mon Sep 14 14:55:02 EDT 2015


I set the fourth component of the fourth column to 1:


matriz->SetElement(3,3,1);


ant the rotation is the same as with 3x3. Even with multiframe images,
all frames are upside down (good) but not centered.


The problem is locating the center of the image, even with multiframe.


Any ideas? Thanks.


2015-09-14 20:36 GMT+02:00 Marcos <fotosentido at gmail.com>:

> 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/community/attachments/20150914/3f1a8904/attachment.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list