ITK  4.2.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 
00105   void AddSeed(const IndexType & seed);
00106 
00108   void ClearSeeds();
00109 
00112   itkSetMacro(Multiplier, double);
00113   itkGetConstMacro(Multiplier, double);
00115 
00117   itkSetMacro(NumberOfIterations, unsigned int);
00118   itkGetConstMacro(NumberOfIterations, unsigned int);
00120 
00122   itkSetMacro(ReplaceValue, OutputImagePixelType);
00123   itkGetConstMacro(ReplaceValue, OutputImagePixelType);
00125 
00128   itkSetMacro(InitialNeighborhoodRadius, unsigned int);
00129   itkGetConstReferenceMacro(InitialNeighborhoodRadius, unsigned int);
00131 
00133   const MeanVectorType & GetMean() const;
00134 
00136   const CovarianceMatrixType & GetCovariance() const;
00137 
00139   virtual const SeedsContainerType &GetSeeds() const;
00140 
00141 
00142 #ifdef ITK_USE_CONCEPT_CHECKING
00143 
00144   itkConceptMacro( OutputEqualityComparableCheck,
00145                    ( Concept::EqualityComparable< OutputImagePixelType > ) );
00146   itkConceptMacro( InputHasNumericTraitsCheck,
00147                    ( Concept::HasNumericTraits< typename InputImagePixelType::ValueType > ) );
00148   itkConceptMacro( OutputOStreamWritableCheck,
00149                    ( Concept::OStreamWritable< OutputImagePixelType > ) );
00150 
00152 #endif
00153 protected:
00154   VectorConfidenceConnectedImageFilter();
00155 
00156   // Override since the filter needs all the data for the algorithm
00157   void GenerateInputRequestedRegion();
00158 
00159   // Override since the filter produces the entire dataset
00160   void EnlargeOutputRequestedRegion(DataObject *output);
00161 
00162   void GenerateData();
00163 
00164 private:
00165   VectorConfidenceConnectedImageFilter(const Self &); //purposely not
00166                                                       // implemented
00167   void operator=(const Self &);                       //purposely not
00168 
00169   // implemented
00170 
00171   SeedsContainerType   m_Seeds;
00172   double               m_Multiplier;
00173   unsigned int         m_NumberOfIterations;
00174   OutputImagePixelType m_ReplaceValue;
00175   unsigned int         m_InitialNeighborhoodRadius;
00176 
00177   DistanceThresholdFunctionPointer m_ThresholdFunction;
00178 };
00179 } // end namespace itk
00180 
00181 #ifndef ITK_MANUAL_INSTANTIATION
00182 #include "itkVectorConfidenceConnectedImageFilter.hxx"
00183 #endif
00184 
00185 #endif
00186