[vtkusers] Rotating image data

Jothy jothybasu at gmail.com
Fri Jul 9 07:34:38 EDT 2010


Some sort of padding befor rotation should help.

Jothy

On Fri, Jul 9, 2010 at 12:32 PM, Srinivasa Rao
<srinivas at rsageventures.com>wrote:

> Hi All,
>
>    I am trying to rotate vtkImageData using vtkTransform and
> vtkImageReslice, i used following code to do the job.
>
>
> vtkImageData * rotateImage(vtkImageData *data, QPointF center, int angle)
> {
>         vtkTransform *imageTransform = vtkTransform::New();
>         imageTransform->PostMultiply();
>
>         imageTransform->Translate(center.x(), center.y(), 0.0);
>         imageTransform->RotateZ(angle);
>        imageTransform->Translate(-center.x(), -center.y(), 0.0);
>
>         // Now create filter and set previously created transformation
>         vtkImageReslice *algo = vtkImageReslice::New();
>         algo->SetInput(data);
>         algo->SetInformationInput(data);
>         algo->SetResliceTransform(imageTransform);
>         algo->SetInterpolationModeToLinear();
>         algo->Update();
>
>         return algo->GetOutput();
> }
>
>
> When i try to rotate image data, after rotation the data which is outside
> the image is getting lost.
> Is there a way around to rotate image data without data loss..
>
> thanks in advance.
>
> regards,
> srinivas.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100709/49f2432d/attachment.htm>


More information about the vtkusers mailing list