Commit 5586c569 authored by Julien Michel's avatar Julien Michel

ENH: Handle output size

parent 6a49f5df
...@@ -91,19 +91,12 @@ template <typename ...T> auto GetNumberOfComponentsPerInput(std::tuple<T...> & t ...@@ -91,19 +91,12 @@ template <typename ...T> auto GetNumberOfComponentsPerInput(std::tuple<T...> & t
return GetNumberOfComponentsPerInputImpl(t, std::make_index_sequence<sizeof...(T)>{}); return GetNumberOfComponentsPerInputImpl(t, std::make_index_sequence<sizeof...(T)>{});
} }
template <class T> auto MakeIterator(itk::SmartPointer<T> img, const itk::ImageRegion<2> & region) template <class T> auto MakeIterator(const T * img, const itk::ImageRegion<2> & region)
{ {
itk::ImageRegionConstIterator<T> it(img,region); itk::ImageRegionConstIterator<T> it(img,region);
return it; return it;
} }
template <class T> auto MakeIterator(itk::SmartPointer<const T> img, const itk::ImageRegion<2> & region)
{
itk::ImageRegionConstIterator<T> it(img,region);
return it;
}
template <class Tuple, size_t...Is> auto MakeIteratorsImpl(const Tuple& t, const itk::ImageRegion<2> & region, std::index_sequence<Is...>) template <class Tuple, size_t...Is> auto MakeIteratorsImpl(const Tuple& t, const itk::ImageRegion<2> & region, std::index_sequence<Is...>)
{ {
return std::make_tuple(MakeIterator(std::get<Is>(t),region)...); return std::make_tuple(MakeIterator(std::get<Is>(t),region)...);
......
...@@ -155,7 +155,7 @@ template<typename O, typename T> struct BandExtraction ...@@ -155,7 +155,7 @@ template<typename O, typename T> struct BandExtraction
// 1 Image with neighborhood -> 1 Image // 1 Image with neighborhood -> 1 Image
// This Functor computes the mean in neighborhood // This Functor computes the mean in neighborhood
template<typename TOut, typename TIn> struct Median template<typename TOut, typename TIn> struct Mean
{ {
auto operator()(const itk::Neighborhood<TIn> & in) const auto operator()(const itk::Neighborhood<TIn> & in) const
{ {
...@@ -255,11 +255,11 @@ int otbFunctorImageFilter(int itkNotUsed(argc), char * itkNotUsed(argv) []) ...@@ -255,11 +255,11 @@ int otbFunctorImageFilter(int itkNotUsed(argc), char * itkNotUsed(argv) [])
extract->SetVInputs(vimage); extract->SetVInputs(vimage);
extract->Update(); extract->Update();
// Test FunctorImageFilter With Median functor // Test FunctorImageFilter With Mean functor
using MedianFunctorType = Median<double,double>; // using MeanFunctorType = Mean<double,double>;
auto median = otb::FunctorImageFilter<MedianFunctorType>::New(MedianFunctorType{}); // auto median = otb::FunctorImageFilter<MeanFunctorType>::New(MeanFunctorType{});
median->SetVInputs(image); // median->SetVInputs(image);
median->Update(); // median->Update();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment