Merge branch 'develop'

This commit is contained in:
François Merciol 2018-07-10 10:32:37 +02:00
commit de9bcc68f8
15 changed files with 122 additions and 80 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
build build
data/result.tif data/result.tif
tmp
result

View File

@ -37,9 +37,11 @@ add_library(triskele
target_include_directories(triskele target_include_directories(triskele
PUBLIC PUBLIC
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${GDAL_INCLUDE_DIR})
target_link_libraries(triskele ${BOOST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GDAL_LIBRARY} ${TBB_LIBRARIES} ${TinyXML_LIBRARY}) target_link_libraries(triskele ${BOOST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GDAL_LIBRARY} ${TBB_LIBRARIES})
# ${TinyXML_LIBRARY})
target_compile_definitions(triskele PUBLIC -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD) # -DBOOST_DISABLE_ASSERTS) target_compile_definitions(triskele PUBLIC -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD) # -DBOOST_DISABLE_ASSERTS)

View File

@ -21,7 +21,8 @@ PRF_SRC = $(patsubst %, $(CPP_DIR)/%.cpp, $(PRF_PRG))
PRF_OUT = $(patsubst %, $(OUT_DIR)/%, $(PRF_PRG)) PRF_OUT = $(patsubst %, $(OUT_DIR)/%, $(PRF_PRG))
## FLAGS ############################### ## FLAGS ###############################
DFLAGS = -O2 -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD # -DBOOST_DISABLE_ASSERTS DFLAGS = -O2 -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD -DBOOST_DISABLE_ASSERTS
#DFLAGS = -O2 -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD
#DFLAGS = -g -DENABLE_LOG -DNO_OTB # -DTHREAD_DISABLE -DENABLE_SMART_LOG #DFLAGS = -g -DENABLE_LOG -DNO_OTB # -DTHREAD_DISABLE -DENABLE_SMART_LOG
IFLAGS = $(DFLAGS) -MMD -I$(HPP_DIR) -I/usr/include/gdal IFLAGS = $(DFLAGS) -MMD -I$(HPP_DIR) -I/usr/include/gdal
LFLAGS = -L$(LIB_DIR) -ltriskele -lstdc++ -lpthread -lboost_system -lboost_chrono -lboost_thread -lboost_program_options -lboost_date_time -lboost_serialization -lboost_filesystem -lboost_unit_test_framework -lgdal -ltbb LFLAGS = -L$(LIB_DIR) -ltriskele -lstdc++ -lpthread -lboost_system -lboost_chrono -lboost_thread -lboost_program_options -lboost_date_time -lboost_serialization -lboost_filesystem -lboost_unit_test_framework -lgdal -ltbb
@ -57,8 +58,9 @@ clean:
wipe: clean wipe: clean
rm -rf $(OBJ_DIR) rm -rf $(OBJ_DIR)
rm -f $(APG_OUT) $(TST_OUT) $(LIB_DIR)/libtriskele.a rm -f $(APG_OUT) $(TST_OUT) $(PRF_OUT) $(LIB_DIR)/libtriskele.a
rm -f $(OUT_DIR)/*.d rm -f $(OUT_DIR)/*.d
-rmdir $(OUT_DIR) $(OBJ_DIR) $(LIB_DIR) $(BLD_DIR)
libtriskele: $(LIB_DIR)/libtriskele.a libtriskele: $(LIB_DIR)/libtriskele.a

Binary file not shown.

0
data/areaThresholds.txt Executable file → Normal file
View File

0
data/moiThresholds.txt Executable file → Normal file
View File

0
data/sdThresholds.txt Executable file → Normal file
View File

View File

@ -1,4 +1,13 @@
* Git de Triskele * Git de Triskele
Note aux développeurs
** La TODO list
- vérifier min et max
- vérifier coupure
- vérifier alpha-tree
- faire un omega-tree
- vérifier production windows
** Infos concernant le pattern de git de Triskele ** Infos concernant le pattern de git de Triskele
@ -31,6 +40,23 @@ Triskele suit partiellement le [[https://nvie.com/posts/a-successful-git-branchi
- Supprimer une branche sur un dépot local / sur un dépot distant - Supprimer une branche sur un dépot local / sur un dépot distant
# Pour une branche locale # Pour une branche locale
$ git branch -d nomDeBranche $ git branch -d nomDeBranche
<<<<<<< HEAD:GitInfos.org
# Pour la supprimer sur le dépot distant # Pour la supprimer sur le dépot distant
$ git push -d origin nomDeBranche $ git push -d origin nomDeBranche
=======
# Pour une branche distante
$ git push origin --delete nomDeBranch
- Fusionner les modifications
# Il faut synchroniser la branche développement
$ git pull
$ git commit -a
$ git push
# Il faut sélectionner la branche master
$ git checkout master
# Il faut fusionner
$ git merge develop
# Il est possible d'annuler le traitement en cas de conflit
$ git merge --abort
>>>>>>> develop:documentation/GitInfos.org

View File

@ -60,8 +60,8 @@ Border::Border ()
inline inline
Border::Border (const Size &size, bool defaultVal) Border::Border (const Size &size, bool defaultVal)
: pixelsCount (getPixelsCount (size)), : pixelsCount (getPixelsCount (size)),
size (size),
mapLength (getMapLength (pixelsCount)), mapLength (getMapLength (pixelsCount)),
size (size),
map (), map (),
defaultVal (defaultVal) { defaultVal (defaultVal) {
} }
@ -69,10 +69,12 @@ Border::Border (const Size &size, bool defaultVal)
inline inline
Border::Border (const Border &border, const Rect &tile) Border::Border (const Border &border, const Rect &tile)
: size (tile.width, tile.height), : size (tile.width, tile.height),
pixelsCount (getPixelsCount (size)),
mapLength (getMapLength (pixelsCount)),
map (), map (),
defaultVal (border.defaultVal) { defaultVal (border.defaultVal) {
pixelsCount = getPixelsCount (size);
mapLength = getMapLength (pixelsCount);
if (!border.map.size ()) if (!border.map.size ())
return; return;
// XXX todo // XXX todo

View File

@ -44,17 +44,19 @@ namespace otb {
const DimImg &minVal, const DimImg &maxVal) const; const DimImg &minVal, const DimImg &maxVal) const;
}; };
// ========================================
/*! Structure intégrant la façon dont est géré un poids pour un MinTree */ /*! Structure intégrant la façon dont est géré un poids pour un MinTree */
template <typename PixelT, typename WeightT> struct MaxWeight : public WeightBase<PixelT, WeightT> { template <typename PixelT, typename WeightT> struct MinWeight : public WeightBase<PixelT, WeightT> {
typedef WeightBase<PixelT, WeightT> WB; typedef WeightBase<PixelT, WeightT> WB;
inline bool getDecr () const;
static inline bool isWeightInf (const WeightT &a, const WeightT &b); static inline bool isWeightInf (const WeightT &a, const WeightT &b);
static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b); static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b);
static inline void sort (Edge<WeightT> *edges, DimEdge count); static inline void sort (Edge<WeightT> *edges, DimEdge count);
inline MaxWeight(); inline MinWeight ();
inline MaxWeight (const PixelT *pixels, const Size &size); inline MinWeight (const PixelT *pixels, const Size &size);
inline MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size); inline MinWeight (const MinWeight &model, const PixelT *pixels, const Size &size);
inline WeightT getWeight (const DimImg &idx) const; inline WeightT getWeight (const DimImg &idx) const;
inline WeightT getWeight (const Point &a, const Point &b) const; inline WeightT getWeight (const Point &a, const Point &b) const;
@ -62,14 +64,12 @@ namespace otb {
// ======================================== // ========================================
/*! Structure intégrant la façon dont est géré un poids pour un MaxTree */ /*! Structure intégrant la façon dont est géré un poids pour un MaxTree */
template <typename PixelT, typename WeightT> struct MinWeight : public WeightBase<PixelT, WeightT> { template <typename PixelT, typename WeightT> struct MaxWeight : public WeightBase<PixelT, WeightT> {
typedef WeightBase<PixelT, WeightT> WB; typedef WeightBase<PixelT, WeightT> WB;
inline bool getDecr () const; inline MaxWeight();
inline MaxWeight (const PixelT *pixels, const Size &size);
inline MinWeight (); inline MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size);
inline MinWeight (const PixelT *pixels, const Size &size);
inline MinWeight (const MinWeight &model, const PixelT *pixels, const Size &size);
inline WeightT getWeight (const DimImg &idx) const; inline WeightT getWeight (const DimImg &idx) const;
inline WeightT getWeight (const Point &a, const Point &b) const; inline WeightT getWeight (const Point &a, const Point &b) const;

View File

@ -101,60 +101,28 @@ WeightBase<PixelT, WeightT>::weight2valueBound (PixelT *compAPTree, const Weight
// ======================================== // ========================================
template <typename PixelT, typename WeightT> template <typename PixelT, typename WeightT>
inline bool inline bool
MaxWeight<PixelT, WeightT>::isWeightInf (const WeightT &a, const WeightT &b) { MinWeight<PixelT, WeightT>::getDecr () const {
return true;
}
template <typename PixelT, typename WeightT>
inline bool
MinWeight<PixelT, WeightT>::isWeightInf (const WeightT &a, const WeightT &b) {
return a > b; return a > b;
} }
template <typename PixelT, typename WeightT> template <typename PixelT, typename WeightT>
inline bool inline bool
MaxWeight<PixelT, WeightT>::isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b) { MinWeight<PixelT, WeightT>::isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b) {
return isWeightInf (a.weight, b.weight); return isWeightInf (a.weight, b.weight);
} }
template <typename PixelT, typename WeightT> template <typename PixelT, typename WeightT>
inline void inline void
MaxWeight<PixelT, WeightT>::sort (Edge<WeightT> *edges, DimEdge count) { MinWeight<PixelT, WeightT>::sort (Edge<WeightT> *edges, DimEdge count) {
std::sort (edges, edges+count, isEdgeInf); std::sort (edges, edges+count, isEdgeInf);
} }
template <typename PixelT, typename WeightT>
inline
MaxWeight<PixelT, WeightT>::MaxWeight ()
: WB (nullptr, NullSize) {
}
template <typename PixelT, typename WeightT>
inline
MaxWeight<PixelT, WeightT>::MaxWeight (const PixelT *pixels, const Size &size)
: WB (pixels, size) {
}
template <typename PixelT, typename WeightT>
inline
MaxWeight<PixelT, WeightT>::MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size)
: WB (pixels, size) {
}
template <typename PixelT, typename WeightT>
inline WeightT
MaxWeight<PixelT, WeightT>::getWeight (const DimImg &idx) const {
return WB::getValue (idx);
}
template <typename PixelT, typename WeightT>
inline WeightT
MaxWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
return std::max (getWeight (WB::pointIdx (a)),
getWeight (WB::pointIdx (b)));
}
// ========================================
template <typename PixelT, typename WeightT>
inline bool
MinWeight<PixelT, WeightT>::getDecr () const {
return true;
}
template <typename PixelT, typename WeightT> template <typename PixelT, typename WeightT>
inline inline
MinWeight<PixelT, WeightT>::MinWeight () MinWeight<PixelT, WeightT>::MinWeight ()
@ -186,6 +154,38 @@ MinWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
getWeight (WB::pointIdx (b))); getWeight (WB::pointIdx (b)));
} }
// ========================================
template <typename PixelT, typename WeightT>
inline
MaxWeight<PixelT, WeightT>::MaxWeight ()
: WB (nullptr, NullSize) {
}
template <typename PixelT, typename WeightT>
inline
MaxWeight<PixelT, WeightT>::MaxWeight (const PixelT *pixels, const Size &size)
: WB (pixels, size) {
}
template <typename PixelT, typename WeightT>
inline
MaxWeight<PixelT, WeightT>::MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size)
: WB (pixels, size) {
}
template <typename PixelT, typename WeightT>
inline WeightT
MaxWeight<PixelT, WeightT>::getWeight (const DimImg &idx) const {
return WB::getValue (idx);
}
template <typename PixelT, typename WeightT>
inline WeightT
MaxWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
return std::max (getWeight (WB::pointIdx (a)),
getWeight (WB::pointIdx (b)));
}
// ======================================== // ========================================
template <typename PixelT, typename WeightT> template <typename PixelT, typename WeightT>
inline inline

View File

@ -12,9 +12,9 @@ IImage::gdalCount = 0;
IImage::IImage (const string &imageFileName) IImage::IImage (const string &imageFileName)
: fileName (imageFileName), : fileName (imageFileName),
read (false),
gdalInputDataset (nullptr), gdalInputDataset (nullptr),
gdalOutputDataset (nullptr) gdalOutputDataset (nullptr),
read (false)
{ {
} }

View File

@ -40,7 +40,7 @@ perf (const Raster<PixelT> &raster, const GraphWalker &graphWalker, const TreeTy
int int
main (int argc, char **argv, char **envp) { main (int argc, char **argv, char **envp) {
if (argc != 5) { if (argc != 5) {
cerr << "Usage: " << argv[0] << ": treeType coreCount nbTest imageSize" << endl; cerr << "Usage: " << argv[0] << ": {MIN|MAX|TOS|ALPHA} coreCount nbTest imageSize" << endl;
exit (1); exit (1);
} }
string argType (argv[1]); string argType (argv[1]);

View File

@ -7,21 +7,21 @@ using namespace otb::triskele::arrayTree;
using namespace std; using namespace std;
Tree::Tree (const DimSideImg &width, const DimSideImg &height, unsigned int coreCount) Tree::Tree (const DimSideImg &width, const DimSideImg &height, unsigned int coreCount)
: Tree (coreCount) : Tree(coreCount)
{ {
resize (width, height); resize(width, height);
} }
Tree::Tree (unsigned int coreCount) Tree::Tree (unsigned int coreCount)
: size (), : coreCount(coreCount),
coreCount (coreCount), size(),
leafCount (0), leafCount(0),
nodeCount (0), nodeCount(0),
leafParents (), leafParents(),
compParents (nullptr), compParents(nullptr),
children (), childrenStart(),
childrenStart (), children(),
state (State::Void) state(State::Void)
{ {
clear (); clear ();
} }
@ -195,7 +195,7 @@ Tree::checkSpare () const {
maxParent = leafParents[leafId]; maxParent = leafParents[leafId];
}); });
} }
DimImg *childCount = (DimImg*)&childrenStart[2]; // DimImg *childCount = (DimImg*)&childrenStart[2]; // Only used for the assert (so put to comment to prevent warnings)
for (unsigned int i = 0; i < tileCount; ++i) { for (unsigned int i = 0; i < tileCount; ++i) {
DimImg base = vertexMaxBounds [i], maxParent = maxParents [i]; DimImg base = vertexMaxBounds [i], maxParent = maxParents [i];
for (DimImg compId = base; compId < maxParent; ++compId) { for (DimImg compId = base; compId < maxParent; ++compId) {
@ -203,7 +203,8 @@ Tree::checkSpare () const {
BOOST_ASSERT (compParents[compId] != compId); BOOST_ASSERT (compParents[compId] != compId);
BOOST_ASSERT (compParents[compId] < maxParent); BOOST_ASSERT (compParents[compId] < maxParent);
if (compParents[compId] < compId) if (compParents[compId] < compId)
BOOST_ASSERT (childCount[compParents[compId]] > childCount[compId]); BOOST_ASSERT (childrenStart[2 + compParents[compId]] > childrenStart[2 + compId]);
//BOOST_ASSERT (childCount[compParents[compId]] > childCount[compId]); // Edited line to prevent the "Unused variable" warning
} }
BOOST_ASSERT (compParents[maxParent] == DimImg_MAX); BOOST_ASSERT (compParents[maxParent] == DimImg_MAX);
} }
@ -319,10 +320,11 @@ Tree::CPrintTree::print (ostream &out) const {
if (!onRecord) if (!onRecord)
out << printMap (&tree.children[0], doubleSize, nodeCount-1) << endl << endl; out << printMap (&tree.children[0], doubleSize, nodeCount-1) << endl << endl;
if (tree.weightBounds.size ()) { if (tree.weightBounds.size ()) {
out << "weightBounds: " << endl return out << "weightBounds: " << endl
<< printMap (&tree.weightBounds[0], tree.size, tree.weightBounds.size ()) << endl << endl; << printMap (&tree.weightBounds[0], tree.size, tree.weightBounds.size ()) << endl << endl;
} else } else
return out << "no weightBounds" << endl << endl; return out << "no weightBounds" << endl << endl;
} }
Tree::CPrintTree Tree::CPrintTree

6
test/thread_test.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <iostream>
int main(int argc, char** argv) {
return 0;
}