ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkIsolatedConnectedImageFilter.h
Go to the documentation of this file.
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 __itkIsolatedConnectedImageFilter_h
00019 #define __itkIsolatedConnectedImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 
00023 namespace itk
00024 {
00070 template< class TInputImage, class TOutputImage >
00071 class ITK_EXPORT IsolatedConnectedImageFilter:
00072   public ImageToImageFilter< TInputImage, TOutputImage >
00073 {
00074 public:
00076   typedef IsolatedConnectedImageFilter                    Self;
00077   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00078   typedef SmartPointer< Self >                            Pointer;
00079   typedef SmartPointer< const Self >                      ConstPointer;
00080 
00082   itkNewMacro(Self);
00083 
00085   itkTypeMacro(IsolatedConnectedImageFilter,
00086                ImageToImageFilter);
00087 
00088   typedef TInputImage                           InputImageType;
00089   typedef typename InputImageType::Pointer      InputImagePointer;
00090   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00091   typedef typename InputImageType::RegionType   InputImageRegionType;
00092   typedef typename InputImageType::PixelType    InputImagePixelType;
00093   typedef typename InputImageType::IndexType    IndexType;
00094   typedef typename InputImageType::SizeType     SizeType;
00095 
00096   typedef TOutputImage                         OutputImageType;
00097   typedef typename OutputImageType::Pointer    OutputImagePointer;
00098   typedef typename OutputImageType::RegionType OutputImageRegionType;
00099   typedef typename OutputImageType::PixelType  OutputImagePixelType;
00100 
00101   typedef std::vector< IndexType > SeedsContainerType;
00102 
00103   typedef typename NumericTraits<
00104     InputImagePixelType >::RealType InputRealType;
00105 
00106   void PrintSelf(std::ostream & os, Indent indent) const;
00107 
00111   void SetSeed1(const IndexType & seed);
00112 
00114   void ClearSeeds1();
00115 
00117   void AddSeed1(const IndexType & seed);
00118 
00121   void SetSeed2(const IndexType & seed);
00122 
00124   void ClearSeeds2();
00125 
00127   void AddSeed2(const IndexType & seed);
00128 
00130   virtual const SeedsContainerType &GetSeeds1() const;
00131   virtual const SeedsContainerType &GetSeeds2() const;
00133 
00136   itkSetMacro(Lower, InputImagePixelType);
00137   itkGetConstReferenceMacro(Lower, InputImagePixelType);
00139 
00142   itkSetMacro(Upper, InputImagePixelType);
00143   itkGetConstReferenceMacro(Upper, InputImagePixelType);
00145 
00149   void SetUpperValueLimit(InputImagePixelType upperValue)
00150   {
00151     this->SetUpper(upperValue);
00152   }
00153 
00154   InputImagePixelType GetUpperValueLimit()
00155   {
00156     return this->GetUpper();
00157   }
00158 
00161   itkSetMacro(IsolatedValueTolerance, InputImagePixelType);
00162   itkGetConstReferenceMacro(IsolatedValueTolerance, InputImagePixelType);
00164 
00168   itkSetMacro(ReplaceValue, OutputImagePixelType);
00169   itkGetConstReferenceMacro(ReplaceValue, OutputImagePixelType);
00171 
00173   itkGetConstReferenceMacro(IsolatedValue, InputImagePixelType);
00174 
00177   itkSetMacro(FindUpperThreshold, bool);
00178   itkBooleanMacro(FindUpperThreshold);
00179   itkGetConstReferenceMacro(FindUpperThreshold, bool);
00181 
00184   itkGetConstReferenceMacro(ThresholdingFailed, bool);
00185 
00186 #ifdef ITK_USE_CONCEPT_CHECKING
00187 
00188   itkConceptMacro( InputHasNumericTraitsCheck,
00189                    ( Concept::HasNumericTraits< InputImagePixelType > ) );
00190 
00192 #endif
00193 protected:
00194   IsolatedConnectedImageFilter();
00195   ~IsolatedConnectedImageFilter(){}
00196   SeedsContainerType m_Seeds1;
00197   SeedsContainerType m_Seeds2;
00199 
00200   InputImagePixelType m_Lower;
00201   InputImagePixelType m_Upper;
00202 
00203   OutputImagePixelType m_ReplaceValue;
00204 
00205   InputImagePixelType m_IsolatedValue;
00206   InputImagePixelType m_IsolatedValueTolerance;
00207 
00208   bool m_FindUpperThreshold;
00209   bool m_ThresholdingFailed;
00210 
00211   // Override since the filter needs all the data for the algorithm
00212   void GenerateInputRequestedRegion();
00213 
00214   // Override since the filter produces the entire dataset
00215   void EnlargeOutputRequestedRegion(DataObject *output);
00216 
00217   void GenerateData();
00218 
00219 private:
00220   IsolatedConnectedImageFilter(const Self &); //purposely not implemented
00221   void operator=(const Self &);               //purposely not implemented
00222 };
00223 } // end namespace itk
00224 
00225 #ifndef ITK_MANUAL_INSTANTIATION
00226 #include "itkIsolatedConnectedImageFilter.hxx"
00227 #endif
00228 
00229 #endif
00230