14 #ifndef _itkSpatiallyDenseSparseVectorImage_hxx 15 #define _itkSpatiallyDenseSparseVectorImage_hxx 18 #include "itkProcessObject.h" 23 template<
class TValueType,
unsigned int VImageDimension,
typename TKeyType>
27 m_Container = PixelContainer::New();
28 m_FillBufferValue.SetSize(0);
31 template<
class TValueType,
unsigned int VImageDimension,
typename TKeyType>
38 num = this->GetOffsetTable()[VImageDimension];
40 m_Container->Reserve(num, UseDefaultConstructor);
43 template<
class TValueType,
unsigned int VImageDimension,
typename TKeyType>
54 Superclass::Initialize();
59 m_Container = PixelContainer::New();
62 template<
class TValueType,
unsigned int VImageDimension,
typename TKeyType>
67 m_FillBufferValue = value;
69 const SizeValueType numberOfPixels =
70 this->GetBufferedRegion().GetNumberOfPixels();
72 for (SizeValueType i=0; i<numberOfPixels; i++)
74 (*m_Container)[i].Clear();
78 template<
class TValueType,
unsigned int VImageDimension,
typename TKeyType>
83 if (m_Container != container)
85 m_Container = container;
91 template<
class TValueType,
unsigned int VImageDimension,
typename TKeyType>
97 Superclass::Graft( data );
106 imgData =
dynamic_cast< const Self *
>( data );
117 this->SetPixelContainer( const_cast< PixelContainer *>
123 itkExceptionMacro( <<
"itk::SpatiallyDenseSparseVectorImage::Graft() cannot cast " 124 <<
typeid(data).name() <<
" to " 125 <<
typeid(
const Self *).name() );
130 template<
class TValueType,
unsigned int VImageDimension,
typename TKeyType >
135 return this->m_VectorLength;
138 template<
class TValueType,
unsigned int VImageDimension,
typename TKeyType >
143 this->SetVectorLength( static_cast< VectorLengthType >( n ) );
144 if ( m_FillBufferValue.GetNumberOfElements() == 0 )
146 m_FillBufferValue.SetSize(n);
147 m_FillBufferValue.Fill(0);
151 template<
class TValueType,
unsigned int VImageDimension,
typename TKeyType>
156 Superclass::PrintSelf(os,indent);
157 os << indent <<
"PixelContainer: " << std::endl;
158 m_Container->Print(os, indent.GetNextIndent());
SpatiallyDenseSparseVectorImage()
PixelContainer * GetPixelContainer()
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
ImportImageContainer< SizeValueType, InternalPixelType > PixelContainer
virtual void Initialize() ITK_OVERRIDE
void ComputeOffsetTable(const std::vector< int > &size, std::vector< int > &offsetTable, const int storedWay)
VariableLengthVector< TValueType > PixelType
virtual void Graft(const DataObject *data) ITK_OVERRIDE
virtual void SetNumberOfComponentsPerPixel(unsigned int n) ITK_OVERRIDE
void FillBuffer(const PixelType &value)
void Allocate(bool UseDefaultConstructor=false) ITK_OVERRIDE
void SetPixelContainer(PixelContainer *container)
An n-dimensional vector image with a sparse memory model.
virtual unsigned int GetNumberOfComponentsPerPixel() const ITK_OVERRIDE