[vtkusers] Rotating image data

Srinivasa Rao srinivas at rsageventures.com
Fri Jul 9 07:32:19 EDT 2010


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100709/6994fc80/attachment.htm>


More information about the vtkusers mailing list