[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vtkusers
Subject:    [vtkusers] Need to resize a QImage....
From:       Sebastien Calvi <sebastien.calvi () yahoo ! com>
Date:       2012-06-15 21:09:31
Message-ID: 1339794571.78786.YahooMailNeo () web110114 ! mail ! gq1 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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.


[Attachment #5 (text/html)]

<html><body><div style="color:#000; background-color:#fff; font-family:times new \
roman, new york, times, serif;font-size:12pt"><div>Hello \
All,</div><div><br></div><div>I have to display an image that create myself, it's a \
QImage.</div><div>I use vtkQImageToImageSource to convert it into a vtkImageData and \
it works fine.</div><div><br></div><div>Here is a chunk of my \
code:</div><div><br></div><div><br></div><div>void updateActor( vtkImageActor * \
actor, double magnifyFactor[3] )<br>{<br>&nbsp;&nbsp;&nbsp; vtkImageResize * \
image_resize = vtkImageResize::New();<br>&nbsp;&nbsp;&nbsp; \
image_resize-&gt;SetMagnificationFactors( magnifyFactor );<br><br>&nbsp;&nbsp;&nbsp; \
actor-&gt;SetOrigin( const_cast&lt;double*&gt;( VTK_ORIGIN ) );<br>&nbsp;&nbsp;&nbsp; \
actor-&gt;SetOrientation( _orientation );<br>&nbsp;&nbsp;&nbsp; \
actor-&gt;SetPosition( _position );<br><br>&nbsp;&nbsp;&nbsp; vtkQImageToImageSource \
* qimage_to_image_source =  vtkQImageToImageSource::New();<br>&nbsp;&nbsp;&nbsp; \
qimage_to_image_source-&gt;SetQImage( _image );<br><br>&nbsp;&nbsp;&nbsp; \
image_resize-&gt;SetInputConnection( qimage_to_image_source-&gt;GetOutputPort() \
);<br><br>&nbsp;&nbsp;&nbsp; actor-&gt;SetInput( image_resize-&gt;GetOutput() \
);<br><br>&nbsp;&nbsp;&nbsp; \
qimage_to_image_source-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; \
image_resize-&gt;Delete();<br>}<br></div><div><br></div><div>My problem is that when \
I run my app I get the following error message:</div><div>ERROR: In \
/opt/VTK/Imaging/vtkImageResize.cxx, line 910<br>vtkImageResize (0x28cb430): \
ThreadedRequestData: output scalar type does not match input scalar \
type</div><div><br></div><div>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...</div><div><br></div><div>The unsigned char is \
handled/created by the vtkQImageToImageSource, no way to  change \
that!</div><div><br></div><div>Is there a different way to handle this issue? I'm \
assuming that yes, I jsut would like to know how, \
please?</div><div><br></div><div>Thank you by \
advance,</div><div>Sebastien.</div><div><br></div></div></body></html>



_______________________________________________
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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic