24 #include <vtkDataArray.h>
25 #include <vtkImageData.h>
26 #include <vtkPointData.h>
28 class vtkMitkThickSlicesFilterTestHelper
35 auto dim =
new unsigned int[3];
38 dim[2] = max + 1 -
min;
39 testImage->Initialize(pixelType, 3, dim);
40 size_t buffer_size = dim[0] * dim[1] *
sizeof(
unsigned char);
42 for (
int i = min; i <=
max; ++i)
45 memset(writeAccess.GetData(), i, buffer_size);
51 static void EvaluateResult(
unsigned char expectedValue, vtkImageData *image,
const char *projection)
54 image->GetDimensions()[0] == 10 && image->GetDimensions()[1] == 10 && image->GetDimensions()[2] == 1,
55 "Resulting image has correct size");
57 unsigned char *value =
static_cast<unsigned char *
>(image->GetScalarPointer(0, 0, 0));
58 MITK_INFO <<
"Evaluating projection mode: " << projection;
59 MITK_INFO <<
"expected value: " <<
static_cast<double>(expectedValue);
60 MITK_INFO <<
"actual value: " <<
static_cast<double>(value[0]);
82 thickSliceFilter->SetInputData(testImage1->GetVtkImageData());
86 thickSliceFilter->Modified();
87 thickSliceFilter->Update();
88 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(2, thickSliceFilter->GetOutput(),
"MaxIP");
92 thickSliceFilter->Modified();
93 thickSliceFilter->Update();
94 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(1, thickSliceFilter->GetOutput(),
"Sum");
98 thickSliceFilter->Modified();
99 thickSliceFilter->Update();
100 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(1, thickSliceFilter->GetOutput(),
"Weighted");
104 thickSliceFilter->Modified();
105 thickSliceFilter->Update();
106 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(0, thickSliceFilter->GetOutput(),
"MinIP");
110 thickSliceFilter->Modified();
111 thickSliceFilter->Update();
112 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(1, thickSliceFilter->GetOutput(),
"Mean");
124 thickSliceFilter->SetInputData(testImage2->GetVtkImageData());
128 thickSliceFilter->Modified();
129 thickSliceFilter->Update();
130 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(8, thickSliceFilter->GetOutput(),
"MaxIP");
134 thickSliceFilter->Modified();
135 thickSliceFilter->Update();
136 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(5, thickSliceFilter->GetOutput(),
"Sum");
140 thickSliceFilter->Modified();
141 thickSliceFilter->Update();
142 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(4, thickSliceFilter->GetOutput(),
"Weighted");
146 thickSliceFilter->Modified();
147 thickSliceFilter->Update();
148 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(3, thickSliceFilter->GetOutput(),
"MinIP");
152 thickSliceFilter->Modified();
153 thickSliceFilter->Update();
154 vtkMitkThickSlicesFilterTestHelper::EvaluateResult(6, thickSliceFilter->GetOutput(),
"Mean");
156 thickSliceFilter->Delete();
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
static vtkMitkThickSlicesFilter * New()
int vtkMitkThickSlicesFilterTest(int, char *[])
ImageWriteAccessor class to get locked write-access for a particular image part.
void SetThickSliceMode(int mode)
Class for defining the data type of pixels.