Common runtime errors

From OTBWiki
Jump to: navigation, search

This page is intended to describe common runtime errors encountered by developers as well as their possible causes. You may also want to have a look at compilation errors.

Streaming and variables scopes

If we consider the following case:

ViewerType::Pointer viewer = ViewerType::New();
     ReaderType::Pointer reader = ReaderType::New();

The scope of the reader variable is limited to the brackets. Therefore, by the time viewer->Build() and viewer->Update() are called, the reader has already been deleted. Note that the reader output image still exists, thanks to reference counting and to viewer->SetInputOverlay(reader->GetOutput();. It is only unplugged from the reader. This will cause any attempt to update a new requested region of the image to fail, because it has no more source.

If you want to use an pipeline with streaming, you must ensure that none of your filters (including the reader) is destroyed before your are over with what you were up to stream.