ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkCSVNumericObjectFileWriter.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 itkCSVNumericObjectFileWriter_h
20 #define itkCSVNumericObjectFileWriter_h
21 
22 #include "itkLightProcessObject.h"
23 #include "itkMacro.h"
24 #include "itkArray2D.h"
25 #include "vnl/vnl_matrix.h"
26 #include "vnl/vnl_matrix_fixed.h"
27 #include "itkMatrix.h"
28 #include <vector>
29 #include "itkSize.h"
30 
31 namespace itk
32 {
60 template <typename TValue, unsigned int NRows = 0, unsigned int NColumns = 0>
62 {
63 public:
69 
71  itkNewMacro(Self);
72 
74  itkTypeMacro(Self,Superclass);
75 
76  // Matrix types
77  typedef vnl_matrix<TValue> vnlMatrixType;
78  typedef vnl_matrix_fixed<TValue, NRows, NColumns> vnlFixedMatrixType;
80 
81  typedef std::vector<std::string> StringVectorType;
82 
84 
85  /* Specify the name of the output file */
86  itkSetStringMacro(FileName);
87  itkSetMacro(FieldDelimiterCharacter,char);
88 
90  void SetInput(const vnlMatrixType* obj);
91 
93  void SetInput(const vnlFixedMatrixType* obj);
94 
96  void SetInput(const itkMatrixType* obj);
97 
98  void ColumnHeadersPushBack(const std::string & );
99  void RowHeadersPushBack(const std::string & );
100  void SetColumnHeaders(const StringVectorType & columnheaders);
101  void SetRowHeaders(const StringVectorType & rowheaders);
102 
103  /* Checks that all essential components are plugged in */
104  void PrepareForWriting();
105 
107  virtual void Write();
108 
111  virtual void Update();
112 
113 protected:
114 
117  virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE;
118 
119 private:
120  std::string m_FileName;
121  TValue *m_InputObject;
127 
128  CSVNumericObjectFileWriter(const Self &) ITK_DELETE_FUNCTION;
129  void operator=(const Self &) ITK_DELETE_FUNCTION;
130 };
131 
132 } //end namespace itk
133 
134 #ifndef ITK_MANUAL_INSTANTIATION
135 #include "itkCSVNumericObjectFileWriter.hxx"
136 #endif
137 
138 #endif
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:47
Light weight base class for most itk classes.
itk::SizeValueType SizeValueType
Definition: itkSize.h:60
void SetColumnHeaders(const StringVectorType &columnheaders)
itk::Size< 2 >::SizeValueType SizeValueType
vnl_matrix_fixed< TValue, NRows, NColumns > vnlFixedMatrixType
void SetInput(const vnlMatrixType *obj)
Writes out numeric itk data objects to a csv file.
itk::Matrix< TValue, NRows, NColumns > itkMatrixType
virtual void PrintSelf(std::ostream &os, Indent indent) const override
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:57
void ColumnHeadersPushBack(const std::string &)
void SetRowHeaders(const StringVectorType &rowheaders)
void RowHeadersPushBack(const std::string &)