ITK  6.0.0
Insight Toolkit
itkCSVNumericObjectFileWriter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
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
31namespace itk
32{
61template <typename TValue, unsigned int VRows = 0, unsigned int VColumns = 0>
62class ITK_TEMPLATE_EXPORT CSVNumericObjectFileWriter : public LightProcessObject
63{
64public:
65 ITK_DISALLOW_COPY_AND_MOVE(CSVNumericObjectFileWriter);
66
72
74 itkNewMacro(Self);
75
77 itkOverrideGetNameOfClassMacro(CSVNumericObjectFileWriter);
78
79 // Matrix types
80 using vnlMatrixType = vnl_matrix<TValue>;
81 using vnlFixedMatrixType = vnl_matrix_fixed<TValue, VRows, VColumns>;
83
84 using StringVectorType = std::vector<std::string>;
85
87
88 /* Specify the name of the output file */
89 itkSetStringMacro(FileName);
90 itkSetMacro(FieldDelimiterCharacter, char);
91
93 void
94 SetInput(const vnlMatrixType * obj);
95
97 void
99
101 void
103
104 void
105 ColumnHeadersPushBack(const std::string &);
106 void
107 RowHeadersPushBack(const std::string &);
108 void
109 SetColumnHeaders(const StringVectorType & columnheaders);
110 void
111 SetRowHeaders(const StringVectorType & rowheaders);
112
113 /* Checks that all essential components are plugged in */
114 void
116
118 virtual void
120
123 virtual void
125
126protected:
128 ~CSVNumericObjectFileWriter() override = default;
129 void
130 PrintSelf(std::ostream & os, Indent indent) const override;
131
132private:
133 std::string m_FileName{};
134 TValue * m_InputObject{};
135 char m_FieldDelimiterCharacter{};
137 SizeValueType m_Columns{};
138 StringVectorType m_ColumnHeaders{};
139 StringVectorType m_RowHeaders{};
140};
141
142} // end namespace itk
143
144#ifndef ITK_MANUAL_INSTANTIATION
145# include "itkCSVNumericObjectFileWriter.hxx"
146#endif
147
148#endif
Writes out numeric itk data objects to a csv file.
~CSVNumericObjectFileWriter() override=default
itk::Size< 2 >::SizeValueType SizeValueType
vnl_matrix_fixed< TValue, VRows, VColumns > vnlFixedMatrixType
void SetInput(const vnlFixedMatrixType *obj)
void PrintSelf(std::ostream &os, Indent indent) const override
void SetInput(const vnlMatrixType *obj)
void SetRowHeaders(const StringVectorType &rowheaders)
void SetColumnHeaders(const StringVectorType &columnheaders)
void SetInput(const itkMatrixType *obj)
void ColumnHeadersPushBack(const std::string &)
void RowHeadersPushBack(const std::string &)
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:53
Base class for most ITK classes.
Definition: itkObject.h:62
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
itk::SizeValueType SizeValueType
Definition: itkSize.h:80