/** * @brief Setup a recorder including a device. Here, we use a player, because in an automatic test * hardware is not useful. */ void setUp() override { m_ToFImageRecorder = mitk::ToFImageRecorder::New(); m_DistanceImageName = mitk::IOUtil::CreateTemporaryFile(); m_AmplitudeImageName = mitk::IOUtil::CreateTemporaryFile(); m_IntensityImageName = mitk::IOUtil::CreateTemporaryFile(); //The recorder would automatically append the default extension ".nrrd" //but we have to append it here, because the data is later loaded with //IOUtil which does not know what kind of data to load/look for. m_DistanceImageName.append("Distance.nrrd"); m_AmplitudeImageName.append("Amplitude.nrrd"); m_IntensityImageName.append("Intensity.nrrd"); m_PlayerDevice = mitk::ToFCameraMITKPlayerDevice::New(); m_ToFImageRecorder->SetCameraDevice(m_PlayerDevice); //the test data set has 20 frames, so we record 20 per default m_ToFImageRecorder->SetNumOfFrames(20); m_ToFImageRecorder->SetRecordMode(mitk::ToFImageRecorder::PerFrames); std::string dirName = MITK_TOF_DATA_DIR; std::string distanceFileName = dirName + "/PMDCamCube2_MF0_IT0_20Images_DistanceImage.pic"; std::string amplitudeFileName = dirName + "/PMDCamCube2_MF0_IT0_20Images_AmplitudeImage.pic"; std::string intensityFileName = dirName + "/PMDCamCube2_MF0_IT0_20Images_IntensityImage.pic"; m_PlayerDevice->SetProperty("DistanceImageFileName",mitk::StringProperty::New(distanceFileName)); m_PlayerDevice->SetProperty("AmplitudeImageFileName",mitk::StringProperty::New(amplitudeFileName)); m_PlayerDevice->SetProperty("IntensityImageFileName",mitk::StringProperty::New(intensityFileName)); //comparing against IOUtil seems fair enough m_GroundTruthDepthImage = dynamic_cast<mitk::Image*>(mitk::IOUtil::Load(distanceFileName)[0].GetPointer()); m_GroundTruthAmplitudeImage = dynamic_cast<mitk::Image*>(mitk::IOUtil::Load(amplitudeFileName)[0].GetPointer()); m_GroundTruthIntensityImage = dynamic_cast<mitk::Image*>(mitk::IOUtil::Load(intensityFileName)[0].GetPointer()); m_PlayerDevice->ConnectCamera(); m_PlayerDevice->StartCamera(); }