21 #ifndef __otbVectorImageToMatrixFilter_txx
22 #define __otbVectorImageToMatrixFilter_txx
27 #include "itkNumericTraits.h"
34 template<
class TInputImage>
46 template<
class TInputImage>
57 return static_cast<itk::DataObject*
>(MatrixObjectType::New().GetPointer());
66 template<
class TInputImage>
74 template<
class TInputImage>
82 template<
class TInputImage>
87 Superclass::GenerateOutputInformation();
90 this->GetOutput()->CopyInformation(this->GetInput());
91 this->GetOutput()->SetLargestPossibleRegion(this->GetInput()->GetLargestPossibleRegion());
93 if (this->GetOutput()->GetRequestedRegion().GetNumberOfPixels() == 0)
95 this->GetOutput()->SetRequestedRegion(this->GetOutput()->GetLargestPossibleRegion());
100 template<
class TInputImage>
112 template<
class TInputImage>
117 TInputImage * inputPtr =
const_cast<TInputImage *
>(this->GetInput());
118 inputPtr->UpdateOutputInformation();
120 this->GetMatrixOutput()->Get().set_size(
121 inputPtr->GetNumberOfComponentsPerPixel(),
122 inputPtr->GetLargestPossibleRegion().GetNumberOfPixels());
125 template<
class TInputImage>
132 template<
class TInputImage>
142 const unsigned int width = this->GetInput()->GetLargestPossibleRegion().GetSize()[0];
149 unsigned int col = idx[0] + idx[1] * width;
151 MatrixType& m = this->GetMatrixOutput()->Get();
152 for (
unsigned int r = 0; r < vectorValue.Size(); ++r)
154 m(r, col) = vectorValue[r];
159 template <
class TImage>
164 Superclass::PrintSelf(os, indent);