Skip to content

Commit

Permalink
Update according to recent changes on VoxelComplex
Browse files Browse the repository at this point in the history
  • Loading branch information
phcerdan committed Jan 18, 2019
1 parent 92edb09 commit 0e8d8ed
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions volumetric/criticalKernelsThinning3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
// Distance Map
#include "DGtal/kernel/BasicPointPredicates.h"
#include "DGtal/images/SimpleThresholdForegroundPredicate.h"
#include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h"
#include "DGtal/geometry/volumes/distance/VoronoiMap.h"
#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
Expand All @@ -117,8 +115,8 @@ int main(int argc, char* const argv[]){
general_opt.add_options()
( "help,h", "display this message." )
( "input,i", po::value<string>()->required(), "Input vol file." )
( "skel,s", po::value<string>()->required(), "type of skeletonization" )
( "select,c", po::value<string>()->required(), "select method for skeletonization" )
( "skel,s", po::value<string>()->default_value("1isthmus"), "Type of skeletonization. Options: 1isthmus, isthmus, end, ulti." )
( "select,c", po::value<string>()->default_value("dmax"), "select the ordering for skeletonization. Options: dmax, random, first" )
( "foreground,f", po::value<string>()->default_value("black"), "foreground color in binary image" )
( "thresholdMin,m", po::value<int>()->default_value(0), "threshold min (excluded) to define binary shape" )
( "thresholdMax,M", po::value<int>()->default_value(255), "threshold max (included) to define binary shape" )
Expand Down Expand Up @@ -206,25 +204,17 @@ int main(int argc, char* const argv[]){
using DigitalSet =
DGtal::DigitalSetByAssociativeContainer<Domain ,
std::unordered_set< typename Domain::Point> >;
using Object =
DGtal::Object<DigitalTopology, DigitalSet>;
using Complex =
DGtal::VoxelComplex<KSpace, Object>;
using Complex = DGtal::VoxelComplex<KSpace>;

auto & sk = sk_string;
KSpace ks;
KSpace::Point d1( KSpace::Point::diagonal( 1 ) );
ks.init(image.domain().lowerBound() - d1 ,
image.domain().upperBound() + d1 , true);

DigitalTopology::ForegroundAdjacency adjF;
DigitalTopology::BackgroundAdjacency adjB;
DigitalTopology topo(adjF, adjB, DGtal::DigitalTopologyProperties::JORDAN_DT);
Object obj(topo,image_set);

trace.beginBlock("construct with table");
Complex vc(ks);
vc.construct(obj.pointSet(), functions::loadTable(simplicity::tableSimple26_6 ));
vc.construct(image_set, functions::loadTable(simplicity::tableSimple26_6 ));
trace.endBlock();
trace.beginBlock("load isthmus table");
boost::dynamic_bitset<> isthmus_table;
Expand Down Expand Up @@ -253,11 +243,10 @@ int main(int argc, char* const argv[]){
* Calculate distance map even if not requested:
*/
trace.beginBlock("Create Distance Map");
using Predicate = Z3i::DigitalSet;
using L3Metric = ExactPredicateLpSeparableMetric<Z3i::Space, 3>;
using DT = DistanceTransformation<Z3i::Space, Predicate, L3Metric>;
using DT = DistanceTransformation<Z3i::Space, DigitalSet, L3Metric>;
L3Metric l3;
DT dt(obj.domain(),obj.pointSet(), l3);
DT dt(image.domain(), image_set, l3);
trace.endBlock();

std::function< std::pair<typename Complex::Cell, typename Complex::Data>(const Complex::Clique&) > Select ;
Expand Down Expand Up @@ -285,8 +274,10 @@ int main(int argc, char* const argv[]){
auto elapsed = std::chrono::duration_cast<std::chrono::seconds> (end - start) ;
if (profile) std::cout <<"Time elapsed: " << elapsed.count() << std::endl;

const auto & thin_set = vc_new.objectSet();
const auto & all_set = obj.pointSet();

DigitalSet thin_set(image.domain());
vc_new.dumpVoxels(thin_set);
const auto & all_set = image_set;

if (vm.count("exportSDP"))
{
Expand Down

0 comments on commit 0e8d8ed

Please sign in to comment.