ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkVectorConfidenceConnectedImageFilter.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 __itkVectorConfidenceConnectedImageFilter_h
00019 #define __itkVectorConfidenceConnectedImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkMahalanobisDistanceThresholdImageFunction.h"
00023 
00024 namespace itk
00025 {
00058 template< class TInputImage, class TOutputImage >
00059 class ITK_EXPORT VectorConfidenceConnectedImageFilter:
00060   public ImageToImageFilter< TInputImage, TOutputImage >
00061 {
00062 public:
00064   typedef VectorConfidenceConnectedImageFilter            Self;
00065   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00066   typedef SmartPointer< Self >                            Pointer;
00067   typedef SmartPointer< const Self >                      ConstPointer;
00068 
00070   itkNewMacro(Self);
00071 
00073   itkTypeMacro(VectorConfidenceConnectedImageFilter,
00074                ImageToImageFilter);
00075 
00076   typedef TInputImage                         InputImageType;
00077   typedef typename InputImageType::Pointer    InputImagePointer;
00078   typedef typename InputImageType::RegionType InputImageRegionType;
00079   typedef typename InputImageType::PixelType  InputImagePixelType;
00080   typedef typename InputImageType::IndexType  IndexType;
00081   typedef typename InputImageType::SizeType   SizeType;
00082 
00083   typedef TOutputImage                         OutputImageType;
00084   typedef typename OutputImageType::Pointer    OutputImagePointer;
00085   typedef typename OutputImageType::RegionType OutputImageRegionType;
00086   typedef typename OutputImageType::PixelType  OutputImagePixelType;
00087 
00088   typedef std::vector< IndexType > SeedsContainerType;
00089 
00090   typedef MahalanobisDistanceThresholdImageFunction<
00091     InputImageType >
00092   DistanceThresholdFunctionType;
00093 
00094   typedef typename DistanceThresholdFunctionType::CovarianceMatrixType CovarianceMatrixType;
00095   typedef typename DistanceThresholdFunctionType::MeanVectorType       MeanVectorType;
00096 
00097   typedef  typename DistanceThresholdFunctionType::Pointer DistanceThresholdFunctionPointer;
00098 
00099   void PrintSelf(std::ostream & os, Indent indent) const;
00100 
00102   void SetSeed(const IndexType & seed)
00103   {
00104     m_Seeds.clear();
00105     this->AddSeed(seed);
00106   }
00108 
00110   void AddSeed(const IndexType & seed)
00111   {
00112     m_Seeds.push_back(seed);
00113     this->Modified();
00114   }
00116 
00119   itkSetMacro(Multiplier, double);
00120   itkGetConstMacro(Multiplier, double);
00122 
00124   itkSetMacro(NumberOfIterations, unsigned int);
00125   itkGetConstMacro(NumberOfIterations, unsigned int);
00127 
00129   itkSetMacro(ReplaceValue, OutputImagePixelType);
00130   itkGetConstMacro(ReplaceValue, OutputImagePixelType);
00132 
00135   itkSetMacro(InitialNeighborhoodRadius, unsigned int);
00136   itkGetConstReferenceMacro(InitialNeighborhoodRadius, unsigned int);
00138 
00140   const MeanVectorType & GetMean() const;
00141 
00143   const CovarianceMatrixType & GetCovariance() const;
00144 
00146   virtual const SeedsContainerType &GetSeeds() const;
00147 
00148 
00149 #ifdef ITK_USE_CONCEPT_CHECKING
00150 
00151   itkConceptMacro( OutputEqualityComparableCheck,
00152                    ( Concept::EqualityComparable< OutputImagePixelType > ) );
00153   itkConceptMacro( InputHasNumericTraitsCheck,
00154                    ( Concept::HasNumericTraits< typename InputImagePixelType::ValueType > ) );
00155   itkConceptMacro( OutputOStreamWritableCheck,
00156                    ( Concept::OStreamWritable< OutputImagePixelType > ) );
00157 
00159 #endif
00160 protected:
00161   VectorConfidenceConnectedImageFilter();
00162 
00163   // Override since the filter needs all the data for the algorithm
00164   void GenerateInputRequestedRegion();
00165 
00166   // Override since the filter produces the entire dataset
00167   void EnlargeOutputRequestedRegion(DataObject *output);
00168 
00169   void GenerateData();
00170 
00171 private:
00172   VectorConfidenceConnectedImageFilter(const Self &); //purposely not
00173                                                       // implemented
00174   void operator=(const Self &);                       //purposely not
00175 
00176   // implemented
00177 
00178   SeedsContainerType   m_Seeds;
00179   double               m_Multiplier;
00180   unsigned int         m_NumberOfIterations;
00181   OutputImagePixelType m_ReplaceValue;
00182   unsigned int         m_InitialNeighborhoodRadius;
00183 
00184   DistanceThresholdFunctionPointer m_ThresholdFunction;
00185 };
00186 } // end namespace itk
00187 
00188 #ifndef ITK_MANUAL_INSTANTIATION
00189 #include "itkVectorConfidenceConnectedImageFilter.hxx"
00190 #endif
00191 
00192 #endif
00193