MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkToFCameraPMDPlayerControllerTest.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#include "mitkToFConfig.h"
13#include <mitkTestingMacros.h>
16
17#include "mitkToFPMDConfig.h"
18#include <mitkToFConfig.h>
19
24int mitkToFCameraPMDPlayerControllerTest(int /* argc */, char* /*argv*/[])
25{
26 MITK_TEST_BEGIN("ToFCameraPMDPlayerController");
27
28 //initialize test
29 mitk::ToFCameraPMDPlayerDevice::Pointer pmdPlayerDevice = mitk::ToFCameraPMDPlayerDevice::New();
30 mitk::ToFCameraPMDPlayerController::Pointer pmdPlayerController = mitk::ToFCameraPMDPlayerController::New();
31
32 MITK_TEST_CONDITION_REQUIRED( pmdPlayerController.IsNotNull(),"Testing object initialization!");
33 MITK_TEST_CONDITION_REQUIRED( pmdPlayerController->GetCaptureHeight()== 200,"Testing GetCaptureHeight()");
34 MITK_TEST_CONDITION_REQUIRED( pmdPlayerController->GetCaptureWidth() == 200 ,"Testing GetCaptureWidth()");
35
36 //nice one!
37 MITK_TEST_CONDITION_REQUIRED( !pmdPlayerController->OpenCameraConnection(),"Testing OpenConnection without valid data!");
38
39 // set some valid data and test connecting again!
40 std::string filePath = MITK_TOF_DATA_DIR;
41 std::string fileName = "/TestSequence.pmd";
42 filePath.append(fileName);
43 pmdPlayerDevice->SetStringProperty("PMDFileName", filePath.c_str());
44 pmdPlayerController = dynamic_cast<mitk::ToFCameraPMDPlayerController*>(pmdPlayerDevice->GetController().GetPointer());
45 // current implementation for mitkToFCameraPMDPlayerController only works for 32 bit machines, so we need to check
46 // the platform we are working on!
47 std::string platformVar = MITK_TOF_PLATFORM;
48
49 if( platformVar == "W32")
50 {
51 if(std::string(MITK_TOF_PMDFILE_SOURCE_PLUGIN) != "")
52 {
53 MITK_TEST_CONDITION_REQUIRED( pmdPlayerController->OpenCameraConnection(),"Testing OpenConnection with valid data!");
54 MITK_TEST_CONDITION_REQUIRED( !pmdPlayerController->GetIntegrationTime() == 0, "Testing passing of integration time from PMD data!");
55 MITK_TEST_CONDITION_REQUIRED( !pmdPlayerController->GetModulationFrequency() == 0, "Testing passing of modulation frequency from PMD data!")
56 }
57 // testing disconnection
58 MITK_TEST_CONDITION_REQUIRED ( pmdPlayerController->CloseCameraConnection(), "Testing CloseConnection with data!");
59 }
60 else
61 {
62 MITK_TEST_CONDITION_REQUIRED( true, "Test case skipped! Wrong platfrom configuration, no driver available!");
63 }
64 // test end
65 MITK_TEST_END();
66
67}
Interface to read ToF data from a PMD file.
int mitkToFCameraPMDPlayerControllerTest(int, char *[])