00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #ifndef ITKIMAGETOIMAGEFILTERADAPTER_H_HEADER_INCLUDED_C1E5E869 00020 #define ITKIMAGETOIMAGEFILTERADAPTER_H_HEADER_INCLUDED_C1E5E869 00021 00022 #include "mitkCommon.h" 00023 #include "mitkImageToImageFilter.h" 00024 00025 #include "itkImage.h" 00026 #include "itkImageToImageFilter.h" 00027 00028 namespace mitk { 00029 00030 //##Documentation 00031 //## @brief adapter class, that encapsulates any itk::ImageToImageFilter 00032 //## 00033 //## This filter converts a mitk::Image to an itk::Image, executes the 00034 //## itkFilter and converts the itk::Image back to a mitk::Image as output. 00035 //## Either call SetSingleFilter() to encapsulate one itk::ImageToImageFilter, 00036 //## or SetFirstFilter() and SetLastFilter() to encapsulate a whole itk pipeline. 00037 //## @ingroup Process 00038 template <typename TPixel> 00039 class ItkImageToImageFilterAdapter : public ImageToImageFilter 00040 { 00041 public: 00042 typedef TPixel PixelType; 00043 typedef itk::Image<PixelType, 3> ItkImageType; 00044 typedef itk::ImageToImageFilter<ItkImageType, ItkImageType> ImageToImageFilterType; 00045 00046 mitkClassMacro(ItkImageToImageFilterAdapter,ImageSource); 00048 itkNewMacro(Self); 00049 00050 itkSetObjectMacro(FirstFilter, ImageToImageFilterType); 00051 itkGetObjectMacro(FirstFilter, ImageToImageFilterType); 00052 itkSetObjectMacro(LastFilter, ImageToImageFilterType); 00053 itkGetObjectMacro(LastFilter, ImageToImageFilterType); 00054 void SetSingleFilter(typename ImageToImageFilterType::Pointer filter); 00055 00056 virtual void GenerateOutputInformation(); 00057 virtual void GenerateData(); 00058 00059 protected: 00060 ItkImageToImageFilterAdapter(); 00061 virtual ~ItkImageToImageFilterAdapter(); 00062 00063 typename ImageToImageFilterType::Pointer m_FirstFilter; // Start of Filter Pipeline 00064 typename ImageToImageFilterType::Pointer m_LastFilter; // End of Filter Pipeline 00065 }; 00066 } // namespace mitk 00067 00068 #include "mitkItkImageToImageFilterAdapter.txx" // because it is a template 00069 00070 #endif /* ITKIMAGETOIMAGEFILTERADAPTER_H_HEADER_INCLUDED_C1E5E869 */