18 #ifndef itkMetaArrayWriter_h
19 #define itkMetaArrayWriter_h
20 #include "ITKIOMetaExport.h"
26 #include "metaArray.h"
47 itkSetStringMacro(FileName);
48 itkGetStringMacro(FileName);
53 itkSetStringMacro(DataFileName);
54 itkGetStringMacro(DataFileName);
61 itkBooleanMacro(Binary);
62 itkSetMacro(Binary,
bool);
63 itkGetConstMacro(Binary,
bool);
67 template <
typename TValue>
71 m_Buffer = (
const void *)(_array->data_block());
72 m_MetaArray.InitializeEssential(_array->
Size(), _metaElementType);
77 template <
typename TValue,
unsigned int VLength>
82 m_MetaArray.InitializeEssential(VLength, _metaElementType);
87 template <
typename TValue,
unsigned int VLength>
92 m_MetaArray.InitializeEssential(VLength, _metaElementType);
97 template <
typename TValue,
unsigned int VLength>
102 m_MetaArray.InitializeEssential(VLength, _metaElementType);
107 template <
typename TValue>
112 m_MetaArray.InitializeEssential(_vector->
Size(), _metaElementType);
123 template <
typename TValue>
128 int cols = (*_array)[0].GetSize();
131 m_MetaArray.InitializeEssential(rows, _metaElementType, cols,
nullptr,
true,
true);
132 m_Buffer = m_MetaArray.ElementData();
133 for (
int i = 0; i < rows; ++i)
135 for (
int j = 0; j < cols; ++j)
137 m_MetaArray.ElementData(i * cols + j, static_cast<double>((*_array)[i][j]));
143 itkSetMacro(Precision,
unsigned int);
144 itkGetConstMacro(Precision,
unsigned int);
149 ConvertTo(MET_ValueEnumType _metaElementType);
159 PrintSelf(std::ostream & os,
Indent indent)
const override;
162 bool m_Binary{
false };
164 unsigned int m_Precision{ 6 };
166 std::string m_FileName{};
167 std::string m_DataFileName{};
169 MetaArray m_MetaArray{};
171 const void * m_Buffer{
nullptr };
175 #endif // itkMetaArrayWriter_h