26 #include <vtkCamera.h>
32 m_ToFDistanceImageToSurfaceFilter(NULL),
33 m_ToFImageGrabber(NULL),
34 m_CameraIntrinsics(NULL),
49 m_Controls =
new Ui::QmitkToFSurfaceGenerationWidgetControls;
72 return m_ToFDistanceImageToSurfaceFilter;
77 this->
m_Controls->m_TextureGroupBox->setVisible(checked);
78 this->
m_Controls->m_TriangulationThresholdSpinbox->setVisible(checked);
79 this->
m_Controls->m_ReconstructionCombobox->setVisible(checked);
80 this->
m_Controls->m_RepresentationCombobox->setVisible(checked);
82 this->
m_Controls->label_2->setVisible(checked);
83 this->
m_Controls->label_3->setVisible(checked);
90 vtkSmartPointer<vtkCamera> camera,
92 bool showAdvancedOptions)
94 m_ToFDistanceImageToSurfaceFilter = filter;
95 m_ToFImageGrabber = grabber;
96 m_CameraIntrinsics = intrinsics;
100 bool hasSurface =
false;
101 m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty(
"HasSurface", hasSurface);
108 this->m_Surface = this->m_ToFDistanceImageToSurfaceFilter->GetOutput(0);
111 m_SurfaceNode = surface;
112 m_SurfaceNode->SetData(m_Surface);
114 this->FindReconstructionModeProperty();
115 m_Controls->m_ShowAdvancedOptionsCheckbox->setChecked(showAdvancedOptions);
117 m_Controls->m_Compute3DDataCheckbox->setChecked(generateSurface);
124 MITK_ERROR <<
"QmitkToFSurfaceGenerationWidget is not active - please call QmitkToFSurfaceGenerationWidget::Initialize() first";
133 this->m_ToFDistanceImageToSurfaceFilter->SetTriangulationThreshold( this->
m_Controls->m_TriangulationThresholdSpinbox->value() );
134 this->m_ToFImageGrabber->GetCameraDevice()->SetFloatProperty(
"TriangulationThreshold", this->
m_Controls->m_TriangulationThresholdSpinbox->value());
162 MITK_ERROR <<
"ReconstructionModeType does not exist or is not known in QmitkToFSurfaceGenerationWidget.";
166 this->m_ToFDistanceImageToSurfaceFilter->SetReconstructionMode( type );
174 bool generateTriangularMesh =
false;
177 generateTriangularMesh =
true;
179 this->m_ToFDistanceImageToSurfaceFilter->SetGenerateTriangularMesh(generateTriangularMesh);
180 this->m_ToFImageGrabber->GetCameraDevice()->SetBoolProperty(
"GenerateTriangularMesh", generateTriangularMesh);
182 this->m_ToFDistanceImageToSurfaceFilter->SetTriangulationThreshold( this->
m_Controls->m_TriangulationThresholdSpinbox->value() );
183 this->m_ToFImageGrabber->GetCameraDevice()->SetFloatProperty(
"TriangulationThreshold", this->
m_Controls->m_TriangulationThresholdSpinbox->value());
184 this->
m_Controls->m_TriangulationThresholdSpinbox->setEnabled(generateTriangularMesh);
192 if(m_ToFImageGrabber->GetBoolProperty(
"HasRGBImage"))
200 this->m_SurfaceNode->GetPropertyList()->DeleteProperty(
"Surface.Texture");
208 if(m_SurfaceNode.IsNotNull())
210 this->m_SurfaceNode->SetBoolProperty(
"scalar visibility", checked);
219 if (
m_Controls->m_Compute3DDataCheckbox->isChecked())
221 bool hasSurface =
false;
222 this->m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty(
"HasSurface", hasSurface);
226 this->m_Surface->SetVtkPolyData( dynamic_cast< mitk::Surface* >( surfaceProp->GetSmartPointer().GetPointer() )->GetVtkPolyData() );
230 this->m_Surface = m_ToFDistanceImageToSurfaceFilter->GetOutput(0);
234 this->m_Surface->Update();
247 MITK_DEBUG <<
"OnSurfaceCheckboxChecked true";
248 this->m_SurfaceNode->SetData(this->m_Surface);
258 m_Camera3d->SetPosition(0,0,0);
259 m_Camera3d->SetViewUp(0,-1,0);
260 m_Camera3d->SetFocalPoint(0,0,1);
261 if (this->m_CameraIntrinsics.IsNotNull())
268 m_Camera3d->SetViewAngle(45);
270 m_Camera3d->SetClippingRange(1, 10000);
274 void QmitkToFSurfaceGenerationWidget::FindReconstructionModeProperty()
276 bool KinectReconstructionMode =
false;
277 m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty(
"KinectReconstructionMode",KinectReconstructionMode);
278 if(KinectReconstructionMode)
282 m_Controls->m_ReconstructionCombobox->setDisabled(
true);
283 m_Controls->m_ReconstructionCombobox->setCurrentIndex(2);
287 m_Controls->m_ReconstructionCombobox->setEnabled(
true);
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
itk::SmartPointer< Self > Pointer
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()