ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkSTAPLEImageFilter.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 __itkSTAPLEImageFilter_h
00019 #define __itkSTAPLEImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include <vector>
00023 
00024 namespace itk
00025 {
00120 template< typename TInputImage, typename TOutputImage >
00121 class ITK_EXPORT STAPLEImageFilter:
00122   public ImageToImageFilter< TInputImage, TOutputImage >
00123 {
00124 public:
00126   typedef STAPLEImageFilter                               Self;
00127   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00128   typedef SmartPointer< Self >                            Pointer;
00129   typedef SmartPointer< const Self >                      ConstPointer;
00130 
00132   itkNewMacro(Self);
00133 
00135   itkTypeMacro(STAPLEImageFilter, ImageToImageFilter);
00136 
00139   typedef typename TOutputImage::PixelType                   OutputPixelType;
00140   typedef typename TInputImage::PixelType                    InputPixelType;
00141   typedef typename NumericTraits< InputPixelType >::RealType RealType;
00142 
00145   itkStaticConstMacro(ImageDimension, unsigned int,
00146                       TOutputImage::ImageDimension);
00147 
00149   typedef TInputImage                       InputImageType;
00150   typedef typename InputImageType::Pointer  InputImagePointer;
00151   typedef TOutputImage                      OutputImageType;
00152   typedef typename OutputImageType::Pointer OutputImagePointer;
00153 
00155   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00156 
00158   itkSetMacro(ForegroundValue, InputPixelType);
00159   itkGetConstMacro(ForegroundValue, InputPixelType);
00161 
00165   const std::vector< double > & GetSpecificity() const
00166   {
00167     return m_Specificity;
00168   }
00169 
00173   const std::vector< double > & GetSensitivity() const
00174   {
00175     return m_Sensitivity;
00176   }
00177 
00180   double GetSensitivity(unsigned int i)
00181   {
00182     if ( i > this->GetNumberOfIndexedInputs() )
00183       {
00184       itkExceptionMacro(<< "Array reference out of bounds.");
00185       }
00186     return m_Sensitivity[i];
00187   }
00189 
00192   double GetSpecificity(unsigned int i)
00193   {
00194     if ( i > this->GetNumberOfIndexedInputs() )
00195       {
00196       itkExceptionMacro(<< "Array reference out of bounds.");
00197       }
00198     return m_Specificity[i];
00199   }
00201 
00205   itkSetMacro(MaximumIterations, unsigned int);
00206   itkGetConstMacro(MaximumIterations, unsigned int);
00208 
00216   itkSetMacro(ConfidenceWeight, double);
00217   itkGetConstMacro(ConfidenceWeight, double);
00219 
00221   itkGetConstMacro(ElapsedIterations, unsigned int);
00222 
00223 #ifdef ITK_USE_CONCEPT_CHECKING
00224 
00225   itkConceptMacro( InputHasNumericTraitsCheck,
00226                    ( Concept::HasNumericTraits< InputPixelType > ) );
00227 
00229 #endif
00230 protected:
00231   STAPLEImageFilter()
00232   {
00233     m_ForegroundValue = NumericTraits< InputPixelType >::One;
00234     m_MaximumIterations = NumericTraits< unsigned int >::max();
00235     m_ElapsedIterations = 0;
00236     m_ConfidenceWeight = 1.0;
00237   }
00239 
00240   virtual ~STAPLEImageFilter() {}
00241   void GenerateData();
00242 
00243   void PrintSelf(std::ostream &, Indent) const;
00244 private:
00245   STAPLEImageFilter(const Self &); //purposely not implemented
00246   void operator=(const Self &);    //purposely not implemented
00247 
00248   InputPixelType m_ForegroundValue;
00249   unsigned int   m_ElapsedIterations;
00250   unsigned int   m_MaximumIterations;
00251 
00252   double m_ConfidenceWeight;
00253 
00254   std::vector< double > m_Sensitivity;
00255   std::vector< double > m_Specificity;
00256 };
00257 } // end namespace itk
00258 
00259 #ifndef ITK_MANUAL_INSTANTIATION
00260 #include "itkSTAPLEImageFilter.hxx"
00261 #endif
00262 
00263 #endif
00264