[vtkusers] Need to resize a QImage....

Sebastien Calvi sebastien.calvi at yahoo.com
Fri Jun 15 17:09:31 EDT 2012


Hello All,

I have to display an image that create myself, it's a QImage.
I use vtkQImageToImageSource to convert it into a vtkImageData and it works fine.

Here is a chunk of my code:


void updateActor( vtkImageActor * actor, double magnifyFactor[3] )
{
    vtkImageResize * image_resize = vtkImageResize::New();
    image_resize->SetMagnificationFactors( magnifyFactor );

    actor->SetOrigin( const_cast<double*>( VTK_ORIGIN ) );
    actor->SetOrientation( _orientation );
    actor->SetPosition( _position );

    vtkQImageToImageSource * qimage_to_image_source = vtkQImageToImageSource::New();
    qimage_to_image_source->SetQImage( _image );

    image_resize->SetInputConnection( qimage_to_image_source->GetOutputPort() );

    actor->SetInput( image_resize->GetOutput() );

    qimage_to_image_source->Delete();
    image_resize->Delete();
}


My problem is that when I run my app I get the following error message:
ERROR: In /opt/VTK/Imaging/vtkImageResize.cxx, line 910
vtkImageResize (0x28cb430): ThreadedRequestData: output scalar type does not match input scalar type

and effectively when I debug I found out at the corresponding line of code that my input scalar type is unsigned char and the output scalar type is double...

The unsigned char is handled/created by the vtkQImageToImageSource, no way to change that!

Is there a different way to handle this issue? I'm assuming that yes, I jsut would like to know how, please?

Thank you by advance,
Sebastien.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120615/e0311aa0/attachment.htm>


More information about the vtkusers mailing list