22 #include <vtkCamera.h> 27 , m_Controls(nullptr),
28 m_ToFDistanceImageToSurfaceFilter(nullptr),
29 m_ToFImageGrabber(nullptr),
30 m_CameraIntrinsics(nullptr),
45 m_Controls =
new Ui::QmitkToFSurfaceGenerationWidgetControls;
68 return m_ToFDistanceImageToSurfaceFilter;
73 this->
m_Controls->m_TextureGroupBox->setVisible(checked);
74 this->
m_Controls->m_TriangulationThresholdSpinbox->setVisible(checked);
75 this->
m_Controls->m_ReconstructionCombobox->setVisible(checked);
76 this->
m_Controls->m_RepresentationCombobox->setVisible(checked);
78 this->
m_Controls->label_2->setVisible(checked);
79 this->
m_Controls->label_3->setVisible(checked);
84 mitk::CameraIntrinsics::Pointer intrinsics,
86 vtkSmartPointer<vtkCamera> camera,
88 bool showAdvancedOptions)
90 m_ToFDistanceImageToSurfaceFilter = filter;
91 m_ToFImageGrabber = grabber;
92 m_CameraIntrinsics = intrinsics;
96 bool hasSurface =
false;
97 m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty(
"HasSurface", hasSurface);
104 this->m_Surface = this->m_ToFDistanceImageToSurfaceFilter->GetOutput(0);
107 m_SurfaceNode = surface;
108 m_SurfaceNode->SetData(m_Surface);
110 this->FindReconstructionModeProperty();
111 m_Controls->m_ShowAdvancedOptionsCheckbox->setChecked(showAdvancedOptions);
113 m_Controls->m_Compute3DDataCheckbox->setChecked(generateSurface);
120 MITK_ERROR <<
"QmitkToFSurfaceGenerationWidget is not active - please call QmitkToFSurfaceGenerationWidget::Initialize() first";
129 this->m_ToFDistanceImageToSurfaceFilter->SetTriangulationThreshold( this->
m_Controls->m_TriangulationThresholdSpinbox->value() );
130 this->m_ToFImageGrabber->GetCameraDevice()->SetFloatProperty(
"TriangulationThreshold", this->
m_Controls->m_TriangulationThresholdSpinbox->value());
158 MITK_ERROR <<
"ReconstructionModeType does not exist or is not known in QmitkToFSurfaceGenerationWidget.";
162 this->m_ToFDistanceImageToSurfaceFilter->SetReconstructionMode( type );
170 bool generateTriangularMesh =
false;
173 generateTriangularMesh =
true;
175 this->m_ToFDistanceImageToSurfaceFilter->SetGenerateTriangularMesh(generateTriangularMesh);
176 this->m_ToFImageGrabber->GetCameraDevice()->SetBoolProperty(
"GenerateTriangularMesh", generateTriangularMesh);
178 this->m_ToFDistanceImageToSurfaceFilter->SetTriangulationThreshold( this->
m_Controls->m_TriangulationThresholdSpinbox->value() );
179 this->m_ToFImageGrabber->GetCameraDevice()->SetFloatProperty(
"TriangulationThreshold", this->
m_Controls->m_TriangulationThresholdSpinbox->value());
180 this->
m_Controls->m_TriangulationThresholdSpinbox->setEnabled(generateTriangularMesh);
188 if(m_ToFImageGrabber->GetBoolProperty(
"HasRGBImage"))
196 this->m_SurfaceNode->GetPropertyList()->DeleteProperty(
"Surface.Texture");
204 if(m_SurfaceNode.IsNotNull())
206 this->m_SurfaceNode->SetBoolProperty(
"scalar visibility", checked);
215 if (
m_Controls->m_Compute3DDataCheckbox->isChecked())
217 bool hasSurface =
false;
218 this->m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty(
"HasSurface", hasSurface);
222 this->m_Surface->SetVtkPolyData( dynamic_cast< mitk::Surface* >( surfaceProp->GetSmartPointer().GetPointer() )->GetVtkPolyData() );
226 this->m_Surface = m_ToFDistanceImageToSurfaceFilter->GetOutput(0);
230 this->m_Surface->Update();
243 MITK_DEBUG <<
"OnSurfaceCheckboxChecked true";
244 this->m_SurfaceNode->SetData(this->m_Surface);
254 m_Camera3d->SetPosition(0,0,0);
255 m_Camera3d->SetViewUp(0,-1,0);
256 m_Camera3d->SetFocalPoint(0,0,1);
257 if (this->m_CameraIntrinsics.IsNotNull())
264 m_Camera3d->SetViewAngle(45);
266 m_Camera3d->SetClippingRange(1, 10000);
270 void QmitkToFSurfaceGenerationWidget::FindReconstructionModeProperty()
272 bool KinectReconstructionMode =
false;
273 m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty(
"KinectReconstructionMode",KinectReconstructionMode);
274 if(KinectReconstructionMode)
278 m_Controls->m_ReconstructionCombobox->setDisabled(
true);
279 m_Controls->m_ReconstructionCombobox->setCurrentIndex(2);
283 m_Controls->m_ReconstructionCombobox->setEnabled(
true);
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
ReconstructionModeType
The ReconstructionModeType enum: Defines the reconstruction mode, if using no interpixeldistances and...
static ToFScalarType CalculateViewAngle(mitk::CameraIntrinsics::Pointer intrinsics, unsigned int dimX)
Calculates the horizontal view angle of the camera with the given intrinsics.
Property containing a smart-pointer.
static RenderingManager * GetInstance()