Skip to content

Commit

Permalink
Merge pull request #32 from kerautret/extConf
Browse files Browse the repository at this point in the history
add extraction of confidence votes
  • Loading branch information
kerautret committed Oct 21, 2023
2 parents ec95ed9 + aa1e285 commit 5a5e7ff
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
16 changes: 10 additions & 6 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# Version 1.2

# Version 1.2
- Add confidence score extraction from origins.
(Bertrand Kerautret [#31](https://github.com/kerautret/CDCVAM/pull/31))
- New tools ExtractAccoOrigins and fix duplicated accumulations values
(Bertrand Kerautret [#30](https://github.com/kerautret/CDCVAM/pull/30))
- Fix comilation issue of displayAccuMesh.
(Bertrand Kerautret [#28](Kerautret https://github.com/kerautret/CDCVAM/pull/28))
(Bertrand Kerautret [#28](https://github.com/kerautret/CDCVAM/pull/28))

- Remove travis and add github actions.
(Bertrand Kerautret [#29](Kerautret https://github.com/kerautret/CDCVAM/pull/29))
(Bertrand Kerautret [#29](https://github.com/kerautret/CDCVAM/pull/29))

# Version 1.1

- Fix cmake issue with boost
(Bertrand [#25](Kerautret https://github.com/kerautret/CDCVAM/pull/25))
(Bertrand [#25](https://github.com/kerautret/CDCVAM/pull/25))
- Replace boost prog option with Cli11
(Bertrand [#24](Kerautret https://github.com/kerautret/CDCVAM/pull/24))
(Bertrand [#24](https://github.com/kerautret/CDCVAM/pull/24))
- Fix compilation issues (missing std::)
(Bertrand [#23](Kerautret https://github.com/kerautret/CDCVAM/pull/23))
(Bertrand [#23](https://github.com/kerautret/CDCVAM/pull/23))


# Version 1.0
Expand Down
12 changes: 8 additions & 4 deletions bin/extractAccOrigins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ int main(int argc, char *const *argv)
string inputFile;
string outputAccOrigins {"exportedAcc.dat"};
unsigned int thAcc {50};
double thConf {0.75};
double radius {5.0};
bool invertNormal {false};

Expand All @@ -59,7 +58,6 @@ int main(int argc, char *const *argv)
app.add_option("--radius,-r", radius, "radius of accumulation analysis.", true);
app.add_flag("--invertNormal", invertNormal, "export the accumulation vectors.");
app.add_option("--maxThAccVectors", thAcc, "threshold the value of accumulations used to decide to export the accumulations vectors (used with outputAccVectors) .", true);
app.add_option("--maxThConfVectors",thConf, "threshold the value of confidence to export the accumulations vectors (used with outputConfVectors) .", true);

app.get_formatter()->column_width(40);
CLI11_PARSE(app, argc, argv);
Expand All @@ -77,17 +75,23 @@ int main(int argc, char *const *argv)
// 3) Generate accumulation image
normAcc.computeAccumulation();
NormalAccumulator::Image3D &imageAccumulation = normAcc.getAccumulationImage();
normAcc.computeConfidence(true, thAcc );

NormalAccumulator::Image3D &imageConfVote = normAcc.getConfidentVoteImage();

if(outputAccOrigins != "")
{
ofstream fout; fout.open(outputAccOrigins.c_str(), ofstream::binary|ofstream::out);
for(const auto &p: imageAccumulation.domain())
fout << "# Accumulation extracted from the extractAccOrigins tools of CDVAM." << std::endl;
fout << "# Format X Y Z AccVal ConfScore FaceId1 FaceId2 ...." << std::endl;

for(const auto &p: imageAccumulation.domain())
{
if(imageAccumulation(p)>thAcc)
{
NormalAccumulator::PointIndexContainer setIndexPt = normAcc.getAssociatedIndexPoints(p);
if(setIndexPt.size()!=0){
fout << p[0] << " " << p[1] << " " << p[2] << " " << imageAccumulation(p) << " " ;
fout << p[0] << " " << p[1] << " " << p[2] << " " << imageAccumulation(p) << " " << imageConfVote(p) << " ";
for(const auto &i: setIndexPt)
{
fout << i << " ";
Expand Down
16 changes: 12 additions & 4 deletions src/NormalAccumulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ NormalAccumulator::initFromMesh(const DGtal::Mesh<Point> &aMesh, bool invertNorm
bb.second + DGtal::Z3i::RealPoint::diagonal(3*myRadius));
myAccumulationImage = NormalAccumulator::Image3D(myDomain);
myConfidenceImage = NormalAccumulator::Image3DDouble(myDomain);
myConfidentVoteImage = NormalAccumulator::Image3D(myDomain);
myRadiusImage = NormalAccumulator::Image3DDouble(myDomain);
myAssociationImage = NormalAccumulator::ImagePointAssociation(myDomain);
if (myIsVerbose)
Expand Down Expand Up @@ -434,10 +435,12 @@ NormalAccumulator::computeConfidence(bool updateVertexAsso, unsigned int minAcc
}

// Step 3: Compute confidance image indicating the rate between accIsMax/acc
for(auto &v: myDomain){
if ( myAccumulationImage(v) > minAcc )
myConfidenceImage.setValue(v, scoreConfidance(v)/(double)myAccumulationImage(v));
}
for(auto &v: myDomain){
if ( myAccumulationImage(v) > minAcc )
myConfidenceImage.setValue(v, scoreConfidance(v)/(double)myAccumulationImage(v));
myConfidentVoteImage.setValue(v, scoreConfidance(v));

}
myIsAssociationCompFromConfidence = updateVertexAsso;
myIsConfidenceComputed = true;
}
Expand Down Expand Up @@ -473,6 +476,11 @@ NormalAccumulator::getAccumulationImage() {
}


NormalAccumulator::Image3D &
NormalAccumulator::getConfidentVoteImage() {
return myConfidentVoteImage;
}

NormalAccumulator::Image3DDouble &
NormalAccumulator::getConfidenceImage(){
return myConfidenceImage;
Expand Down
5 changes: 4 additions & 1 deletion src/NormalAccumulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class NormalAccumulator{
myAccumulationImage(DGtal::Z3i::Domain()),
myConfidenceImage(DGtal::Z3i::Domain()),
myRadiusImage(DGtal::Z3i::Domain()),
myAssociationImage(DGtal::Z3i::Domain())
myAssociationImage(DGtal::Z3i::Domain()),
myConfidentVoteImage(DGtal::Z3i::Domain())


{
Expand Down Expand Up @@ -241,6 +242,7 @@ class NormalAccumulator{

Image3D & getAccumulationImage() ;

Image3D & getConfidentVoteImage() ;

Image3DDouble & getConfidenceImage() ;

Expand Down Expand Up @@ -269,6 +271,7 @@ class NormalAccumulator{


Image3D myAccumulationImage;
Image3D myConfidentVoteImage; // represent the number of ray for which the voxel is maximal
Image3DDouble myConfidenceImage;
Image3DDouble myRadiusImage;
ImagePointAssociation myAssociationImage; // to recover all normal origins contributing to an accumulation point.
Expand Down

0 comments on commit 5a5e7ff

Please sign in to comment.