[vtkusers] Re: filters, SetInputConnection vs SetInput

Goodwin Lawlor goodwin.lawlor at ucd.ie
Thu Feb 22 17:08:28 EST 2007


dean.inglis at camris.ca wrote:
> Hi,
> 
> I have a vtkImageData that I create on
> the fly: not as output from a filter or reader
> object.   I want to use vtkImageClip to extract
> a slice for processing, but I get the error:
> 
> ERROR: In d:\Developer\Sources\STABLE\VTK_5.0.2\Filtering\vtkDemandDrivenPipeline.cxx, line 710
> vtkStreamingDemandDrivenPipeline (0E30D820): Input port 0 of algorithm vtkImageClip(0E30DB00) has 0 connections but is not optional.
> 
> since I initialize the vtkImageClip using:
> 
>   vtkImageClip* clip = vtkImageClip::New();
>   int* ext = this->ImageViewer->GetImageActor()->GetDisplayExtent();
>   clip->SetOutputWholeExtent(ext[0],ext[1],ext[2],ext[3],ext[4],ext[5]);
>   clip->ClipDataOn();
>   clip->SetInput(this->ImageData);
>   clip->Update();
> 
> 
> without using the 
> SetInputConnection(some_filter-GetOutputPort()) paradigm. Is there a way around this???

Hi Dean,

You could try using vtkTrivialProducer. Something like

vtkTrivialProducer *tp = vtkTrivialProducer::New();
   tp->SetOutput(this->ImageData);

   clip->SetInputConnection(tp->GetOutputPort());

hth

Goodwin




More information about the vtkusers mailing list