Most importantly you forgot the one rule when writing applications :
images are written after DoExecute() method call ended, so any local
variable (and thus, all your filters) declared in DoExecute() does not
exist anymore when trying to write the image.
You can have a pointer to each of the filters as class member, but
something most convenient is to have a
std::vector<itk::ProcessObject::Pointer> m_Filters member and to add all
your filters to it.
Regards,
Julien
Le 15/09/2016 à 13:26, Jordi Inglada a écrit :
Hi,
Since the NaryAddImageFilter generates an output image with an unknown number
of bands, I guess you have to call its UpdateOutputInformation() so that the
downstream filters (and therefore the writer) know what to do.
Jordi
Poughon Victor <[email protected]> wrote:
Hi
I am writing an OTB application and getting the following error at runtime:
itk::ERROR: GDALImageIO(0xc35a30): Dimensions are not defined.
Any ideas what it means?
Here is the DoExecute of my (very simple) application. i think the problem
comes from the way I am using itk::NaryAddImageFilter, but I don't know:
FloatVectorImageListType::Pointer inList = GetParameterImageList("il");
std::vector<ExtractChannelType::Pointer>
extractChannelFilters(inList->Size(), NULL);
NaryAddImageFilterType::Pointer naryAdder = NaryAddImageFilterType::New();
// For each input image
for (unsigned int i = 0; i < inList->Size(); i++)
{
// Extract first band
extractChannelFilters[i] = ExtractChannelType::New();
extractChannelFilters[i]->SetInput(inList->GetNthElement(i));
extractChannelFilters[i]->SetChannel(1);
// Add it
naryAdder->SetInput(i, extractChannelFilters[i]->GetOutput());
}
// Divide by N
MultiplyImageFilterType::Pointer divideFilter =
MultiplyImageFilterType::New();
divideFilter->SetInput(naryAdder->GetOutput());
divideFilter->SetConstant(1.0f/inList->Size());
// Write
SetParameterOutputImage("out", divideFilter->GetOutput());
Thanks
Victor Poughon
--
--
Julien MICHEL
CNES - DCT/SI/AP - BPI 1219
18, avenue Edouard Belin
31401 Toulouse Cedex 09 - France
Tel: +33 561 282 894 - Fax: +33 561 283 109
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html
You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.