[vtkusers] vtkImagePlaneWidget and save to jpg

David Gobbi david.gobbi at gmail.com
Tue Oct 5 07:31:15 EDT 2010


You might have to reset the transform before using it:

transform->Identity();
transform->RotateZ(90);

Other than that, I don't know.  You could try a combination of
vtkImagePermute and vtkImageFlip to rotate the image.

  David

On Tue, Oct 5, 2010 at 5:15 AM, Raúl Ferriz <raul at torresyvalero.com> wrote:
>  El 05/10/2010 13:05, David Gobbi escribió:
>>
>> Hi Raul,
>>
>> I think you want a RotateZ(90) here, because the widget has already
>> transformed the slice from its original orientation to the XY plane.
>>
>>   David
>>
>> On Tue, Oct 5, 2010 at 4:51 AM, Raúl Ferriz<raul at torresyvalero.com>
>>  wrote:
>>>
>>>  Many thanks Dave!
>>>
>>> Now I have another issue: when I save the file to a file, I want that
>>> image
>>> get rotated 90 degrees on Y axis (2D). I tried to do this way:
>>>
>>>        _imgdata = imagePlaneWidget->GetResliceOutput();
>>>        if ( _imgdata )
>>>        {
>>>                    // _imgdata is the image data
>>>                    transform->RotateY ( 90 );
>>>
>>>                    transformFilter->SetTransform ( transform );
>>>                    transformFilter->SetInput ( _imgdata );
>>>
>>>                    _imgcast_->SetOutputScalarTypeToUnsignedChar();
>>>                    _imgcast_->SetInput ( transformFilter->GetOutput() );
>>>                    _imgcast_->Update ();
>>>
>>>                    _writer_->SetFileName ( path );
>>>                    _writer_->SetInput ( _imgcast_->GetOutput () );
>>>                    _writer_->Write();
>>>        }
>>>
>>>
>>> But no rotation is made on saved file.
>
> Hi David,
>
> I tried with RotateX(90), RotateY(90) and RotateZ(90) but nothing changes on
> output files.
> _______________________________________________
> 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
>



More information about the vtkusers mailing list