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 IMAGETOITK_H_HEADER_INCLUDED_C1C2FCD2 00020 #define IMAGETOITK_H_HEADER_INCLUDED_C1C2FCD2 00021 00022 #if(_MSC_VER==1200) 00023 #include <itkFixedCenterOfRotationAffineTransform.h> 00024 #endif 00025 00026 #include <itkImage.h> 00027 #include <itkImageSource.h> 00028 #include "mitkImage.h" 00029 #include "mitkImageDataItem.h" 00030 00031 namespace mitk 00032 { 00040 template <class TOutputImage> 00041 class ITK_EXPORT ImageToItk : public itk::ImageSource< TOutputImage > 00042 { 00043 protected: 00044 mitk::Image::Pointer m_MitkImage; 00045 mitk::ImageDataItem::Pointer m_ImageDataItem; 00046 00047 public: 00048 typedef ImageToItk Self; 00049 typedef itk::ImageSource<TOutputImage> Superclass; 00050 typedef itk::SmartPointer<Self> Pointer; 00051 typedef itk::SmartPointer<const Self> ConstPointer; 00052 00054 itkNewMacro(Self); 00055 00057 typedef typename Superclass::OutputImageRegionType OutputImageRegionType; 00058 00060 typedef mitk::Image InputImageType; 00061 typedef InputImageType::Pointer InputImagePointer; 00062 typedef InputImageType::ConstPointer InputImageConstPointer; 00063 typedef SlicedData::RegionType InputImageRegionType; 00064 typedef typename TOutputImage::SizeType SizeType; 00065 typedef typename TOutputImage::IndexType IndexType; 00066 typedef typename TOutputImage::RegionType RegionType; 00067 typedef typename TOutputImage::PixelType PixelType; 00068 00069 const mitk::Image * GetInput(void); 00070 const mitk::Image * GetInput(unsigned int idx); 00071 00072 virtual void SetInput(const mitk::Image *input); 00073 virtual void SetInput(unsigned int index, const mitk::Image * image); 00074 00075 virtual void UpdateOutputInformation(); 00076 00077 itkGetMacro( Channel, int ); 00078 itkSetMacro( Channel, int ); 00079 00080 itkSetMacro( CopyMemFlag, bool ); 00081 itkGetMacro( CopyMemFlag, bool ); 00082 itkBooleanMacro( CopyMemFlag ); 00083 00084 protected: 00085 ImageToItk(): m_CopyMemFlag(false), m_Channel(0) 00086 { 00087 } 00088 00089 virtual ~ImageToItk() 00090 { 00091 } 00092 00093 void PrintSelf(std::ostream& os, itk::Indent indent) const; 00094 00095 00096 virtual void GenerateData(); 00097 00098 virtual void GenerateOutputInformation(); 00099 00100 private: 00101 bool m_CopyMemFlag; 00102 int m_Channel; 00103 00104 //ImageToItk(const Self&); //purposely not implemented 00105 void operator=(const Self&); //purposely not implemented 00106 00107 }; 00108 00109 00110 } // end namespace mitk 00111 00112 00113 00114 #ifndef ITK_MANUAL_INSTANTIATION 00115 #include "mitkImageToItk.txx" 00116 #endif 00117 00118 #endif // IMAGETOITK_H_HEADER_INCLUDED_C1C2FCD2 00119