From 07059526872c8333fba14cdce809444c02b739f2 Mon Sep 17 00:00:00 2001 From: Kerautret Date: Mon, 14 Mar 2016 11:09:01 +0100 Subject: [PATCH 1/3] fix bug reading option in volCComponentCounter --- ChangeLog.md | 9 ++- volumetric/volCComponentCounter.cpp | 98 ++++++++++++++--------------- 2 files changed, 56 insertions(+), 51 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 81999cdd..83ae275f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,10 +1,15 @@ -# DGtalTools 0.9.2 +# DGtalTools 0.9.2 - *global*: - fix uses of temporaries when ConstAlias is needed. (Roland Denis, [#253](https://github.com/DGtal-team/DGtalTools/pull/253)) -# DGtalTools 0.9.1 +- *volumetric*: + - fix reading options bug in volCComponentCounter. + (Bertrand Kerautret, + [#254](https://github.com/DGtal-team/DGtalTools/pull/254) + +# DGtalTools 0.9.1 - *converters*: - img2freeman: new option to sort the resulting contours by increasing size diff --git a/volumetric/volCComponentCounter.cpp b/volumetric/volCComponentCounter.cpp index e0f604f9..478e3443 100644 --- a/volumetric/volCComponentCounter.cpp +++ b/volumetric/volCComponentCounter.cpp @@ -71,44 +71,44 @@ void CCCounter(Rank& r, Parent& p, const Image& elements, const unsigned int con e !=elements.domain().end(); ++e) { if ( elements.domain().isInside(*e+decx) && - (elements(*e) == elements(*e+decx))) - dsets.union_set(*e,*e+decx); + (elements(*e) == elements(*e+decx))) + dsets.union_set(*e,*e+decx); if ( elements.domain().isInside(*e+decy) && - (elements(*e) == elements(*e+decy))) - dsets.union_set(*e,*e+decy); + (elements(*e) == elements(*e+decy))) + dsets.union_set(*e,*e+decy); if ( elements.domain().isInside(*e+decz) && - (elements(*e) == elements(*e+decz))) - dsets.union_set(*e,*e+decz); + (elements(*e) == elements(*e+decz))) + dsets.union_set(*e,*e+decz); if (connectivity > 6) - { - if ( elements.domain().isInside(*e+decx+decy) && - (elements(*e) == elements(*e+decx+decy))) - dsets.union_set(*e,*e+decx+decy); + { + if ( elements.domain().isInside(*e+decx+decy) && + (elements(*e) == elements(*e+decx+decy))) + dsets.union_set(*e,*e+decx+decy); - if ( elements.domain().isInside(*e+decx+decz) && - (elements(*e) == elements(*e+decx+decz))) - dsets.union_set(*e,*e+decx+decz); + if ( elements.domain().isInside(*e+decx+decz) && + (elements(*e) == elements(*e+decx+decz))) + dsets.union_set(*e,*e+decx+decz); - if ( elements.domain().isInside(*e+decy+decz) && - (elements(*e) == elements(*e+decy+decz))) - dsets.union_set(*e,*e+decy+decz); + if ( elements.domain().isInside(*e+decy+decz) && + (elements(*e) == elements(*e+decy+decz))) + dsets.union_set(*e,*e+decy+decz); - if (connectivity == 26) - if ( elements.domain().isInside(*e+decy+decz+decx) && - (elements(*e) == elements(*e+decy+decz+decx))) - dsets.union_set(*e,*e+decy+decz+decx); + if (connectivity == 26) + if ( elements.domain().isInside(*e+decy+decz+decx) && + (elements(*e) == elements(*e+decy+decz+decx))) + dsets.union_set(*e,*e+decy+decz+decx); - } + } } trace.endBlock(); std::cout << "Number of disjoint "<(); - unsigned int connectivity = vm["connectivity"].as(); + string inputFilename = vm["input"].as(); + unsigned int connectivity = vm["connectivity"].as(); - if ((connectivity != 6) && (connectivity != 18) && (connectivity != 26)) - { - trace.error() << "Bard connectivity value."; - trace.info() << std::endl; - exit(1); - } - - typedef ImageSelector::Type Image; - Image image = VolReader::importVol( inputFilename ); - - trace.info() << "Image loaded: "< rank_t; // => order on Element - typedef std::map parent_t; - rank_t rank_map; - parent_t parent_map; + if ((connectivity != 6) && (connectivity != 18) && (connectivity != 26)) + { + trace.error() << "Bad connectivity value."; + trace.info() << std::endl; + exit(1); + } + + typedef ImageSelector::Type Image; + Image image = VolReader::importVol( inputFilename ); + + trace.info() << "Image loaded: "< rank_t; // => order on Element + typedef std::map parent_t; + rank_t rank_map; + parent_t parent_map; - boost::associative_property_map rank_pmap(rank_map); - boost::associative_property_map parent_pmap(parent_map); + boost::associative_property_map rank_pmap(rank_map); + boost::associative_property_map parent_pmap(parent_map); - CCCounter(rank_pmap, parent_pmap, image, connectivity); + CCCounter(rank_pmap, parent_pmap, image, connectivity); - return 0; + return 0; } From b256a9d20d28399e37f8931decda55f99ffbf6cf Mon Sep 17 00:00:00 2001 From: Kerautret Date: Sat, 19 Mar 2016 23:06:00 +0100 Subject: [PATCH 2/3] fix sdp2vol --- converters/sdp2vol.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/converters/sdp2vol.cpp b/converters/sdp2vol.cpp index 0ff76037..b7f209fb 100644 --- a/converters/sdp2vol.cpp +++ b/converters/sdp2vol.cpp @@ -72,13 +72,13 @@ int main( int argc, char** argv ) if( !parseOK || vm.count("help")) { std::cout << "Usage: " << argv[0] << " [input-file] [output]\n" - << "Convert volumetric file into a digital set of points from a given threshold." + << "Convert digital set of points into a volumic file." << general_opt << "\n"; std::cout << "Example:\n" - << "vol2sdp -i ${DGtal}/examples/samples/lobster.vol -o volumeList.p3d \n"; + << "sdp2vol -i volumePoints.sdp -o volume.vol -d 0 0 0 10 10 10 \n"; return 0; } - if(! vm.count("sdp") ||! vm.count("output") || !vm.count("domain") ) + if(! vm.count("input") ||! vm.count("output") || !vm.count("domain") ) { trace.error() << " Input/ output filename and domain are needed to be defined" << endl; return 0; From 8a405d4eb428e1de5f6c85d3a1cf8c4ee96bd482 Mon Sep 17 00:00:00 2001 From: Kerautret Date: Sat, 19 Mar 2016 23:07:23 +0100 Subject: [PATCH 3/3] changelog --- ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 83ae275f..ceb47a15 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,7 +5,7 @@ (Roland Denis, [#253](https://github.com/DGtal-team/DGtalTools/pull/253)) - *volumetric*: - - fix reading options bug in volCComponentCounter. + - fix reading options bug in volCComponentCounter and sdp2vol. (Bertrand Kerautret, [#254](https://github.com/DGtal-team/DGtalTools/pull/254)