//--------------------------------------------------------------------
void PrintMemoryUsed();
+ //--------------------------------------------------------------------
+ // Convert a map to a vector
+ template <typename M, typename V>
+ void MapToVecFirst(const M & m, V & v);
+ template <typename M, typename V>
+ void MapToVecSecond(const M & m, V & v);
+
#include "clitkCommon.txx"
} // end namespace
}
//--------------------------------------------------------------------
+
//--------------------------------------------------------------------
template<class ImageType>
void CloneImage(const typename ImageType::Pointer & input, typename ImageType::Pointer & output)
}
//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+// http://stackoverflow.com/questions/771453/copy-map-values-to-vector-in-stl
+template <typename M, typename V>
+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 <typename M, typename V>
+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 */