[vtkusers] vtkImageToStructuredPoints

Amy Squillacote ahs at cfdrc.com
Wed Jul 23 15:52:28 EDT 2008


Jon Luisi wrote:
> Amy Squillacote wrote:
>> No, you don't need to cast it. vtkImageData is a subclass of 
>> vtkDataObject.
>> - Amy
>>
>> Jon Luisi wrote:
>>> For the VtkImageToStructuredPoints SetInput documentation calls for 
>>> vtkImageData.
>>> In code vtkImageAlgorithm::SetInput(vtkDataObject*)
>>>
>>> I am trying to add the input from a vtkImageReader reader->GetOutput()
>>> Do I need to recast the vtkImageData from the reader to a 
>>> vtkDataObject, and if so what is the best method?
>>> Jon
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
> When I try just connecting the input I get this error
> error C2664: 'void vtkImageAlgorithm::SetInput(vtkDataObject *)' : 
> cannot convert parameter 1 from 'vtkImageData *' to 'vtkDataObject *'
> 1>        Types pointed to are unrelated; conversion requires 
> reinterpret_cast, C-style cast or function-style cast
>
> do I need to change this line of code?
>        vtkImageToStructuredPoints *i2sp = 
> vtkImageToStructuredPoints::New();
>        i2sp->SetInput(reader->GetOutput());
>
>

As indicated in the VTK FAQ 
(http://www.vtk.org/Wiki/VTK_FAQ#The_C.2B.2B_compiler_cannot_convert_some_pointer_type_to_another_pointer_type_in_my_little_program), 
you need to add the following line of code.

#include "vtkImageData.h"


- Amy


-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list