[vtkusers] compile-time error when inheriting from vtkImageMultipleInputFilter

Jan Owoc jsowoc at gmail.com
Mon May 30 16:07:12 EDT 2005


I've been using vtk for a month now, and I have found the
documentation quite helpful, but now I wanted to develop a few of my
own packages, and the documentation seems incomplete in this respect.
More specifically, I want to create a filter that takes many inputs
and produces a single output. There is a parent class called
vtkImageMultipleInputFilter which I decided to use.

I found out that I need to implement both:
  void ExecuteInformation(vtkImageData **, vtkImageData *);
  void ThreadedExecute(vtkImageData **inDatas, vtkImageData *outData,
int extent[6], int threadId);

I just want to get the interface working for now, so here is my implementation:
void vtkImageAverageFilter::ExecuteInformation(vtkImageData **
manyInputs, vtkImageData * singleOutput)
{
  vtkImageData *input1 = manyInputs[0];
  vtkImageData *input2 = manyInputs[1];
  vtkImageData *output = singleOutput;

  // Copy the input to the output.
  output->CopyStructure( input1 );
  output->GetPointData()->CopyScalarsOn();
  output->GetPointData()->PassData(input1->GetPointData());
  output->GetCellData()->CopyScalarsOn();
  output->GetCellData()->PassData(input1->GetCellData());

  return;
}

//----------------------------------------------------------------------------

void ThreadedExecute(vtkImageData **inDatas, vtkImageData *outData,
int extent[6], int threadId)
{
  vtkImageData *input1 = inDatas[0];
  vtkImageData *input2 = inDatas[1];
  vtkImageData *output = outData;

  // Copy the input to the output.
  output->CopyStructure( input1 );
  output->GetPointData()->CopyScalarsOn();
  output->GetPointData()->PassData(input1->GetPointData());
  output->GetCellData()->CopyScalarsOn();
  output->GetCellData()->PassData(input1->GetCellData());

  return;
}

It generates the ".o" files, but when it is linking, I get the following error:
vtkImageAverageFilter.o(.gnu.linkonce.r._ZTV21vtkImageAverageFilter+0x154):
undefined reference to
`vtkImageAverageFilter::ThreadedExecute(vtkImageData**, vtkImageData*,
int*, int)'
collect2: ld returned 1 exit status

Does anyone know why this is, or could forward me to more detailed
documentation on inheriting from the class
"vtkImageMultipleInputFilter", or on overloading the method
"ThreadedExecute" outside of the Doxygen-generated documentation?

Any help will be greatly appreciated.

Jan Owoc



More information about the vtkusers mailing list