Skip to content
Snippets Groups Projects
Commit 20a86e82 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

vtkImageAccumulate: handle errors in the actual algorithm

parent f0c36199
Branches
No related tags found
No related merge requests found
......@@ -126,14 +126,14 @@ vtkImageStencilData *vtkImageAccumulate::GetStencil()
//----------------------------------------------------------------------------
// This templated function executes the filter for any type of data.
template <class T>
void vtkImageAccumulateExecute(vtkImageAccumulate *self,
vtkImageData *inData, T *,
vtkImageData *outData, vtkIdType *outPtr,
double min[3], double max[3],
double mean[3],
double standardDeviation[3],
vtkIdType *voxelCount,
int* updateExtent)
int vtkImageAccumulateExecute(vtkImageAccumulate *self,
vtkImageData *inData, T *,
vtkImageData *outData, vtkIdType *outPtr,
double min[3], double max[3],
double mean[3],
double standardDeviation[3],
vtkIdType *voxelCount,
int* updateExtent)
{
// variables used to compute statistics (filter handles max 3 components)
double sum[3];
......@@ -147,6 +147,10 @@ void vtkImageAccumulateExecute(vtkImageAccumulate *self,
// input's number of components is used as output dimensionality
int numC = inData->GetNumberOfScalarComponents();
if (numC > 3)
{
return 0;
}
// get information for output data
int outExtent[6];
......@@ -255,6 +259,7 @@ void vtkImageAccumulateExecute(vtkImageAccumulate *self,
}
}
return 1;
}
......@@ -308,9 +313,10 @@ int vtkImageAccumulate::RequestData(
return 0;
}
int retVal = 0;
switch (inData->GetScalarType())
{
vtkTemplateMacro(vtkImageAccumulateExecute( this,
vtkTemplateMacro(retVal = vtkImageAccumulateExecute( this,
inData,
static_cast<VTK_TT *>(inPtr),
outData,
......@@ -325,7 +331,7 @@ int vtkImageAccumulate::RequestData(
return 0;
}
return 1;
return retVal;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment