ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkScalarImageToCooccurrenceListSampleFilter.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 __itkScalarImageToCooccurrenceListSampleFilter_h
00019 #define __itkScalarImageToCooccurrenceListSampleFilter_h
00020 
00021 #include <typeinfo>
00022 
00023 #include "itkImageToListSampleFilter.h"
00024 #include "itkSmartPointer.h"
00025 #include "itkImageRegionIterator.h"
00026 #include "itkShapedNeighborhoodIterator.h"
00027 #include "itkNeighborhoodAlgorithm.h"
00028 #include "itkConstantBoundaryCondition.h"
00029 #include "itkFixedArray.h"
00030 
00031 #include <vector>
00032 #include <algorithm>
00033 #include <iostream>
00034 
00035 namespace itk
00036 {
00037 namespace Statistics
00038 {
00050 template< class TImage >
00051 class ITK_EXPORT ScalarImageToCooccurrenceListSampleFilter:
00052   public ProcessObject
00053 {
00054 public:
00055   typedef TImage ImageType;
00056 
00057   typedef FixedArray< typename TImage::PixelType, 2 > MeasurementVectorType;
00058 
00059   typedef itk::Statistics::ListSample< MeasurementVectorType > SampleType;
00060   typedef typename SampleType::MeasurementVectorSizeType       MeasurementVectorSizeType;
00061 
00063   typedef ScalarImageToCooccurrenceListSampleFilter Self;
00064   typedef ProcessObject                             Superclass;
00065   typedef SmartPointer< Self >                      Pointer;
00066   typedef SmartPointer< const Self >                ConstPointer;
00067 
00069   typedef itk::ShapedNeighborhoodIterator<
00070     TImage,
00071     ConstantBoundaryCondition< TImage >
00072     > ShapedNeighborhoodIteratorType;
00073 
00075   typedef typename ShapedNeighborhoodIteratorType::OffsetType OffsetType;
00076   typedef std::vector< OffsetType >                           OffsetTable;
00077 
00078   void UseNeighbor(const OffsetType & offset);
00079 
00081   using Superclass::SetInput;
00082   void SetInput(const ImageType *image);
00083 
00084   const ImageType * GetInput() const;
00085 
00087   const SampleType * GetOutput() const;
00088 
00090   itkTypeMacro(ScalarImageToCooccurrenceListSampleFilter, ProcessObject);
00091 
00093   itkNewMacro(Self);
00094 
00096   itkStaticConstMacro(MeasurementVectorSize, unsigned int, 2);
00097 
00099   itkStaticConstMacro(ImageDimension, unsigned int,
00100                       TImage::ImageDimension);
00101 protected:
00102   ScalarImageToCooccurrenceListSampleFilter();
00103   virtual ~ScalarImageToCooccurrenceListSampleFilter() {}
00104   void PrintSelf(std::ostream & os, Indent indent) const;
00106 
00107   typedef DataObject::Pointer                           DataObjectPointer;
00108   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00109   using Superclass::MakeOutput;
00110   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
00111 
00113   virtual void GenerateData();
00114 
00115 private:
00116   ScalarImageToCooccurrenceListSampleFilter(const Self &); //purposely not
00117                                                            // implemented
00118   void operator=(const Self &);                            //purposely not
00119                                                            // implemented
00120 
00121   OffsetTable m_OffsetTable;
00122 };  // end of class ScalarImageToListSampleFilter
00123 } // end of namespace Statistics
00124 } // end of namespace itk
00125 
00126 #ifndef ITK_MANUAL_INSTANTIATION
00127 #include "itkScalarImageToCooccurrenceListSampleFilter.hxx"
00128 #endif
00129 
00130 #endif
00131