Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
extraction_informations_forme_3D
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Astrid Beyer
extraction_informations_forme_3D
Commits
5fc21bee
Commit
5fc21bee
authored
1 year ago
by
Astrid Beyer
Browse files
Options
Downloads
Patches
Plain Diff
wip: filter no err
parent
ada8a302
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.cpp
+33
-77
33 additions, 77 deletions
main.cpp
with
33 additions
and
77 deletions
main.cpp
+
33
−
77
View file @
5fc21bee
...
@@ -192,81 +192,56 @@ int main(int argc, char *argv[])
...
@@ -192,81 +192,56 @@ int main(int argc, char *argv[])
*/
*/
/** Another filter **/
/** Another filter **/
double
threshold
=
0.9
;
double
threshold
=
0.9
5
;
vtkSmartPointer
<
vtkPoints
>
filteredPoints
=
vtkSmartPointer
<
vtkPoints
>::
New
();
// Create a vtkThresholdPoints filter for each threshold value
vtkSmartPointer
<
vtkDoubleArray
>
filteredShapeIndex
=
vtkSmartPointer
<
vtkDoubleArray
>::
New
();
vtkNew
<
vtkThresholdPoints
>
threshold1
;
filteredShapeIndex
->
SetName
(
"Filtered_Shape_Index"
);
threshold1
->
SetInputData
(
source
);
threshold1
->
SetInputArrayComponent
(
1
);
for
(
vtkIdType
i
=
0
;
i
<
k2
->
GetNumberOfPoints
();
++
i
)
threshold1
->
ThresholdBetween
(
threshold
,
1
);
{
threshold1
->
Update
();
double
kmax
=
k1Array
->
GetVariantValue
(
i
).
ToDouble
();
// Create a vtkFTRGraph
double
kmin
=
k2Array
->
GetVariantValue
(
i
).
ToDouble
();
vtkNew
<
ttkFTRGraph
>
graph1
;
double
si
=
0.5
-
(
1
/
M_PI
)
*
atan
((
kmax
+
kmin
)
/
(
kmin
-
kmax
));
// Calcul de l'indice de forme
graph1
->
SetInputData
(
threshold1
->
GetOutput
());
graph1
->
SetInputArrayToProcess
(
0
,
0
,
0
,
vtkDataObject
::
FIELD_ASSOCIATION_POINTS
,
"Shape_Index"
);
if
(
si
>
0
&&
si
<
1
)
// Vérifiez si l'indice de forme est différent de 0 et 1
graph1
->
Update
();
{
if
(
si
>=
threshold
)
// Vérifiez si l'indice de forme dépasse le seuil
{
filteredPoints
->
InsertNextPoint
(
source
->
GetPoint
(
i
));
filteredShapeIndex
->
InsertNextValue
(
si
);
}
}
}
// Créez un nouveau maillage à partir des points filtrés
vtkSmartPointer
<
vtkPolyData
>
filteredMesh
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
filteredMesh
->
SetPoints
(
filteredPoints
);
filteredMesh
->
GetPointData
()
->
AddArray
(
filteredShapeIndex
);
for
(
vtkIdType
i
=
0
;
i
<
filteredShapeIndex
->
GetNumberOfTuples
();
++
i
)
{
double
value
=
filteredShapeIndex
->
GetValue
(
i
);
std
::
cout
<<
"Shape_Index["
<<
i
<<
"] = "
<<
value
<<
std
::
endl
;
}
source
->
GetPointData
()
->
AddArray
(
filteredShapeIndex
);
source
->
GetPointData
()
->
SetActiveScalars
(
"Shape_Index"
);
//
vtkNew<ttkFTRGraph> graph;
//
Merge the thresholded datasets together into a single polydata
// graph->SetInputData(filteredMesh)
;
vtkNew
<
vtkAppendPolyData
>
appendFilter
;
// graph->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, "Shape_Index"
);
appendFilter
->
AddInputData
(
threshold1
->
GetOutput
()
);
// graph
->Update();
appendFilter
->
Update
();
// Compute the Reeb Graph of the input dataset
// Compute the Reeb Graph of the input dataset
vtkNew
<
ttkFTRGraph
>
reebGraph
;
vtkNew
<
ttkFTRGraph
>
reebGraph
;
// reebGraph->SetInputData(source);
reebGraph
->
SetInputData
(
appendFilter
->
GetOutput
());
// reebGraph->SetInputData(appendFilter->GetOutput()); // ttkFTRGraph for the merged polydata
// reebGraph->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, "Shape_Index");
reebGraph
->
SetInputData
(
source
);
reebGraph
->
SetInputArrayToProcess
(
0
,
0
,
0
,
vtkDataObject
::
FIELD_ASSOCIATION_POINTS
,
"Shape_Index"
);
reebGraph
->
SetInputArrayToProcess
(
0
,
0
,
0
,
vtkDataObject
::
FIELD_ASSOCIATION_POINTS
,
"Shape_Index"
);
reebGraph
->
Update
();
reebGraph
->
Update
();
// Create Icospheres to represent nodes in the Reeb Graph
// Create Icospheres to represent nodes in the Reeb Graph
vtkNew
<
ttkIcospheresFromPoints
>
ttkIcospheresFromPoints
{};
vtkNew
<
ttkIcospheresFromPoints
>
ttkIcospheresFromPoints
{};
ttkIcospheresFromPoints
->
SetInputData
(
0
,
reebGraph
->
GetOutput
());
ttkIcospheresFromPoints
->
SetInputData
(
0
,
reebGraph
->
GetOutput
());
ttkIcospheresFromPoints
->
SetRadius
(
0.008
);
ttkIcospheresFromPoints
->
SetRadius
(
1
);
ttkIcospheresFromPoints
->
SetNumberOfSubdivisions
(
1
);
ttkIcospheresFromPoints
->
SetNumberOfSubdivisions
(
1
);
ttkIcospheresFromPoints
->
Update
();
ttkIcospheresFromPoints
->
Update
();
//
//
Filters dependencies with Tubes : applies smooth to the geometry of the Reeb Graph
// Filters dependencies with Tubes : applies smooth to the geometry of the Reeb Graph
//
vtkNew<ttkGeometrySmoother> ttkGeometrySmoother{};
vtkNew
<
ttkGeometrySmoother
>
ttkGeometrySmoother
{};
//
ttkGeometrySmoother->SetInputConnection(reebGraph->GetOutputPort(1));
ttkGeometrySmoother
->
SetInputConnection
(
reebGraph
->
GetOutputPort
(
1
));
//
ttkGeometrySmoother->Update();
ttkGeometrySmoother
->
Update
();
//
vtkNew<vtkGeometryFilter> geometryFilter{};
vtkNew
<
vtkGeometryFilter
>
geometryFilter
{};
//
geometryFilter->SetInputConnection(ttkGeometrySmoother->GetOutputPort());
geometryFilter
->
SetInputConnection
(
ttkGeometrySmoother
->
GetOutputPort
());
//
geometryFilter->Update();
geometryFilter
->
Update
();
//
vtkNew<vtkPolyData> polyData{};
vtkNew
<
vtkPolyData
>
polyData
{};
//
polyData->ShallowCopy(geometryFilter->GetOutput());
polyData
->
ShallowCopy
(
geometryFilter
->
GetOutput
());
//
//
Create Tubes to represent edges in the Reeb Graph
// Create Tubes to represent edges in the Reeb Graph
//
vtkNew<vtkTubeFilter> tube{};
vtkNew
<
vtkTubeFilter
>
tube
{};
//
tube->SetInputData(polyData); // smoothed geometry of the Reeb graph
tube
->
SetInputData
(
polyData
);
// smoothed geometry of the Reeb graph
//
tube->SetRadius(0.004);
tube
->
SetRadius
(
0.004
);
//
//
tube->SetNumberOfSides(1);
// tube->SetNumberOfSides(1);
//
tube->Update();
tube
->
Update
();
// Save the graph nodes with IcospheresFromPoints
// Save the graph nodes with IcospheresFromPoints
vtkNew
<
vtkXMLPolyDataWriter
>
writerNodes
{};
vtkNew
<
vtkXMLPolyDataWriter
>
writerNodes
{};
...
@@ -286,24 +261,5 @@ int main(int argc, char *argv[])
...
@@ -286,24 +261,5 @@ int main(int argc, char *argv[])
segWriter
->
SetInputConnection
(
reebGraph
->
GetOutputPort
(
2
));
segWriter
->
SetInputConnection
(
reebGraph
->
GetOutputPort
(
2
));
segWriter
->
Write
();
segWriter
->
Write
();
/*
// Save the graph nodes (simple graph)
vtkNew<vtkXMLUnstructuredGridWriter> sWriter{};
sWriter->SetInputConnection(reebGraph->GetOutputPort(0));
sWriter->SetFileName("outputNodes.vtp");
sWriter->Write();
// Save the graph edges
vtkNew<vtkXMLUnstructuredGridWriter> sepWriter{};
sepWriter->SetInputConnection(reebGraph->GetOutputPort(1));
sepWriter->SetFileName("outputEdges.vtp");
sepWriter->Write();
// Save the graph coloration
vtkNew<vtkXMLPolyDataWriter> segWriter{};
segWriter->SetInputConnection(reebGraph->GetOutputPort(2));
segWriter->SetFileName("outputColor.vtp");
segWriter->Write();*/
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment