ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkMinimumMaximumImageFilter_h 00019 #define __itkMinimumMaximumImageFilter_h 00020 00021 #include "itkImageToImageFilter.h" 00022 #include "itkSimpleDataObjectDecorator.h" 00023 00024 #include <vector> 00025 00026 #include "itkNumericTraits.h" 00027 00028 namespace itk 00029 { 00043 template< class TInputImage > 00044 class ITK_EXPORT MinimumMaximumImageFilter: 00045 public ImageToImageFilter< TInputImage, TInputImage > 00046 { 00047 public: 00049 itkStaticConstMacro(InputImageDimension, unsigned int, 00050 TInputImage::ImageDimension); 00051 itkStaticConstMacro(OutputImageDimension, unsigned int, 00052 TInputImage::ImageDimension); 00054 00056 typedef MinimumMaximumImageFilter Self; 00057 typedef ImageToImageFilter< TInputImage, TInputImage > Superclass; 00058 typedef SmartPointer< Self > Pointer; 00059 typedef SmartPointer< const Self > ConstPointer; 00060 00062 typedef typename TInputImage::Pointer InputImagePointer; 00063 00064 typedef typename TInputImage::RegionType RegionType; 00065 typedef typename TInputImage::SizeType SizeType; 00066 typedef typename TInputImage::IndexType IndexType; 00067 typedef typename TInputImage::PixelType PixelType; 00068 00070 typedef typename DataObject::Pointer DataObjectPointer; 00071 00073 itkNewMacro(Self); 00074 00076 itkTypeMacro(MinimumMaximumImageFilter, ImageToImageFilter); 00077 00079 typedef TInputImage InputImageType; 00080 00082 typedef SimpleDataObjectDecorator< PixelType > PixelObjectType; 00083 00085 PixelType GetMinimum() const 00086 { return this->GetMinimumOutput()->Get(); } 00087 PixelObjectType * GetMinimumOutput(); 00089 00090 const PixelObjectType * GetMinimumOutput() const; 00091 00093 PixelType GetMaximum() const 00094 { return this->GetMaximumOutput()->Get(); } 00095 PixelObjectType * GetMaximumOutput(); 00097 00098 const PixelObjectType * GetMaximumOutput() const; 00099 00102 typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; 00103 using Superclass::MakeOutput; 00104 virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); 00105 00106 #ifdef ITK_USE_CONCEPT_CHECKING 00107 00108 itkConceptMacro( LessThanComparableCheck, 00109 ( Concept::LessThanComparable< PixelType > ) ); 00110 itkConceptMacro( GreaterThanComparableCheck, 00111 ( Concept::GreaterThanComparable< PixelType > ) ); 00112 itkConceptMacro( OStreamWritableCheck, 00113 ( Concept::OStreamWritable< PixelType > ) ); 00114 00116 #endif 00117 protected: 00118 MinimumMaximumImageFilter(); 00119 virtual ~MinimumMaximumImageFilter() {} 00120 void PrintSelf(std::ostream & os, Indent indent) const; 00122 00125 void AllocateOutputs(); 00126 00128 void BeforeThreadedGenerateData(); 00129 00132 void AfterThreadedGenerateData(); 00133 00135 void ThreadedGenerateData(const RegionType & 00136 outputRegionForThread, 00137 ThreadIdType threadId); 00138 00139 // Override since the filter needs all the data for the algorithm 00140 void GenerateInputRequestedRegion(); 00141 00142 // Override since the filter produces all of its output 00143 void EnlargeOutputRequestedRegion(DataObject *data); 00144 00145 private: 00146 MinimumMaximumImageFilter(const Self &); //purposely not implemented 00147 void operator=(const Self &); //purposely not implemented 00148 00149 std::vector< PixelType > m_ThreadMin; 00150 std::vector< PixelType > m_ThreadMax; 00151 }; 00152 } // end namespace itk 00153 00154 #ifndef ITK_MANUAL_INSTANTIATION 00155 #include "itkMinimumMaximumImageFilter.hxx" 00156 #endif 00157 00158 #endif 00159