21 #ifndef otbWaveletsSynopsisImageToWaveletsBandsListFilter_hxx
22 #define otbWaveletsSynopsisImageToWaveletsBandsListFilter_hxx
29 template <
class TImage,
class TImageList>
31 : m_NumberOfLevels(1), m_DecimationRatio(2), m_ExtractFilters(), m_ExtractFiltersUpToDate(false)
36 template <
class TImage,
class TImageList>
39 m_ExtractFilters.clear();
43 template <
class TImage,
class TImageList>
47 Superclass::Modified();
48 m_ExtractFiltersUpToDate =
false;
53 template <
class TImage,
class TImageList>
56 typename OutputImageListType::Pointer outputPtr = this->GetOutput();
57 typename InputImageType::ConstPointer inputPtr = this->GetInput();
61 if (inputPtr && !m_ExtractFiltersUpToDate)
64 typename RegionType::SizeType largestSize = inputPtr->GetLargestPossibleRegion().GetSize();
67 unsigned int numberOfOutputImages = m_NumberOfLevels * 3 + 1;
73 m_ExtractFilters.clear();
76 for (
unsigned int i = 0; i < numberOfOutputImages; ++i)
79 typename ExtractFilterType::Pointer currentExtract = ExtractFilterType::New();
80 currentExtract->SetInput(inputPtr);
83 m_ExtractFilters.push_back(currentExtract);
86 outputPtr->PushBack(currentExtract->GetOutput());
89 RegionType currentRegion;
90 typename RegionType::IndexType currentIndex;
91 typename RegionType::SizeType currentSize;
98 unsigned int currentLevel = (i - 1) / 3;
99 unsigned int currentSubBand = (i - 1) % 3;
101 unsigned int offsetX = largestSize[0] / (
unsigned int)std::pow((
double)m_DecimationRatio, (double)m_NumberOfLevels - currentLevel);
102 unsigned int offsetY = largestSize[1] / (
unsigned int)std::pow((
double)m_DecimationRatio, (double)m_NumberOfLevels - currentLevel);
105 currentSize[0] = offsetX;
106 currentSize[1] = offsetY;
109 if (currentSubBand == 0)
111 currentIndex[0] += offsetX;
113 else if (currentSubBand == 1)
115 currentIndex[1] = offsetY;
119 currentIndex[0] = offsetX;
120 currentIndex[1] = offsetY;
126 currentSize[0] = largestSize[0] / (
unsigned int)std::pow((
double)m_DecimationRatio, (double)m_NumberOfLevels);
127 currentSize[1] = largestSize[1] / (
unsigned int)std::pow((
double)m_DecimationRatio, (double)m_NumberOfLevels);
130 currentRegion.SetIndex(currentIndex);
131 currentRegion.SetSize(currentSize);
133 currentExtract->SetRegionOfInterest(currentRegion);
135 m_ExtractFiltersUpToDate =
true;
139 template <
class TImage,
class TImageList>
142 typename InputImageType::Pointer inputPtr = this->GetInput();
146 inputPtr->SetRequestedRegionToLargestPossibleRegion();
152 template <
class TImage,
class TImageList>
156 for (
typename ExtractFilterVectorType::iterator it = m_ExtractFilters.begin(); it != m_ExtractFilters.end(); ++it)