aimsdata  5.1.2
Neuroimaging data handling
stl_conversion.h
Go to the documentation of this file.
1 
2 #ifndef AIMS_UTILITY_STL_CONVERSION
3 #define AIMS_UTILITY_STL_CONVERSION
4 
5 #include <map>
6 
7 namespace aims
8 {
9 
12  template <typename Vector, typename IndexType>
13  inline void toMap(
14  const Vector & vector,
15  std::map<IndexType, typename Vector::value_type> & map,
16  const typename Vector::value_type & background = Vector::value_type( 0 ) )
17  {
18  typename Vector::const_iterator iv, ev = vector.end();
19  IndexType n = 0;
20  for( iv=vector.begin(); iv!=ev; ++iv, ++n )
21  if( *iv != background )
22  map[ n ] = *iv;
23  }
24 
25 }
26 
27 #endif
28 
29 
The class for EcatSino data write operation.
Definition: borderfiller.h:13
void toMap(const Vector &vector, std::map< IndexType, typename Vector::value_type > &map, const typename Vector::value_type &background=Vector::value_type(0))
convert a vector or list into a sparse toMap