Skip to content
Snippets Groups Projects
Commit 31232585 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

ENH: allow to set a new output image from a writer

parent a4de2332
No related branches found
No related tags found
No related merge requests found
......@@ -131,6 +131,19 @@ public:
this->SetNthInput(size - 1, const_cast<itk::DataObject*>(dynamic_cast<const itk::DataObject*>(inputPtr)));
}
/** Add a new ImageFileWriter to the multi-writer. This is an alternative method
* when you already have an instanciated writer.
*/
template <class TWriter>
void AddInputWriter(const TWriter* writer)
{
Sink<typename TWriter::InputImageType > * sink =
new Sink<typename TWriter::InputImageType >(writer);
m_SinkList.push_back(SinkBase::Pointer(sink));
unsigned int size = m_SinkList.size();
this->SetNthInput(size - 1, const_cast<itk::DataObject*>(dynamic_cast<const itk::DataObject*>(writer->GetInput())));
}
virtual void UpdateOutputInformation();
virtual void Update()
......@@ -242,6 +255,7 @@ private:
Sink() {}
Sink(typename TImage::ConstPointer inputImage,
const std::string & filename);
Sink(typename otb::ImageFileWriter<TImage>::ConstPointer writer);
virtual ~Sink() {}
......
......@@ -40,6 +40,14 @@ MultiImageFileWriter::Sink<TImage>
m_Writer->SetInput(inputImage);
}
template <class TImage>
MultiImageFileWriter::Sink<TImage>
::Sink(typename otb::ImageFileWriter<TImage>::ConstPointer writer):
SinkBase(dynamic_cast<const ImageBaseType*>(writer->GetInput()->GetPointer())),
m_Writer(writer),
m_ImageIO(NULL)
{
}
template <class TImage>
bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment