Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkStringsToNumbers.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkVectorPropertySerializer_h
18 #define mitkVectorPropertySerializer_h
19 
20 #include <boost/lexical_cast.hpp>
21 
22 namespace mitk
23 {
51  template <typename NUMBER_TYPE, typename STRING_ARRAY, typename DOUBLE_ARRAY>
52  void StringsToNumbers(unsigned int count, const STRING_ARRAY &strings, DOUBLE_ARRAY &numbers)
53  {
54  for (unsigned int i = 0; i < count; ++i)
55  {
56  numbers[i] = boost::lexical_cast<NUMBER_TYPE>(strings[i]);
57  }
58  }
59 }
60 
61 #endif
DataCollection - Class to facilitate loading/accessing structured data.
void StringsToNumbers(unsigned int count, const STRING_ARRAY &strings, DOUBLE_ARRAY &numbers)