-template<class ImageType>
-void clitk::ImageToImageGenericFilterBase::SetNextOutput(typename ImageType::Pointer output) {
- if (mOutputFilenames.size())
- {
- clitk::writeImage<ImageType>(output, mOutputFilenames.front(), mIOVerbose);
- mOutputFilenames.pop_front();
+template<class ImageType>
+void clitk::ImageToImageGenericFilterBase::SetNextOutput(typename ImageType::Pointer output)
+{
+ if (m_OutputFilenames.size()) {
+ clitk::writeImage<ImageType>(output, m_OutputFilenames.front(), m_IOVerbose);
+ m_OutputFilenames.pop_front();
+ }
+ if (m_InputVVImages.size()) //We assume that if a vv image is set as input, we want one as the output
+ m_OutputVVImages.push_back(vvImageFromITK<ImageType::ImageDimension,typename ImageType::PixelType>(output));
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class ImageType>
+typename ImageType::Pointer clitk::ImageToImageGenericFilterBase::GetInput(unsigned int n)
+{
+ if (m_ReadOnDisk && m_InputFilenames.size() > n) {
+ return clitk::readImage<ImageType>(m_InputFilenames[n], m_IOVerbose);
+ } else {
+ if (m_InputVVImages.size() > n)
+ return typename ImageType::Pointer(const_cast<ImageType*>(vvImageToITK<ImageType>(m_InputVVImages[n]).GetPointer()));
+ else {
+ assert(false); //No input, this shouldn't happen
+ return typename ImageType::Pointer(NULL);