Re: [vtkusers] Re: can't find function vtkContourFilter::SetInput(vtkImageData*) ŒQÿ¿

Sean McInerney seanm at nmr.mgh.harvard.edu
Wed Aug 4 04:09:46 EDT 2004


Mac,

   Irene's on the right track ... the problem is lack of type 
information ... but casting is *NOT* the solution. All you need is a 
single line of code:

#include "vtkImageData.h"

-Sean

Irene Tedjo wrote:
>>Here is the relevent c++ code:  (awData is the stick 
>>figure) 
>> 
>>    vtkImplicitModeller * imp = 
>>vtkImplicitModeller::New(); 
>>        imp->SetInput( awData ); 
>>        imp->SetSampleDimensions( 80, 80, 
>>256 );  //resolution 
>>        imp->SetMaximumDistance( 4 );  //perimiter of 
>>calculation 
>>        imp->SetModelBounds( -15, 20, -5, 5, -1.0, 
>>50.0 ); 
>>
>>    vtkContourFilter * contour = vtkContourFilter::New(); 
>>        contour->SetInput( imp->GetOutput() ); 
>>        contour->SetValue( 0, 1.0 ); 
>>   vtkPolyDataMapper * impMapper > 
>>vtkPolyDataMapper::New(); 
>>        impMapper->SetInput( contour->GetOutput() ); 
>>        impMapper->ScalarVisibilityOff(); 
>>
>>
>>However!  I get this funky compile-time error: 
>> 
>>/imports/archive/u1/uaf/cowell/airway/airway.cxx:113: no 
>>matching function 
>>for 
>>   call to `vtkContourFilter::SetInput(vtkImageData*)' 
>>
> 
> /imports/projects/UAFINSP/vtk-src/Filtering/vtkDataSetToPolyDataFilter.h:44:
> 
> 
>>candidates 
>>   are: virtual void 
>>vtkDataSetToPolyDataFilter::SetInput(vtkDataSet*) 
>> 
> 
>  
> Hi Mac, 
>  
> by c++ you should convert the data structure explicitly 
> because vtkImageData is a subclass of vtkDataSet. Try to do 
> this: 
>   
> vtkContourFilter * contour = vtkContourFilter::New(); 
>          contour->SetInput( (vtkDataSet*)imp->GetOutput() ); 
>          contour->SetValue( 0, 1.0 ); 
>  
> Good luck. 
>  
> Irene 
>  
>  
> 



More information about the vtkusers mailing list