MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkToFCameraPMDControllerTest.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// mitk includes
13#include <mitkTestingMacros.h>
15#include <mitkCommon.h>
16#include <mitkToFConfig.h>
17
18// itk includes
19#include "itkObject.h"
20#include "itkObjectFactory.h"
21
25//creating a concrete test implementation of the abstract class
26namespace mitk
27{
33 {
34 public:
37 itkCloneMacro(Self)
38
39 inline bool OpenCameraConnection(){return true;};
40
41 protected:
44
45 inline void TransformCameraOutput(float* in, float* out, bool isDist){};
46
47 private:
48
49 };
50} // end namespace mitk
51
52int mitkToFCameraPMDControllerTest(int /* argc */, char* /*argv*/[])
53{
54 MITK_TEST_BEGIN("ToFCameraPMDController");
55
56 // initialize test
57 mitk::ToFCameraPMDControllerTest::Pointer testObject = mitk::ToFCameraPMDControllerTest::New();
58 try
59 {
60
61 MITK_TEST_CONDITION_REQUIRED(!(testObject.GetPointer() == nullptr) ,"Testing initialization class");
62 MITK_TEST_CONDITION_REQUIRED(testObject->GetCaptureHeight()== 200 ,"Testing initialization of CaptureHeight");
63 MITK_TEST_CONDITION_REQUIRED(testObject->GetCaptureWidth()== 200 ,"Testing initialization of CaptureWidth");
64 int numberOfPixels = testObject->GetCaptureHeight()*testObject->GetCaptureWidth();
65 float* dataArray = new float[numberOfPixels];
66 char* sourceArray = new char[numberOfPixels];
67 short* shortSource = new short[numberOfPixels];
68 MITK_TEST_CONDITION_REQUIRED(testObject->OpenCameraConnection(),"Testing OpenCameraConnection()");
69 MITK_TEST_CONDITION_REQUIRED(testObject->UpdateCamera(),"Testing UpdateCamera() with no camera connected");
70 MITK_TEST_CONDITION_REQUIRED(testObject->GetAmplitudes(dataArray),"Testing GetAmplitudes(float*) with no camera connected");
71 MITK_TEST_CONDITION_REQUIRED(testObject->GetAmplitudes(sourceArray,dataArray),"Testing GetAmplitudes(char*,float*) with no camera connected");
72 MITK_TEST_CONDITION_REQUIRED(testObject->GetIntensities(dataArray),"Testing GetIntensities(float*) with no camera connected");
73 MITK_TEST_CONDITION_REQUIRED(testObject->GetIntensities(sourceArray,dataArray),"Testing GetIntensities(char*,float*) with no camera connected");
74 MITK_TEST_CONDITION_REQUIRED(testObject->GetDistances(dataArray),"Testing GetDistances(float*) with no camera connected");
75 MITK_TEST_CONDITION_REQUIRED(testObject->GetDistances(sourceArray,dataArray),"Testing GetDistances(char*,float*) with no camera connected");
76 MITK_TEST_CONDITION_REQUIRED(testObject->GetSourceData(sourceArray),"Testing GetSourceData(char*) with no camera connected");
77 MITK_TEST_CONDITION_REQUIRED(testObject->GetShortSourceData(shortSource), "Testing GetShortSourceData(short*) with no camera connected");
78 MITK_TEST_CONDITION_REQUIRED(testObject->CloseCameraConnection(),"Testing closing of connection");
79 delete [] dataArray;
80 delete [] sourceArray;
81 delete [] shortSource;
82 }
83 catch(std::exception &e)
84 {
85 MITK_INFO << e.what();
86 }
87 MITK_TEST_END();
88}
The ToFCameraPMDControllerTest class Special class to test the abstract class ToFCameraPMDController.
void TransformCameraOutput(float *in, float *out, bool isDist)
mitkClassMacro(ToFCameraPMDControllerTest, ToFCameraPMDController)
itkFactorylessNewMacro(Self) itkCloneMacro(Self) inline bool OpenCameraConnection()
Virtual interface and base class for all PMD Time-of-Flight devices. Wraps PMD API provided in PMDSDK...
virtual bool OpenCameraConnection()=0
opens a connection to the ToF camera. Has to be implemented by the sub class
int mitkToFCameraPMDControllerTest(int, char *[])
IGT Exceptions.