X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FcreaImageIOGimmick.cpp;h=fcc38e076481bec00e4ecc3bc0f9144c49543e5c;hb=bf3660569b1baa8be10fc708f595efc66afe3334;hp=5edb4edf78c10bea8be01ef81b41de915b8ab733;hpb=effdfb42412ad29eb0e9bc5619b2264bb2e282ef;p=creaImageIO.git diff --git a/src/creaImageIOGimmick.cpp b/src/creaImageIOGimmick.cpp index 5edb4ed..fcc38e0 100644 --- a/src/creaImageIOGimmick.cpp +++ b/src/creaImageIOGimmick.cpp @@ -1,9 +1,9 @@ #include - #include #include #include + //#include "io.h" #ifndef PATH_MAX // If not defined yet : do it # define PATH_MAX 2048 @@ -424,6 +424,34 @@ path+= mLocalDescpName; } //======================================================================== + //======================================================================== + // get attributes values from database for a given file from database + //======================================================================== + void Gimmick::GetAttributes(const std::string filename, std::map &i_res, OutputAttr i_attr) + { + if (i_attr.inside.size() > 0) + { + std::map map_attr; + TreeHandler * handler=GetTreeHandler(i_attr.db); + handler->getAllAttributes(filename, map_attr); + if(i_attr.inside.front() == "ALL") // we take all values + { + std::map::iterator it = map_attr.begin(); + for(; it != map_attr.end(); it++) + i_res[it->first] = it->second; + } + else + { + std::vector::iterator it = i_attr.inside.begin(); + for(; it != i_attr.inside.end(); it++) + i_res[(*it)] = map_attr[(*it)]; + } + } + + + } + + //======================================================================== void Gimmick::UpdateSetting(const std::string& name, const std::string& value) @@ -488,4 +516,29 @@ path+= mLocalDescpName; addDB(name, it_path->c_str()); } } + + +/////////////////////////////////////////////////////////////////////////////// +// Fill attributes structure with attributes present in database (inside vector +// and not present (outside) +/////////////////////////////////////////////////////////////////////////////// +void Gimmick::fillVectInfos(std::vector i_attr, OutputAttr &infos) +{ + //test if a tag is present in Database descriptor + TreeHandler * handler=GetTreeHandler(infos.db); + mImageAdder.SetTreeHandler(handler); + std::vector::const_iterator it = i_attr.begin(); + for (;it != i_attr.end(); it++) + { + if( mImageAdder.isAttributeExist((*it)) != "" ) // in DB + { + infos.inside.push_back((*it)); + } + else + { + infos.outside.push_back((*it)); // Need to scan again the files + } + } } + +} \ No newline at end of file