28 #include <QFileDialog> 47 m_decomposition(decomposition),
48 m_pc(pc), m_parent(parent),
49 m_treeWidget(treeWidget),
50 m_renderWindow(window)
54 m_dialog =
new ReconstructViaExtendedMarchingCubesDialog;
58 dialog->setWindowTitle(
"Extended Marching Cubes");
64 dialog->activateWindow();
81 QCheckBox* ransac_box =
m_dialog->checkBox_RANSAC;
84 ransac_box->setChecked(
false);
85 ransac_box->setCheckable(
false);
89 ransac_box->setCheckable(
true);
95 QComboBox* gs_box =
m_dialog->comboBox_gs;
97 QLabel* label =
m_dialog->label_below_gs;
98 QDoubleSpinBox* spinBox =
m_dialog->spinBox_below_gs;
103 label->setText(
"Voxel size");
104 spinBox->setMinimum(0);
105 spinBox->setMaximum(2000000);
106 spinBox->setSingleStep(1);
107 spinBox->setValue(10);
111 label->setText(
"Number of intersections");
112 spinBox->setMinimum(1);
113 spinBox->setMaximum(200000);
114 spinBox->setSingleStep(1);
115 spinBox->setValue(10);
123 QComboBox* pcm_box =
m_dialog->comboBox_pcm;
124 string pcm = pcm_box->currentText().toStdString();
125 QCheckBox* extrusion_box =
m_dialog->checkBox_Extrusion;
126 bool extrusion = extrusion_box->isChecked();
127 QCheckBox* ransac_box =
m_dialog->checkBox_RANSAC;
128 bool ransac = ransac_box->isChecked();
129 QSpinBox* kn_box =
m_dialog->spinBox_kn;
130 int kn = kn_box->value();
131 QSpinBox* kd_box =
m_dialog->spinBox_kd;
132 int kd = kd_box->value();
133 QSpinBox* ki_box =
m_dialog->spinBox_ki;
134 int ki = ki_box->value();
135 QCheckBox* reNormals_box =
m_dialog->checkBox_renormals;
136 bool reestimateNormals = reNormals_box->isChecked();
137 QComboBox* gridMode_box =
m_dialog->comboBox_gs;
138 bool useVoxelsize = (gridMode_box->currentIndex() == 0) ?
true :
false;
139 QDoubleSpinBox* gridSize_box =
m_dialog->spinBox_below_gs;
140 float resolution = (float)gridSize_box->value();
142 float sf =
m_dialog->doubleSpinBox_sf->value();
143 float sc =
m_dialog->doubleSpinBox_sc->value();
150 if(pcm ==
"STANN" || pcm ==
"FLANN" || pcm ==
"NABO" || pcm ==
"NANOFLANN")
155 if(!surface->pointBuffer()->hasNormals() || reestimateNormals)
157 surface->calculateSurfaceNormals();
164 auto grid = std::make_shared<PointsetGrid<Vec, SharpBox<Vec>>>(
167 surface->getBoundingBox(),
172 grid->calcDistanceValues();
173 auto reconstruction = make_unique<FastReconstruction<Vec, SharpBox<Vec>>>(grid);
177 reconstruction->getMesh(mesh);
200 vtkSmartPointer<vtkRenderer> renderer =
m_renderWindow->GetRenderers()->GetFirstRenderer();
201 bridge->addActors(renderer);
LVRReconstructViaExtendedMarchingCubesDialog(string decomposition, LVRPointCloudItem *pc, LVRModelItem *parent, QTreeWidget *treeWidget, vtkRenderWindow *renderer)
void setClusterColors(const ClusterMap< Rgb8Color > &colors)
void connectSignalsAndSlots()
void deleteSmallPlanarCluster(BaseMesh< BaseVecT > &mesh, ClusterBiMap< FaceHandle > &clusters, size_t smallClusterThreshold)
Removes all clusters and their cotained faces from the given mesh which are smaller than the given sm...
std::shared_ptr< MeshBuffer > MeshBufferPtr
Algorithm which generates the same color for all vertices, which are in the same cluster.
DenseVertexMap< Normal< typename BaseVecT::CoordType > > calcVertexNormals(const BaseMesh< BaseVecT > &mesh, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, const PointsetSurface< BaseVecT > &surface)
Calculates a normal for each vertex in the mesh.
PointBufferPtr getPointBuffer()
void switchGridSizeDetermination(int index)
DenseFaceMap< Normal< typename BaseVecT::CoordType > > calcFaceNormals(const BaseMesh< BaseVecT > &mesh)
Calculates a normal for each face in the mesh.
QTreeWidget * m_treeWidget
ReconstructViaExtendedMarchingCubesDialog * m_dialog
Class for calculating materials for each cluster of a given mesh.
void setVertexNormals(const VertexMap< Normal< typename BaseVecT::CoordType >> &normals)
std::shared_ptr< PointBuffer > PointBufferPtr
Main class for conversion of LVR model instances to vtk actors. This class parses the internal model ...
A map of clusters, which also saves a back-reference from handle to cluster.
DenseClusterMap< Rgb8Color > simpsons(const BaseMesh< BaseVecT > &mesh) const
Assign a pseudo-color to each cluster.
Used for extended marching cubes Reconstruction.
boost::shared_ptr< LVRModelBridge > ModelBridgePtr
virtual ~LVRReconstructViaExtendedMarchingCubesDialog()
void setMaterializerResult(const MaterializerResult< BaseVecT > &materializerResult)
MaterializerResult< BaseVecT > generateMaterials()
Generates materials.
vtkRenderWindow * m_renderWindow
Half-edge data structure implementing the BaseMesh interface.
A point cloud manager class that uses the STANN nearest neighbor search library to handle the data...
void toggleRANSACcheckBox(const QString &text)
std::shared_ptr< Model > ModelPtr
ClusterBiMap< FaceHandle > planarClusterGrowing(const BaseMesh< BaseVecT > &mesh, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, float minSinAngle)
Algorithm which generates plane clusters from the given mesh.
MeshBufferPtr apply(const BaseMesh< BaseVecT > &mesh)
Result struct for the materializer.
std::shared_ptr< PointsetSurface< BaseVecT > > PointsetSurfacePtr
A map with constant lookup overhead using small-ish integer-keys.
LVRModelItem * m_generatedModel