ITK  4.2.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 <class TValueType, unsigned int NRows = 0, unsigned int NColumns = 0>
62 {
63 public:
69 
71  itkNewMacro(Self);
72 
74  itkTypeMacro(Self,Superclass);
75 
76  // Matrix types
78  typedef vnl_matrix_fixed<TValueType, 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  void PrintSelf(std::ostream &os, Indent indent) const;
118 
119 private:
120  std::string m_FileName;
121  TValueType *m_InputObject;
127 
128  CSVNumericObjectFileWriter(const Self &); //purposely not implemented
129  void operator=(const Self &); //purposely not implemented
130 };
131 
132 } //end namespace itk
133 
134 #ifndef ITK_MANUAL_INSTANTIATION
135 #include "itkCSVNumericObjectFileWriter.hxx"
136 #endif
137 
138 #endif
139