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 __itkFastApproximateRankImageFilter_h 00019 #define __itkFastApproximateRankImageFilter_h 00020 00021 #include "itkMiniPipelineSeparableImageFilter.h" 00022 #include "itkRankImageFilter.h" 00023 00024 namespace itk 00025 { 00044 template< class TInputImage, class TOutputImage > 00045 class ITK_EXPORT FastApproximateRankImageFilter: 00046 public MiniPipelineSeparableImageFilter< TInputImage, TOutputImage, 00047 RankImageFilter< TInputImage, TInputImage, 00048 FlatStructuringElement< ::itk::GetImageDimension< 00049 TInputImage >::ImageDimension > > > 00050 { 00051 public: 00053 typedef FastApproximateRankImageFilter Self; 00054 typedef MiniPipelineSeparableImageFilter< TInputImage, TOutputImage, RankImageFilter< TInputImage, TInputImage, 00055 FlatStructuringElement< ::itk:: 00056 GetImageDimension 00057 < 00058 TInputImage >::ImageDimension > > > Superclass; 00059 00060 typedef SmartPointer< Self > Pointer; 00061 typedef SmartPointer< const Self > ConstPointer; 00062 00064 itkNewMacro(Self); 00065 00067 itkTypeMacro(FastApproximateRankImageFilter, MiniPipelineSeparableImageFilter); 00068 00070 typedef TInputImage InputImageType; 00071 typedef typename TInputImage::RegionType RegionType; 00072 typedef typename TInputImage::SizeType SizeType; 00073 typedef typename TInputImage::IndexType IndexType; 00074 typedef typename TInputImage::PixelType PixelType; 00075 typedef typename TInputImage::OffsetType OffsetType; 00076 typedef typename Superclass::FilterType FilterType; 00077 00079 itkStaticConstMacro(ImageDimension, unsigned int, 00080 TInputImage::ImageDimension); 00081 00083 typedef typename TInputImage::SizeType RadiusType; 00084 00085 void SetRank(float rank) 00086 { 00087 if ( m_Rank != rank ) 00088 { 00089 m_Rank = rank; 00090 for ( unsigned i = 0; i < TInputImage::ImageDimension - 1; i++ ) 00091 { 00092 this->m_Filters[i]->SetRank(m_Rank); 00093 } 00094 this->Modified(); 00095 } 00096 } 00097 00098 itkGetConstMacro(Rank, float); 00099 protected: 00100 FastApproximateRankImageFilter() 00101 { 00102 // to avoid valgrind warning 00103 m_Rank = 0.0; 00104 this->SetRank(0.5); 00105 } 00106 00107 ~FastApproximateRankImageFilter() {} 00108 00109 void PrintSelf(std::ostream & os, Indent indent) const 00110 { 00111 Superclass::PrintSelf(os, indent); 00112 os << indent << "Rank: " << m_Rank << std::endl; 00113 } 00114 00115 private: 00116 FastApproximateRankImageFilter(const Self &); //purposely not implemented 00117 void operator=(const Self &); //purposely not implemented 00118 00119 float m_Rank; 00120 }; 00121 } 00122 00123 #endif 00124