Using FunctorImageFilter with a neighborhood of vectors
Description
I am trying to use the new functorImageFilter
(!299 (merged)) with a lambda taking an itk::Neighborhood<itk::VariableLengthVector<float> >
as input, but I get a segfault when I try to use the filter.
Below is the pipeline I use :
auto reader = ReaderType::New();
reader->SetFileName(filenameIn);
// Dummy lambda that takes a neighborhood of vectors as input and return 1
auto lambda = [](const itk::Neighborhood<itk::VariableLengthVector<float> > & in)
{
float out(1);
return out;
};
auto filterLambda = otb::NewFunctorFilter(lambda ,{{3,3}});
filterLambda->SetVariadicInputs(reader->GetOutput());
auto writer = WriterType::New();
writer->SetInput(filterLambda->GetOutput());
writer->SetFileName(filenameOut);
writer->Update(); //segfault
The code compiles but throw a segfault (in the threadedGenerateData()
of functorImageFilter
, when calling the CallOperator()
method)
Note that this pipeline works correctly if the lambda takes a itk::Neighborhood<float>
instead of the itk::Neighborhood<itk::VariableLengthVector<float> >
Am I missing something in the configuration of the lambda or the functorFilter ? Do we have any example of functorFilter using neighborhood in the OTB at the moment ?
Config : Ubuntu 16.04 - otb develop (08/01/2019)
Example code : main.cpp CMakeLists.txt