DGtal-team / DGtal

Digital Geometry Tools and Algorithm Library
https://dgtal.org
GNU Lesser General Public License v3.0
369 stars 113 forks source link

Assert fails in FMM with second order L2 distance #1152

Open kerautret opened 8 years ago

kerautret commented 8 years ago

The following configuration produce an error in FMM computation (L2SecondOrderLocalDistance) while it works with L2FirstOrderLocalDistance, as discussed with @troussil it appears when no solution are given.

#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
#include "DGtal/kernel/sets/DigitalSetBySTLSet.h"
#include "DGtal/geometry/volumes/distance/FMM.h"

using namespace DGtal;
using namespace Z3i;
typedef ImageContainerBySTLVector<Z3i::Domain,double> DistanceImage;
typedef DigitalSetBySTLSet<Z3i::Domain> AcceptedPointSet;
typedef Z3i::Domain::Predicate DomainPredicate;
typedef L2SecondOrderLocalDistance<DistanceImage, AcceptedPointSet> DistanceMeasure;
typedef FMM<DistanceImage, AcceptedPointSet, DomainPredicate, DistanceMeasure> TFMM;

int main( int argc, char** argv )
{
  std::vector<Z3i::Point> vectP;
  vectP.push_back(Point(575, 425, 349));
  vectP.push_back(Point(576, 425, 349));
  vectP.push_back(Point(576, 426, 349));

  Domain domain (Point(500, 300, 200), Point(600, 500, 400));
  DistanceImage distanceImage( domain);
  AcceptedPointSet setAccepted( domain );
  TFMM::initFromPointsRange(vectP.begin(), vectP.end(), distanceImage, setAccepted, 0);
  TFMM fmm( distanceImage, setAccepted, domain.predicate(), 30000, 4 );
  fmm.compute();
  return 0;
}
dcoeurjo commented 6 years ago

ping @troussil