00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMinimumMaximumImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2004/08/13 11:06:19 $ 00007 Version: $Revision: 1.11 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 #ifndef __itkMinimumMaximumImageFilter_h 00018 #define __itkMinimumMaximumImageFilter_h 00019 00020 #include "itkImageToImageFilter.h" 00021 #include "itkSimpleDataObjectDecorator.h" 00022 00023 #include <vector> 00024 00025 #include "itkNumericTraits.h" 00026 00027 namespace itk 00028 { 00041 template <class TInputImage> 00042 class ITK_EXPORT MinimumMaximumImageFilter : 00043 public ImageToImageFilter< TInputImage, TInputImage> 00044 { 00045 public: 00047 itkStaticConstMacro(InputImageDimension, unsigned int, 00048 TInputImage::ImageDimension); 00049 itkStaticConstMacro(OutputImageDimension, unsigned int, 00050 TInputImage::ImageDimension); 00051 00053 typedef MinimumMaximumImageFilter Self; 00054 typedef ImageToImageFilter< TInputImage, TInputImage> Superclass; 00055 typedef SmartPointer<Self> Pointer; 00056 typedef SmartPointer<const Self> ConstPointer; 00057 00059 typedef typename TInputImage::Pointer InputImagePointer; 00060 00061 typedef typename TInputImage::RegionType RegionType ; 00062 typedef typename TInputImage::SizeType SizeType ; 00063 typedef typename TInputImage::IndexType IndexType ; 00064 typedef typename TInputImage::PixelType PixelType ; 00065 00067 typedef typename DataObject::Pointer DataObjectPointer; 00068 00070 itkNewMacro(Self); 00071 00073 itkTypeMacro(MinimumMaximumImageFilter, ImageToImageFilter); 00074 00076 typedef TInputImage InputImageType; 00077 00079 typedef SimpleDataObjectDecorator<PixelType> PixelObjectType; 00080 00082 PixelType GetMinimum() const 00083 { return this->GetMinimumOutput()->Get(); } 00084 PixelObjectType* GetMinimumOutput(); 00085 const PixelObjectType* GetMinimumOutput() const; 00086 00088 PixelType GetMaximum() const 00089 { return this->GetMaximumOutput()->Get(); } 00090 PixelObjectType* GetMaximumOutput(); 00091 const PixelObjectType* GetMaximumOutput() const; 00092 00095 virtual DataObjectPointer MakeOutput(unsigned int idx); 00096 00097 protected: 00098 MinimumMaximumImageFilter(); 00099 virtual ~MinimumMaximumImageFilter() {} 00100 void PrintSelf(std::ostream& os, Indent indent) const; 00101 00103 void AllocateOutputs(); 00104 00106 void BeforeThreadedGenerateData (); 00107 00109 void AfterThreadedGenerateData (); 00110 00112 void ThreadedGenerateData (const RegionType& 00113 outputRegionForThread, 00114 int threadId) ; 00115 00116 // Override since the filter needs all the data for the algorithm 00117 void GenerateInputRequestedRegion(); 00118 00119 // Override since the filter produces all of its output 00120 void EnlargeOutputRequestedRegion(DataObject *data); 00121 00122 private: 00123 MinimumMaximumImageFilter(const Self&); //purposely not implemented 00124 void operator=(const Self&); //purposely not implemented 00125 00126 std::vector<PixelType> m_ThreadMin; 00127 std::vector<PixelType> m_ThreadMax; 00128 }; 00129 00130 } // end namespace itk 00131 00132 #ifndef ITK_MANUAL_INSTANTIATION 00133 #include "itkMinimumMaximumImageFilter.txx" 00134 #endif 00135 00136 #endif