Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph viewer scale rad #74

Merged
merged 6 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
no more usefull since DGtal PR [175](https://github.com/DGtal-team/DGtal/pull/1715)
(Bertrand Kerautret [#79](https://github.com/DGtal-team/DGtalTools-contrib/pull/79))



- *global*
- Continuous integration on windows does not use Appveyopr anymore but Github Actions.
(Bertrand Kerautret [#77](https://github.com/DGtal-team/DGtalTools-contrib/pull/77))
Expand All @@ -16,10 +14,21 @@
consistant. (Bertrand Kerautret [#70](https://github.com/DGtal-team/DGtalTools-contrib/pull/70))
- basicEditMesh: improvement of mesh read using generic reader/writer.
(Bertrand Kerautret [#72](https://github.com/DGtal-team/DGtalTools-contrib/pull/72))

- *visualisation*
- graphViewer: new options to apply a scale factors on the radius input values
and to display constant tube section. (Bertrand Kerautret [#74](https://github.com/DGtal-team/DGtalTools-contrib/pull/74))

# DGtalTools-contrib 1.3

- meshBasicEdit: new name of basicEditMesh and addition of a new
option to rescale a shape according to its bounding box and a new size.
(Bertrand Kerautret [#73](https://github.com/DGtal-team/DGtalTools-contrib/pull/73))

- *global*
- Continuous integration does not use Travis anymore but Github Actions.
(Bertrand Kerautret [#58](https://github.com/DGtal-team/DGtalTools-contrib/pull/58))

- *Geometry3d*
- basicMorphoFilter: fix a bug on the dilate/erode options.
(Bertrand Kerautret [#74](https://github.com/DGtal-team/DGtalTools-contrib/pull/74))
Expand All @@ -38,13 +47,6 @@
- polyMeshEdit: fix preformance issue in display loop.
(Bertrand Kerautret [#84](https://github.com/DGtal-team/DGtalTools-contrib/pull/84))


# DGtalTools-contrib 1.3

- *global*
- Continuous integration does not use Travis anymore but Github Actions.
(Bertrand Kerautret [#58](https://github.com/DGtal-team/DGtalTools-contrib/pull/58))

- *Geometry3d*
- volFillCCSize: new tool to fill each Connected Component with a value corresponding to the number of voxels of the CC.
(Bertrand Kerauret [60](https://github.com/DGtal-team/DGtalTools-contrib/pull/60)
Expand Down
36 changes: 31 additions & 5 deletions visualisation/graphViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ Usage: ./graphViewer [OPTIONS]
-v,--inputVertex TEXT:FILE REQUIRED input file containing the vertex list.
-e,--inputEdge TEXT:FILE REQUIRED input file containing the edge list.
-a,--autoEdge generate edge list from vertex order.
--cstSectionEdgeRad use a constant edge radius between two consecutive vertices.
-r,--inputRadii TEXT input file containing the radius for each vertex.
-b,--ballRadius FLOAT=1 radius of vertex balls.
-m,--addMesh TEXT add mesh in the display.
--meshColor UINT ... specify the color of mesh.
--vertexColor UINT ... specify the color of vertex.
-s,--scaleRadius FLOAT=1 apply a scale factors on the radius input values
--edgeColor UINT ... specify the color of edges.
-c,--colormap display vertex colored by order in vertex file or by radius scale if the radius file is specidfied (-r).
-d,--doSnapShotAndExit TEXT save display snapshot into file. Notes that the camera setting is set by default according the last saved configuration (use SHIFT+Key_M to save current camera setting in the Viewer3D). If the camera setting was not saved it will use the default camera setting.
Expand Down Expand Up @@ -92,8 +94,10 @@ int main( int argc, char** argv )
std::string nameFileVertex;
std::string nameFileEdge;
double r {1.0};
double scaleRadius {1.0};
bool useRadiiFile {false};
bool autoEdgeOpt {false};
bool cstSectionEdgeRad {false};
std::vector<unsigned int> vectColMesh;
std::vector<unsigned int> vectColVertex;
std::vector<unsigned int> vectColEdge;
Expand All @@ -104,11 +108,13 @@ int main( int argc, char** argv )
app.add_option("--inputVertex,-v", nameFileVertex, "input file containing the vertex list.")->required()->check(CLI::ExistingFile);
app.add_option("--inputEdge,-e", nameFileEdge, "input file containing the edge list.")->required()->check(CLI::ExistingFile);
app.add_flag("--autoEdge,-a", autoEdgeOpt, "generate edge list from vertex order.");
app.add_flag("--cstSectionEdgeRad",cstSectionEdgeRad, "use a constant edge radius between two consecutive vertices.");
auto inputRadiiOpt = app.add_option("--inputRadii,-r", nameFileRadii, "input file containing the radius for each vertex.");
app.add_option("--ballRadius,-b", r, "radius of vertex balls.", true);
auto addMeshOpt = app.add_option("--addMesh,-m", meshName, "add mesh in the display.");
auto meshColorOpt = app.add_option("--meshColor", vectColMesh, "specify the color of mesh.");
auto vertexColorOpt = app.add_option("--vertexColor", vectColVertex, "specify the color of vertex.");
app.add_option("--scaleRadius,-s", scaleRadius, "apply a scale factors on the radius input values", true);
auto edgeColorOpt = app.add_option("--edgeColor", vectColEdge, "specify the color of edges.");
auto colormapOpt = app.add_flag("--colormap, -c","display vertex colored by order in vertex file or by radius scale if the radius file is specidfied (-r).");
auto doSnapShotAndExitOpt = app.add_option("--doSnapShotAndExit,-d", name, "save display snapshot into file. Notes that the camera setting is set by default according the last saved configuration (use SHIFT+Key_M to save current camera setting in the Viewer3D). If the camera setting was not saved it will use the default camera setting.");
Expand Down Expand Up @@ -180,7 +186,15 @@ int main( int argc, char** argv )
<< vectRadii.size() << ")." << std::endl;
return 1;
}
hueShade = HueShadeColorMap<int>((*(std::min_element(vectRadii.begin(),vectRadii.end())))*10000,(*(std::max_element(vectRadii.begin(),vectRadii.end())))*10000);
hueShade = HueShadeColorMap<int>((*(std::min_element(vectRadii.begin(),
vectRadii.end())))*10000,
(*(std::max_element(vectRadii.begin(),
vectRadii.end())))*10000);
if (scaleRadius != 1.0){
for(auto &v: vectRadii){
v *= scaleRadius;
}
}
}


Expand Down Expand Up @@ -219,9 +233,16 @@ int main( int argc, char** argv )
{
Mesh<Z3i::RealPoint> aMesh;
vertex = { vectVertex[e[0]], vectVertex[e[1]] };
radii = { vectRadii[e[0]], vectRadii[e[1]] };
if (cstSectionEdgeRad) {
radii = { std::min(vectRadii[e[0]], vectRadii[e[1]]), std::min(vectRadii[e[0]], vectRadii[e[1]]) };
}
else {
radii = { vectRadii[e[0]], vectRadii[e[1]] };
}
Mesh<Z3i::RealPoint>::createTubularMesh(aMesh, vertex, radii, 0.05);
viewer << (useRadiiFile ? CustomColors3D( hueShade(radii[0]*10000), hueShade(radii[1]*10000) ) : CustomColors3D( hueShade(e[0]), hueShade(e[1]) ));
viewer << (useRadiiFile ? CustomColors3D( hueShade(radii[0]*10000),
hueShade(radii[1]*10000) ) : CustomColors3D( hueShade(e[0]),
hueShade(e[1]) ));
viewer << aMesh;
}
}
Expand All @@ -231,7 +252,12 @@ int main( int argc, char** argv )
for ( const auto& e: vectEdges )
{
vertex = { vectVertex[e[0]], vectVertex[e[1]] };
radii = { vectRadii[e[0]], vectRadii[e[1]] };
if (cstSectionEdgeRad) {
radii = { std::min(vectRadii[e[0]], vectRadii[e[1]]), std::min(vectRadii[e[0]], vectRadii[e[1]]) };
}
else {
radii = { vectRadii[e[0]], vectRadii[e[1]] };
}
Mesh<Z3i::RealPoint>::createTubularMesh(aMesh, vertex, radii, 0.05);
}
viewer << CustomColors3D(DGtal::Color::Black, edgeColor);
Expand All @@ -249,7 +275,7 @@ int main( int argc, char** argv )

viewer << Viewer3D<>::updateDisplay;

if(doSnapShotAndExitOpt->count() > 0){
if(doSnapShotAndExitOpt->count() > 0){
// Appy cleaning just save the last snap
DGtal::trace.info() << "sorting surfel according camera position....";
viewer.sortSurfelFromCamera();
Expand Down
Loading