Commit 490d8c35 authored by Julien Michel's avatar Julien Michel

DOC: Enhance documentation

parent d8dffd44
......@@ -162,13 +162,6 @@ template <class T> struct ImageTypeDeduction<itk::VariableLengthVector<T>>
using ImageType = otb::VectorImage<T>;
};
// /// Partial specialisation for const T &
// template <class T> struct ImageTypeDeduction<const T &>
// {
// using ImageType = typename ImageTypeDeduction<T>::ImageType;
// };
/**
* \struct FunctorFilterSuperclassHelper
* \brief Struct allowing to derive the superclass prototype for the
......@@ -208,7 +201,7 @@ template <typename C, typename R, typename... T> struct FunctorFilterSuperclassH
};
/**
* brief This helper method builds a fully functional FunctorImageFilter from a functor instance
* \brief This helper method builds a fully functional FunctorImageFilter from a functor instance
*
* Functor can be any operator() that matches the following:
* - Accepts any number of arguments of T,
......
......@@ -24,8 +24,30 @@
namespace otb {
/// TODO: Documentation
/**
* \brief Base class for image filter with variadic inputs.
*
* This filter act as a base class for all filters that will take
* several input images with different types and produce an output
* image.
*
* Type for each input is taken from the variadic template parameter
* TInputs.
*
* Inputs get be set/get with SetVariadicInput<N>() and
* GetVariadicInput<N>(), when N is the index (first input is 0) of
* the input. This is resolved at compile time: you can not call
* SetVariadicInput<N>() with an argument not matching the Nth input
* type (it will lead to type mismatch compilation error).
*
* Alternatively, you can call SetVariadicInputs() with all the input
* image in the same order as in the template parameters.
*
* Last, there is a macro that generates SetInput1() ... SetInput10()
* (iff the number of varidic input types is large enough) for
* backward compatibility.
*
*/
template<class TOuptut, class ... TInputs> class VariadicInputsImageFilter : public itk::ImageSource<TOuptut>
{
public:
......@@ -39,11 +61,15 @@ public:
template <size_t I> using InputImageType = typename std::tuple_element<I,InputTypesTupleType>::type;
static constexpr size_t NumberOfInputs = std::tuple_size<InputTypesTupleType>::value;
// Good old new macro
itkNewMacro(Self);
/**
* \param Set the Ith input
*/
template <std::size_t I> void SetVariadicInput(const typename std::tuple_element<I,InputTypesTupleType>::type * inputPtr)
{
static_assert(std::tuple_size<InputTypesTupleType>::value>I,"Template value I is out of range.");
this->SetNthInput(I,const_cast<typename std::tuple_element<I,InputTypesTupleType>::type *>(inputPtr));
}
......@@ -69,18 +95,28 @@ public:
#undef DefineLegacySetInputMacro
/**
* \return the Ith variadic input
*/
template <std::size_t I> const typename std::tuple_element<I,InputTypesTupleType>::type * GetVariadicInput()
{
static_assert(std::tuple_size<InputTypesTupleType>::value>I,"Template value I is out of range.");
using ImageType = typename std::tuple_element<I,InputTypesTupleType>::type;
return dynamic_cast<const ImageType *>(this->GetInput(I));
}
/**
* \param inputs A vararg list of inputs
*/
void SetVariadicInputs(TInputs*... inputs)
{
auto inTuple = std::make_tuple(inputs...);
SetInputsImpl(inTuple,std::make_index_sequence<sizeof...(inputs)>{});
}
/**
* \return A tuple with all inputs
*/
auto GetVariadicInputs()
{
return GetInputsImpl(std::make_index_sequence<sizeof...(TInputs)>{});
......
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