X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkCommon.txx;h=5ee83bdca8f4f3efc23ae2aa8dc12ad28a2fe36e;hb=87226f434fbe4cb47dbbef889b8b6e8279efb983;hp=dc7f1653c45d5d9e3538043297ca89408c64b80e;hpb=573d80d0f7a17607d2ee883c21c940c0ba020282;p=clitk.git diff --git a/common/clitkCommon.txx b/common/clitkCommon.txx index dc7f165..5ee83bd 100644 --- a/common/clitkCommon.txx +++ b/common/clitkCommon.txx @@ -195,6 +195,7 @@ std::string GetTypeAsString() } //-------------------------------------------------------------------- + //-------------------------------------------------------------------- template void CloneImage(const typename ImageType::Pointer & input, typename ImageType::Pointer & output) @@ -217,5 +218,22 @@ void CloneImage(const typename ImageType::Pointer & input, typename ImageType::P } //-------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// http://stackoverflow.com/questions/771453/copy-map-values-to-vector-in-stl +template +void MapToVecFirst(const M & m, V & v) { + for( typename M::const_iterator it = m.begin(); it != m.end(); ++it ) { + v.push_back( it->first ); + } +} +template +void MapToVecSecond(const M & m, V & v) { + for( typename M::const_iterator it = m.begin(); it != m.end(); ++it ) { + v.push_back( it->second ); + } +} +//-------------------------------------------------------------------- + #endif /* end #define CLITKCOMMON_TXX */