Commit 386d19e7 authored by Ken Martin's avatar Ken Martin

ENH: some conversion to new pipeline and better warnings on win32

parent 6e90ade0
......@@ -58,6 +58,8 @@ Do_not_include_vtkWin32Header_directly__vtkSystemIncludes_includes_it;
#endif //VTK_DISPLAY_WIN32_WARNINGS
#endif
#pragma warning ( default : 4263 )
#endif
#if defined(WIN32) && defined(VTK_BUILD_SHARED_LIBS)
......
......@@ -24,7 +24,7 @@
#include "vtkPointData.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkImageAlgorithm, "1.8");
vtkCxxRevisionMacro(vtkImageAlgorithm, "1.9");
//----------------------------------------------------------------------------
vtkImageAlgorithm::vtkImageAlgorithm()
......@@ -390,17 +390,6 @@ void vtkImageAlgorithm::SetInput(int index, vtkDataObject* input)
}
}
//----------------------------------------------------------------------------
void vtkImageAlgorithm::SetInput(vtkDataSet* input)
{
this->SetInput(0, static_cast<vtkDataObject*>(input));
}
//----------------------------------------------------------------------------
void vtkImageAlgorithm::SetInput(int index, vtkDataSet* input)
{
this->SetInput(index, static_cast<vtkDataObject*>(input));
}
//----------------------------------------------------------------------------
void vtkImageAlgorithm::AddInput(vtkDataObject* input)
......@@ -416,15 +405,3 @@ void vtkImageAlgorithm::AddInput(int index, vtkDataObject* input)
this->AddInputConnection(index, input->GetProducerPort());
}
}
//----------------------------------------------------------------------------
void vtkImageAlgorithm::AddInput(vtkDataSet* input)
{
this->AddInput(0, static_cast<vtkDataObject*>(input));
}
//----------------------------------------------------------------------------
void vtkImageAlgorithm::AddInput(int index, vtkDataSet* input)
{
this->AddInput(index, static_cast<vtkDataObject*>(input));
}
......@@ -26,6 +26,7 @@
#define __vtkImageAlgorithm_h
#include "vtkAlgorithm.h"
#include "vtkImageData.h" // makes things a bit easier
class vtkDataSet;
class vtkImageData;
......@@ -49,17 +50,13 @@ public:
// Description:
// Set an input of this algorithm.
void SetInput(vtkDataObject *);
void SetInput(int, vtkDataObject*);
void SetInput(vtkDataSet*);
void SetInput(int, vtkDataSet*);
virtual void SetInput(vtkDataObject *);
virtual void SetInput(int, vtkDataObject*);
// Description:
// Add an input of this algorithm.
void AddInput(vtkDataObject *);
void AddInput(vtkDataSet*);
void AddInput(int, vtkDataSet*);
void AddInput(int, vtkDataObject*);
virtual void AddInput(vtkDataObject *);
virtual void AddInput(int, vtkDataObject*);
protected:
vtkImageAlgorithm();
......
......@@ -27,7 +27,7 @@
#include "vtkObjectFactory.h"
#include "vtkSmartPointer.h"
vtkCxxRevisionMacro(vtkStreamingDemandDrivenPipeline, "1.9");
vtkCxxRevisionMacro(vtkStreamingDemandDrivenPipeline, "1.10");
vtkStandardNewMacro(vtkStreamingDemandDrivenPipeline);
vtkInformationKeyMacro(vtkStreamingDemandDrivenPipeline, CONTINUE_EXECUTING, Integer);
......@@ -613,12 +613,14 @@ int vtkStreamingDemandDrivenPipeline::NeedToExecuteData(int outputPort)
int updateExtent[6];
outInfo->Get(UPDATE_EXTENT(), updateExtent);
dataInfo->Get(vtkDataObject::DATA_EXTENT(), dataExtent);
// if the ue is out side the de
if((updateExtent[0] < dataExtent[0] ||
updateExtent[1] > dataExtent[1] ||
updateExtent[2] < dataExtent[2] ||
updateExtent[3] > dataExtent[3] ||
updateExtent[4] < dataExtent[4] ||
updateExtent[5] > dataExtent[5]) &&
// and the ue is set
(updateExtent[0] <= updateExtent[1] &&
updateExtent[2] <= updateExtent[3] &&
updateExtent[4] <= updateExtent[5]))
......
......@@ -17,7 +17,7 @@
#include "vtkImageData.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkImageCheckerboard, "1.11");
vtkCxxRevisionMacro(vtkImageCheckerboard, "1.12");
vtkStandardNewMacro(vtkImageCheckerboard);
//----------------------------------------------------------------------------
......@@ -26,6 +26,8 @@ vtkImageCheckerboard::vtkImageCheckerboard()
this->NumberOfDivisions[0] = 2;
this->NumberOfDivisions[1] = 2;
this->NumberOfDivisions[2] = 2;
this->SetNumberOfInputPorts(2);
}
//----------------------------------------------------------------------------
......@@ -155,45 +157,37 @@ void vtkImageCheckerboardExecute2(vtkImageCheckerboard *self,
//----------------------------------------------------------------------------
// This method is passed a input and output regions, and executes the filter
// algorithm to fill the output from the inputs.
void vtkImageCheckerboard::ThreadedExecute(vtkImageData **inData,
vtkImageData *outData,
int outExt[6], int id)
void vtkImageCheckerboard::ThreadedRequestData(
vtkInformation * vtkNotUsed( request ),
vtkInformationVector ** vtkNotUsed( inputVector ),
vtkInformationVector * vtkNotUsed( outputVector ),
vtkImageData ***inData,
vtkImageData **outData,
int outExt[6], int id)
{
void *in1Ptr, *in2Ptr;
void *outPtr;
vtkDebugMacro(<< "Execute: inData = " << inData
<< ", outData = " << outData);
if (inData[0] == NULL)
if (inData[0][0] == NULL)
{
vtkErrorMacro(<< "Input " << 0 << " must be specified.");
return;
}
in1Ptr = inData[0]->GetScalarPointerForExtent(outExt);
in1Ptr = inData[0][0]->GetScalarPointerForExtent(outExt);
if (!in1Ptr)
{
vtkErrorMacro(<< "Input " << 0 << " cannot be empty.");
return;
}
outPtr = outData->GetScalarPointerForExtent(outExt);
outPtr = outData[0]->GetScalarPointerForExtent(outExt);
// this filter expects that input is the same type as output.
if (inData[0]->GetScalarType() != outData->GetScalarType())
{
vtkErrorMacro(<< "Execute: input ScalarType, " << inData[0]->GetScalarType()
<< ", must match out ScalarType " << outData->GetScalarType());
return;
}
if (inData[1] == NULL)
if (inData[1][0] == NULL)
{
vtkErrorMacro(<< "Input " << 1 << " must be specified.");
return;
}
in2Ptr = inData[1]->GetScalarPointerForExtent(outExt);
in2Ptr = inData[1][0]->GetScalarPointerForExtent(outExt);
if (!in2Ptr)
{
vtkErrorMacro(<< "Input " << 1 << " cannot be empty.");
......@@ -201,21 +195,21 @@ void vtkImageCheckerboard::ThreadedExecute(vtkImageData **inData,
}
// this filter expects that inputs that have the same number of components
if (inData[0]->GetNumberOfScalarComponents() !=
inData[1]->GetNumberOfScalarComponents())
if (inData[0][0]->GetNumberOfScalarComponents() !=
inData[1][0]->GetNumberOfScalarComponents())
{
vtkErrorMacro(<< "Execute: input1 NumberOfScalarComponents, "
<< inData[0]->GetNumberOfScalarComponents()
<< inData[0][0]->GetNumberOfScalarComponents()
<< ", must match out input2 NumberOfScalarComponents "
<< inData[1]->GetNumberOfScalarComponents());
<< inData[1][0]->GetNumberOfScalarComponents());
return;
}
switch (inData[0]->GetScalarType())
switch (inData[0][0]->GetScalarType())
{
vtkTemplateMacro9(vtkImageCheckerboardExecute2, this, inData[0],
(VTK_TT *)(in1Ptr), inData[1], (VTK_TT *)(in2Ptr),
outData, (VTK_TT *)(outPtr), outExt, id);
vtkTemplateMacro9(vtkImageCheckerboardExecute2, this, inData[0][0],
(VTK_TT *)(in1Ptr), inData[1][0], (VTK_TT *)(in2Ptr),
outData[0], (VTK_TT *)(outPtr), outExt, id);
default:
vtkErrorMacro(<< "Execute: Unknown ScalarType");
return;
......
......@@ -23,13 +23,14 @@
#ifndef __vtkImageCheckerboard_h
#define __vtkImageCheckerboard_h
#include "vtkImageTwoInputFilter.h"
#include "vtkThreadedImageAlgorithm.h"
class VTK_IMAGING_EXPORT vtkImageCheckerboard : public vtkImageTwoInputFilter
class VTK_IMAGING_EXPORT vtkImageCheckerboard : public vtkThreadedImageAlgorithm
{
public:
static vtkImageCheckerboard *New();
vtkTypeRevisionMacro(vtkImageCheckerboard,vtkImageTwoInputFilter);
vtkTypeRevisionMacro(vtkImageCheckerboard,vtkThreadedImageAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......@@ -37,12 +38,21 @@ public:
vtkSetVector3Macro(NumberOfDivisions,int);
vtkGetVectorMacro(NumberOfDivisions,int,3);
// Description:
// Set the two inputs to this filter
virtual void SetInput1(vtkDataObject *in) { this->SetInput(0,in); }
virtual void SetInput2(vtkDataObject *in) { this->SetInput(1,in); }
protected:
vtkImageCheckerboard();
~vtkImageCheckerboard() {};
void ThreadedExecute(vtkImageData **inDatas, vtkImageData *outData,
int extent[6], int id);
virtual void ThreadedRequestData(vtkInformation *request,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector,
vtkImageData ***inData,
vtkImageData **outData,
int extent[6], int threadId);
int NumberOfDivisions[3];
private:
vtkImageCheckerboard(const vtkImageCheckerboard&); // Not implemented.
......
......@@ -15,58 +15,77 @@
#include "vtkImageCorrelation.h"
#include "vtkImageData.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkImageCorrelation, "1.28");
vtkCxxRevisionMacro(vtkImageCorrelation, "1.29");
vtkStandardNewMacro(vtkImageCorrelation);
//----------------------------------------------------------------------------
vtkImageCorrelation::vtkImageCorrelation()
{
this->Dimensionality = 2;
this->SetNumberOfInputPorts(2);
}
//----------------------------------------------------------------------------
// Grow the output image
void vtkImageCorrelation::ExecuteInformation(
vtkImageData **vtkNotUsed(inDatas), vtkImageData *outData)
void vtkImageCorrelation::ExecuteInformation (
vtkInformation * vtkNotUsed(request),
vtkInformationVector ** vtkNotUsed( inputVector ),
vtkInformationVector *outputVector)
{
outData->SetNumberOfScalarComponents(1);
outData->SetScalarType(VTK_FLOAT);
// get the info objects
vtkInformation* outInfo = outputVector->GetInformationObject(0);
outInfo->Set(vtkDataObject::SCALAR_NUMBER_OF_COMPONENTS(),1);
outInfo->Set(vtkDataObject::SCALAR_TYPE(),VTK_FLOAT);
}
//----------------------------------------------------------------------------
// Grow
void vtkImageCorrelation::ComputeInputUpdateExtent(int inExt[6],
int outExt[6],
int whichInput)
void vtkImageCorrelation::RequestUpdateExtent (
vtkInformation * vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
if (whichInput == 1)
{
// get the whole image for input 2
memcpy(inExt,this->GetInput(whichInput)->GetWholeExtent(),6*sizeof(int));
}
else
// get the info objects
vtkInformation* outInfo = outputVector->GetInformationObject(0);
vtkInformation* inInfo1 = inputVector[0]->GetInformationObject(0);
vtkInformation* inInfo2 = inputVector[1]->GetInformationObject(0);
// get the whole image for input 2
int inWExt2[6];
inInfo2->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),inWExt2);
inInfo2->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
inWExt2, 6);
int inWExt1[6];
inInfo1->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),inWExt1);
// try to get all the data required to handle the boundaries
// but limit to the whole extent
int idx;
int inUExt1[6];
outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),inUExt1);
for (idx = 0; idx < 3; idx++)
{
// try to get all the data required to handle the boundaries
// but limit to the whole extent
int idx;
int *i0WExtent = this->GetInput(0)->GetWholeExtent();
int *i1WExtent = this->GetInput(1)->GetWholeExtent();
memcpy(inExt,outExt,6*sizeof(int));
for (idx = 0; idx < 3; idx++)
inUExt1[idx*2+1] = inUExt1[idx*2+1] +
(inWExt2[idx*2+1] - inWExt2[idx*2]);
// clip to whole extent
if (inUExt1[idx*2+1] > inWExt1[idx*2+1])
{
inExt[idx*2+1] = outExt[idx*2+1] +
(i1WExtent[idx*2+1] - i1WExtent[idx*2]);
// clip to whole extent
if (inExt[idx*2+1] > i0WExtent[idx*2+1])
{
inExt[idx*2+1] = i0WExtent[idx*2+1];
}
inUExt1[idx*2+1] = inWExt1[idx*2+1];
}
}
inInfo1->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
inUExt1, 6);
}
......@@ -104,7 +123,7 @@ void vtkImageCorrelationExecute(vtkImageCorrelation *self,
target++;
// get some other info we need
in2Extent = self->GetInput2()->GetWholeExtent();
in2Extent = in2Data->GetWholeExtent();
// Get increments to march through data
in1Data->GetContinuousIncrements(outExt, in1CIncX, in1CIncY, in1CIncZ);
......@@ -189,54 +208,46 @@ void vtkImageCorrelationExecute(vtkImageCorrelation *self,
// algorithm to fill the output from the inputs.
// It just executes a switch statement to call the correct function for
// the datas data types.
void vtkImageCorrelation::ThreadedExecute(vtkImageData **inData,
vtkImageData *outData,
int outExt[6], int id)
void vtkImageCorrelation::ThreadedRequestData(
vtkInformation * vtkNotUsed( request ),
vtkInformationVector ** vtkNotUsed( inputVector ),
vtkInformationVector * vtkNotUsed( outputVector ),
vtkImageData ***inData,
vtkImageData **outData,
int outExt[6], int id)
{
int *in2Extent;
void *in1Ptr;
void *in2Ptr;
float *outPtr;
vtkDebugMacro(<< "Execute: inData = " << inData << ", outData = " << outData);
if (inData[0] == NULL)
{
vtkErrorMacro(<< "Input " << 0 << " must be specified.");
return;
}
if (inData[1] == NULL)
{
vtkErrorMacro(<< "Input " << 1 << " must be specified.");
return;
}
in2Extent = this->GetInput(1)->GetWholeExtent();
in1Ptr = inData[0]->GetScalarPointerForExtent(outExt);
in2Ptr = inData[1]->GetScalarPointerForExtent(in2Extent);
outPtr = (float *)outData->GetScalarPointerForExtent(outExt);
in2Extent = inData[1][0]->GetWholeExtent();
in1Ptr = inData[0][0]->GetScalarPointerForExtent(outExt);
in2Ptr = inData[1][0]->GetScalarPointerForExtent(in2Extent);
outPtr = (float *)outData[0]->GetScalarPointerForExtent(outExt);
// this filter expects that input is the same type as output.
if (inData[0]->GetScalarType() != inData[1]->GetScalarType())
if (inData[0][0]->GetScalarType() != inData[1][0]->GetScalarType())
{
vtkErrorMacro(<< "Execute: input ScalarType, " <<
inData[0]->GetScalarType() << " and input2 ScalarType " <<
inData[1]->GetScalarType() << ", should match");
inData[0][0]->GetScalarType() << " and input2 ScalarType " <<
inData[1][0]->GetScalarType() << ", should match");
return;
}
// input depths must match
if (inData[0]->GetNumberOfScalarComponents() !=
inData[1]->GetNumberOfScalarComponents())
if (inData[0][0]->GetNumberOfScalarComponents() !=
inData[1][0]->GetNumberOfScalarComponents())
{
vtkErrorMacro(<< "Execute: input depths must match");
return;
}
switch (inData[0]->GetScalarType())
switch (inData[0][0]->GetScalarType())
{
vtkTemplateMacro9(vtkImageCorrelationExecute, this, inData[0],
(VTK_TT *)(in1Ptr), inData[1], (VTK_TT *)(in2Ptr),
outData, outPtr, outExt, id);
vtkTemplateMacro9(vtkImageCorrelationExecute, this, inData[0][0],
(VTK_TT *)(in1Ptr), inData[1][0], (VTK_TT *)(in2Ptr),
outData[0], outPtr, outExt, id);
default:
vtkErrorMacro(<< "Execute: Unknown ScalarType");
return;
......
......@@ -26,13 +26,13 @@
#include "vtkImageTwoInputFilter.h"
#include "vtkThreadedImageAlgorithm.h"
class VTK_IMAGING_EXPORT vtkImageCorrelation : public vtkImageTwoInputFilter
class VTK_IMAGING_EXPORT vtkImageCorrelation : public vtkThreadedImageAlgorithm
{
public:
static vtkImageCorrelation *New();
vtkTypeRevisionMacro(vtkImageCorrelation,vtkImageTwoInputFilter);
vtkTypeRevisionMacro(vtkImageCorrelation,vtkThreadedImageAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......@@ -40,17 +40,29 @@ public:
vtkSetClampMacro(Dimensionality,int,2,3);
vtkGetMacro(Dimensionality,int);
// Description:
// Set the two inputs to this filter
virtual void SetInput1(vtkDataObject *in) { this->SetInput(0,in); }
virtual void SetInput2(vtkDataObject *in) { this->SetInput(1,in); }
protected:
vtkImageCorrelation();
~vtkImageCorrelation() {};
int Dimensionality;
void ExecuteInformation(vtkImageData **inDatas, vtkImageData *outData);
virtual void ComputeInputUpdateExtent(int inExt[6], int outExt[6],
int whichInput);
void ExecuteInformation(){this->vtkImageTwoInputFilter::ExecuteInformation();};
void ThreadedExecute(vtkImageData **inDatas, vtkImageData *outData,
int extent[6], int id);
void ExecuteInformation (vtkInformation *,
vtkInformationVector **, vtkInformationVector *);
virtual void RequestUpdateExtent(vtkInformation*,
vtkInformationVector**,
vtkInformationVector*);
virtual void ThreadedRequestData(vtkInformation *request,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector,
vtkImageData ***inData,
vtkImageData **outData,
int extent[6], int threadId);
private:
vtkImageCorrelation(const vtkImageCorrelation&); // Not implemented.
void operator=(const vtkImageCorrelation&); // Not implemented.
......
This diff is collapsed.
......@@ -18,30 +18,36 @@
// It allows the images to be slightly different. If AllowShift is on,
// then each pixel can be shifted by one pixel. Threshold is the allowable
// error for each pixel.
//
// This is not a symetric filter and the difference computed is not symetric
// when AllowShift is on. Specifically in that case a pixel in SetImage input
// will be compared to the matching pixel in the input as well as to the
// input's eight connected neighbors. BUT... the opposite is not true. So for
// example if a valid image (SetImage) has a single white pixel in it, it
// will not find a match in the input image if the input image is black
// (because none of the nine suspect pixels are white). In contrast, if there
// is a single white pixel in the input image and the valid image (SetImage)
// is all black it will match with no error because all it has to do is find
// black pixels and even though the input image has a white pixel, its
// neighbors are not white.
#ifndef __vtkImageDifference_h
#define __vtkImageDifference_h
#include "vtkImageTwoInputFilter.h"
#include "vtkThreadedImageAlgorithm.h"
class VTK_IMAGING_EXPORT vtkImageDifference : public vtkImageTwoInputFilter
class VTK_IMAGING_EXPORT vtkImageDifference : public vtkThreadedImageAlgorithm
{
public:
static vtkImageDifference *New();
vtkTypeRevisionMacro(vtkImageDifference,vtkImageTwoInputFilter);
vtkTypeRevisionMacro(vtkImageDifference,vtkThreadedImageAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Specify the Image to compare the input to.
void SetImage(vtkImageData *image) {this->SetInput2(image);}
vtkImageData *GetImage() {return this->GetInput2();}
void SetImage(vtkDataObject *image) {this->SetInput(1,image);}
vtkImageData *GetImage();
// Description:
// Specify the Input for comparison.
void SetInput(vtkImageData *input) {this->SetInput1(input);}
void SetInput(int num, vtkImageData *input)
{ this->vtkImageMultipleInputFilter::SetInput(num, input); };
// Description:
// Return the total error in comparing the two images.
double GetError(void);
......@@ -89,12 +95,17 @@ protected:
int Threshold;
int Averaging;
void ExecuteInformation(vtkImageData **inputs, vtkImageData *output);
void ComputeInputUpdateExtent(int inExt[6], int outExt[6],
int whichInput);
void ExecuteInformation(){this->vtkImageTwoInputFilter::ExecuteInformation();};
void ThreadedExecute(vtkImageData **inDatas, vtkImageData *outData,
int extent[6], int id);
void ExecuteInformation (vtkInformation *,
vtkInformationVector **, vtkInformationVector *);
void RequestUpdateExtent(vtkInformation *,
vtkInformationVector **, vtkInformationVector *);
virtual void ThreadedRequestData(vtkInformation *request,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector,
vtkImageData ***inData,
vtkImageData **outData,
int extent[6], int threadId);
private:
vtkImageDifference(const vtkImageDifference&); // Not implemented.
......
......@@ -16,17 +16,30 @@
#include "vtkImageData.h"
#include "vtkImageProgressIterator.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkImageDotProduct, "1.28");
vtkCxxRevisionMacro(vtkImageDotProduct, "1.29");
vtkStandardNewMacro(vtkImageDotProduct);
//----------------------------------------------------------------------------
vtkImageDotProduct::vtkImageDotProduct()
{
this->SetNumberOfInputPorts(2);
}
//----------------------------------------------------------------------------
// Colapse the first axis
void vtkImageDotProduct::ExecuteInformation(vtkImageData **vtkNotUsed(inDatas),
vtkImageData *outData)
void vtkImageDotProduct::ExecuteInformation (
vtkInformation * vtkNotUsed(request),
vtkInformationVector ** vtkNotUsed( inputVector ),
vtkInformationVector *outputVector)
{
outData->SetNumberOfScalarComponents(1);
// get the info objects
vtkInformation* outInfo = outputVector->GetInformationObject(0);
outInfo->Set(vtkDataObject::SCALAR_NUMBER_OF_COMPONENTS(),1);
}
......@@ -81,58 +94,48 @@ void vtkImageDotProductExecute(vtkImageDotProduct *self,
// algorithm to fill the output from the inputs.
// It just executes a switch statement to call the correct function for
// the regions data types.
void vtkImageDotProduct::ThreadedExecute(vtkImageData **inData,
vtkImageData *outData,
int outExt[6], int id)
void vtkImageDotProduct::ThreadedRequestData(
vtkInformation * vtkNotUsed( request ),
vtkInformationVector ** vtkNotUsed( inputVector ),
vtkInformationVector * vtkNotUsed( outputVector ),
vtkImageData ***inData,
vtkImageData **outData,
int outExt[6], int id)
{
vtkDebugMacro(<< "Execute: inData = " << inData
<< ", outData = " << outData);
if (inData[0] == NULL)
{
vtkErrorMacro(<< "Input " << 0 << " must be specified.");
return;
}
if (inData[1] == NULL)
{
vtkErrorMacro(<< "Input " << 1 << " must be specified.");
return;
}
// this filter expects that input is the same type as output.
if (inData[0]->GetScalarType() != outData->GetScalarType())
if (inData[0][0]->GetScalarType() != outData[0]->GetScalarType())
{
vtkErrorMacro(<< "Execute: input1 ScalarType, "
<< inData[0]->GetScalarType()
<< inData[0][0]->GetScalarType()
<< ", must match output ScalarType "
<< outData->GetScalarType());
<< outData[0]->GetScalarType());
return;
}
if (inData[1]->GetScalarType() != outData->GetScalarType())
if (inData[1][0]->GetScalarType() != outData[0]->GetScalarType())
{
vtkErrorMacro(<< "Execute: input2 ScalarType, "
<< inData[1]->GetScalarType()
<< inData[1][0]->GetScalarType()
<< ", must match output ScalarType "
<< outData->GetScalarType());
<< outData[0]->GetScalarType());
return;
}
// this filter expects that inputs that have the same number of components
if (inData[0]->GetNumberOfScalarComponents() !=
inData[1]->GetNumberOfScalarComponents())
if (inData[0][0]->GetNumberOfScalarComponents() !=
inData[1][0]->GetNumberOfScalarComponents())
{
vtkErrorMacro(<< "Execute: input1 NumberOfScalarComponents, "
<< inData[0]->GetNumberOfScalarComponents()
<< inData[0][0]->GetNumberOfScalarComponents()
<< ", must match out input2 NumberOfScalarComponents "
<< inData[1]->GetNumberOfScalarComponents());
<< inData[1][0]->GetNumberOfScalarComponents());
return;
}
switch (inData[0]->GetScalarType())
switch (inData[0][0]->GetScalarType())
{
vtkTemplateMacro7(vtkImageDotProductExecute, this, inData[0],
inData[1], outData, outExt, id,
vtkTemplateMacro7(vtkImageDotProductExecute, this, inData[0][0],
inData[1][0], outData[0], outExt, id,
static_cast<VTK_TT *>(0));
default:
vtkErrorMacro(<< "Execute: Unknown ScalarType");
......
......@@ -22,22 +22,33 @@
#include "vtkImageTwoInputFilter.h"
#include "vtkThreadedImageAlgorithm.h"
class VTK_IMAGING_EXPORT vtkImageDotProduct : public vtkImageTwoInputFilter
class VTK_IMAGING_EXPORT vtkImageDotProduct : public vtkThreadedImageAlgorithm
{
public:
static vtkImageDotProduct *New();
vtkTypeRevisionMacro(vtkImageDotProduct,vtkImageTwoInputFilter);