MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkThreadedToFRawDataReconstructionTest.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
13#include <mitkTestingMacros.h>
16
28
32int mitkThreadedToFRawDataReconstructionTest(int /* argc */, char* /*argv*/[])
33{
34 MITK_TEST_BEGIN("mitkThreadedToFRawDataReconstruction");
35 mitk::ThreadedToFRawDataReconstruction::Pointer testObject = mitk::ThreadedToFRawDataReconstruction::New();
36
37 MITK_TEST_CONDITION_REQUIRED(testObject.GetPointer(), "Testing initializing of class");
38 MITK_TEST_CONDITION_REQUIRED(!testObject->GetInit(), "Testing initial state of GetInit()");
39 int width = 176;
40 int height = 144;
41 int modfreq = 20;
42 int sdsize = width*height*8*sizeof(short);
43 testObject->Initialize(width, height, modfreq, sdsize );
44 MITK_TEST_CONDITION_REQUIRED(testObject->GetInit(), "Testing state of GetInit() after initialization");
45
46 // generate artificial data
47 short* shortSource = new short[sdsize];
48 vtkShortArray* channelData = vtkShortArray::New();
49
50 for(long i = 0; i < sdsize; ++i)
51 {
52 shortSource[i] = i+1;
53 }
54
55 // use the helper object to set required variables
56 RawDataDeviceHelperImpl::Pointer testHelper = RawDataDeviceHelperImpl::New();
57 testHelper->SetCaptureWidth(width);
58 testHelper->SetCaptureHeight(height);
59 testHelper->GetChannelSourceData(shortSource, channelData);
60 testObject->SetChannelData( channelData );
61 testObject->Update();
62
63 float* distances = new float[width*height];
64 float* amplitudes = new float[width*height];
65 float* intensties = new float[width*height];
66
67 // set random value and check if it has changed after filter update
68 distances[50] = -111;
69 amplitudes[50] = -111;
70 intensties[50] = -111;
71 float before = distances[50];
72
73 testObject->GetDistances(distances);
74 testObject->GetAmplitudes(amplitudes);
75 testObject->GetIntensities(intensties);
76 MITK_TEST_CONDITION_REQUIRED(before != distances[50], "Testing distance data generation and output");
77 MITK_TEST_CONDITION_REQUIRED(before != amplitudes[50], "Testing ampltude data generation and output");
78 MITK_TEST_CONDITION_REQUIRED(before != intensties[50], "Testing intensity data generation and output");
79
80 // clean up the mess
81 delete[] distances;
82 delete[] amplitudes;
83 delete[] intensties;
84 delete[] shortSource;
85 channelData->Delete();
86 MITK_TEST_END();
87}
88
89
mitkClassMacro(RawDataDeviceHelperImpl, mitk::ToFCameraPMDRawDataCamBoardDevice)
itkSetMacro(CaptureHeight, int)
itkFactorylessNewMacro(Self) itkCloneMacro(Self) itkSetMacro(CaptureWidth
Device class representing a PMD CamBoard camera.
itkCloneMacro(Self) virtual void SetProperty(const char *propertyKey
set a BaseProperty
int mitkThreadedToFRawDataReconstructionTest(int, char *[])