18 #ifndef itkMetaArrayReader_h
19 #define itkMetaArrayReader_h
20 #include "ITKIOMetaExport.h"
26 #include "metaArray.h"
47 itkSetStringMacro(FileName);
50 itkGetStringMacro(FileName);
54 MetaArray * GetMetaArrayPointer();
57 void SetBuffer(
void *_buffer);
65 return m_MetaArray.ElementType();
71 return m_MetaArray.Length();
77 return m_MetaArray.Length();
83 return m_MetaArray.Length();
89 return m_MetaArray.Length();
95 return m_MetaArray.Length();
99 template<
typename TValue >
101 unsigned int channel = 0)
const
103 value =
static_cast< TValue
>( m_MetaArray.ElementData(
104 i * m_MetaArray.ElementNumberOfChannels() + channel) );
115 template<
typename TValue >
118 bool _letArrayManageData =
true)
120 if ( m_MetaArray.ElementType() != _metaElementType )
122 m_MetaArray.ConvertElementDataTo(_metaElementType);
124 _array->
SetData( (TValue *)( m_MetaArray.ElementData() ),
125 m_MetaArray.Length(),
126 _letArrayManageData );
127 if ( _letArrayManageData )
129 m_MetaArray.AutoFreeElementData(
false);
135 template<
typename TValue,
unsigned int VLength >
136 bool GetOutput(MET_ValueEnumType itkNotUsed(_metaElementType),
139 if ( static_cast< int >( VLength ) <= m_MetaArray.Length() )
142 for ( i = 0; i < VLength; i++ )
144 this->GetElement( ( *_array )[i], i );
155 template<
typename TValue,
unsigned int VLength >
156 bool GetOutput(MET_ValueEnumType itkNotUsed(_metaElementType),
159 if ( static_cast< int >( VLength ) <= m_MetaArray.Length() )
162 for ( i = 0; i < VLength; i++ )
164 this->GetElement( ( *_vector )[i], i );
176 template<
typename TValue,
unsigned int VLength >
177 bool GetOutput(MET_ValueEnumType itkNotUsed(_metaElementType),
180 if ( static_cast< int >( VLength ) <= m_MetaArray.Length() )
183 for ( i = 0; i < VLength; i++ )
185 this->GetElement( ( *_vector )[i], i );
202 template<
typename TValue >
205 bool _letVectorManageData =
true)
207 if ( m_MetaArray.ElementType() != _metaElementType )
209 m_MetaArray.ConvertElementDataTo(_metaElementType);
211 _vector->
SetData( (TValue *)( m_MetaArray.ElementData() ),
212 m_MetaArray.Length(),
213 _letVectorManageData );
214 if ( _letVectorManageData )
216 m_MetaArray.AutoFreeElementData(
false);
226 template<
typename TValue >
230 if ( m_MetaArray.ElementType() != _metaElementType )
232 m_MetaArray.ConvertElementDataTo(_metaElementType);
234 int rows = m_MetaArray.Length();
235 int cols = m_MetaArray.ElementNumberOfChannels();
237 for (
int i = 0; i < rows; i++ )
239 ( *_array )[i].SetSize(cols);
240 for (
int j = 0; j < cols; j++ )
242 ( *_array )[i][j] =
static_cast< typename TValue::ValueType
>
243 ( m_MetaArray.ElementData(i * cols + j) );
253 virtual
void PrintSelf(std::ostream & os,
Indent indent) const ITK_OVERRIDE;
257 MetaArray m_MetaArray;
259 std::
string m_FileName;
265 #endif // itkMetaArrayReader_h
Array class with size defined at construction time.
Light weight base class for most itk classes.
Simulate a standard C array with copy semnatics.
Represents an array whose length can be defined at run-time.
A templated class holding a n-Dimensional vector.
void SetSize(SizeValueType sz)
void SetData(TValue *data, SizeValueType sz, bool LetArrayManageMemory=false)
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Control indentation during Print() invocation.
void SetData(TValue *data, bool LetArrayManageMemory=false)
A templated class holding a n-Dimensional covariant vector.