[vtkusers] Casting vtkPNGReader to vtkImageReader2

John Eke johne at annidis.com
Wed Jun 18 14:11:26 EDT 2008


Hi Amy,

The thing is, this is a class I have written that encapsulates reading 
an image from the file system and displaying it in a QVTKWidget. But 
someone else using this class needs access to the read image so they can 
modify it (apply custom filters to it), and have it redisplayed in the 
widget ie. they need access to the rendering pipeline. So I need a way 
to allow users of the class to SetInput and SetInputConnection without 
reading the image all over again.

What I have done right now is to go through a filter. I read the image 
and stored it in a filter. I display from the filters output (no 
transforms were added), and the filter can accept SetInput and 
SetInputConnection. This seems to work well thus far.

Thanks again for your help

- John

Amy Squillacote wrote:
> Hi John,
>
> As Utkarsh told you yesterday, you cannot call SetInput or 
> SetInputConnection on a reader in VTK. Is there some reason you must 
> use the SetInput / SetInputConnection methods? Why not get the output 
> of the reader and operate on that?
>
> - Amy
>
> John Eke wrote:
>> Thanks Amy,
>>
>> I am trying to find a way to successfully call SetInput and 
>> SetInputConnection on vtkPNGReader. I have a scenario where I am 
>> reading a PNG file and displaying it, but external classes need 
>> access to the image data, ie external processes need to be able to 
>> connect to the pipeline via SetInput and SetInputConnection.
>>
>> Would you suggest I maybe save the image in some filter without any 
>> transformations? that way the input and output image data remain the 
>> same and I also have access to SetInput, SetInputConnection, 
>> GetOutput and GetOutputPort
>>
>> Thanks
>>
>> Amy Squillacote wrote:
>>> Hi John,
>>>
>>> What are you trying to do? vtkPNGReader is a direct subclass of 
>>> vtkImageReader2.
>>>
>>> - Amy
>>>
>>> John Eke wrote:
>>>> Hi,
>>>>
>>>> I have read an image using vtkPNGReader, I was wondering how I can 
>>>> safely transfer all that information into vtkImageReader2
>>>>
>>>> - John
>>>> _______________________________________________
>>>> This is the private VTK discussion list.
>>>> Please keep messages on-topic. Check the 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