ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkCSVArray2DDataObject.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef itkCSVArray2DDataObject_h
20 #define itkCSVArray2DDataObject_h
21 
22 #include "itkObjectFactory.h"
23 #include "itkDataObject.h"
24 #include "itkArray2D.h"
25 #include "itkMacro.h"
26 #include <vector>
27 
28 namespace itk
29 {
45 template <typename TData>
47 {
48 public:
49  /* Standard class typedefs */
54 
56  itkNewMacro(Self);
57 
59  itkTypeMacro(Self,Superclass);
60 
61  /* Vector typedefs. */
62  typedef typename std::vector<TData> NumericVectorType;
63  typedef typename std::vector<std::string> StringVectorType;
64 
66  typedef typename itk::Array2D<TData> MatrixType;
67 
69  itkSetMacro(HasColumnHeaders,bool);
70  itkSetMacro(HasRowHeaders,bool);
71  itkBooleanMacro(HasColumnHeaders);
72  itkBooleanMacro(HasRowHeaders);
74 
76  itkGetConstMacro(HasColumnHeaders, bool);
77  itkGetConstMacro(HasRowHeaders, bool);
79 
81  itkGetMacro(Matrix,MatrixType);
82 
85 
88 
90  unsigned int GetRowIndexByName(const std::string &) const;
91 
93  unsigned int GetColumnIndexByName(const std::string &) const;
94 
96  NumericVectorType GetRow(const std::string &) const;
97 
99  NumericVectorType GetRow(const unsigned int & ) const;
100 
102  NumericVectorType GetColumn(const std::string & ) const;
103 
105  NumericVectorType GetColumn(const unsigned int &) const;
106 
109  TData GetData(const std::string &, const std::string &) const;
110 
113  TData GetData(const unsigned int &, const unsigned int &) const;
114 
117  TData GetColumnData(const std::string &, const unsigned int &) const;
118 
121  TData GetRowData(const std::string &, const unsigned int &) const;
122 
125  TData operator()(const std::string &, const std::string &) const;
126 
129  TData operator()(const unsigned int &, const unsigned int &) const;
130 
132  void SetMatrixSize(unsigned int, unsigned int);
133 
135  void FillMatrix(TData value);
136 
139  void SetMatrixData(unsigned int, unsigned int, TData);
140 
142  void RowHeadersPushBack(const std::string &);
143 
145  void ColumnHeadersPushBack(const std::string &);
146 
148  void EraseFirstColumnHeader();
149 
150 protected:
151 
155  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
156 
157 private:
163 
164  CSVArray2DDataObject(const Self &) ITK_DELETE_FUNCTION;
165  void operator=(const Self &) ITK_DELETE_FUNCTION;
166 };
167 
168 } //end namespace itk
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 #include "itkCSVArray2DDataObject.hxx"
172 #endif
173 
174 #endif
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:47
StringVectorType GetColumnHeaders() const
void FillMatrix(TData value)
NumericVectorType GetColumn(const std::string &) const
std::vector< std::string > StringVectorType
Stores parsed data from csv files.
StringVectorType GetRowHeaders() const
void SetMatrixData(unsigned int, unsigned int, TData)
TData GetData(const std::string &, const std::string &) const
SmartPointer< const Self > ConstPointer
void RowHeadersPushBack(const std::string &)
void SetMatrixSize(unsigned int, unsigned int)
unsigned int GetColumnIndexByName(const std::string &) const
void ColumnHeadersPushBack(const std::string &)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TData GetRowData(const std::string &, const unsigned int &) const
std::vector< TData > NumericVectorType
TData operator()(const std::string &, const std::string &) const
itk::Array2D< TData > MatrixType
Base class for most ITK classes.
Definition: itkObject.h:57
virtual void PrintSelf(std::ostream &os, Indent indent) const override
unsigned int GetRowIndexByName(const std::string &) const
Base class for all data objects in ITK.
TData GetColumnData(const std::string &, const unsigned int &) const
NumericVectorType GetRow(const std::string &) const