ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkImageToListSampleFilter.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 __itkImageToListSampleFilter_h
00019 #define __itkImageToListSampleFilter_h
00020 
00021 #include "itkListSample.h"
00022 #include "itkPixelTraits.h"
00023 #include "itkProcessObject.h"
00024 #include "itkDataObjectDecorator.h"
00025 
00026 namespace itk
00027 {
00028 namespace Statistics
00029 {
00054 template< class TImage, class TMaskImage = TImage >
00055 class ITK_EXPORT ImageToListSampleFilter:
00056   public ProcessObject
00057 {
00058 public:
00060   typedef ImageToListSampleFilter    Self;
00061   typedef ProcessObject              Superclass;
00062   typedef SmartPointer< Self >       Pointer;
00063   typedef SmartPointer< const Self > ConstPointer;
00064 
00066   itkTypeMacro(ImageToListSampleFilter, ProcessObject);
00067 
00069   itkNewMacro(Self);
00070 
00072   typedef TImage                           ImageType;
00073   typedef typename ImageType::Pointer      ImagePointer;
00074   typedef typename ImageType::ConstPointer ImageConstPointer;
00075   typedef typename ImageType::PixelType    PixelType;
00076   typedef typename MeasurementVectorPixelTraits<
00077     PixelType >::MeasurementVectorType MeasurementVectorType;
00078 
00080   typedef TMaskImage                           MaskImageType;
00081   typedef typename MaskImageType::Pointer      MaskImagePointer;
00082   typedef typename MaskImageType::ConstPointer MaskImageConstPointer;
00083   typedef typename MaskImageType::PixelType    MaskPixelType;
00084 
00086   typedef ListSample< MeasurementVectorType > ListSampleType;
00087 
00089   unsigned int GetMeasurementVectorSize() const;
00090 
00092   using Superclass::SetInput;
00093   void SetInput(const ImageType *image);
00094 
00095   const ImageType * GetInput() const;
00096 
00098   void SetMaskImage(const MaskImageType *image);
00099 
00100   const MaskImageType * GetMaskImage() const;
00101 
00105   const ListSampleType * GetOutput() const;
00106 
00111   itkSetMacro(MaskValue, MaskPixelType);
00112   itkGetConstMacro(MaskValue, MaskPixelType);
00113 protected:
00114   ImageToListSampleFilter();
00115   virtual ~ImageToListSampleFilter() {}
00116   void PrintSelf(std::ostream & os, Indent indent) const;
00118 
00120   typedef DataObject::Pointer                           DataObjectPointer;
00121   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00122   using Superclass::MakeOutput;
00123   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
00124 
00126   virtual void GenerateData();
00127 
00130   virtual void GenerateInputRequestedRegion()
00131   throw( InvalidRequestedRegionError );
00132 
00133   virtual void GenerateOutputInformation();
00134 
00135 private:
00136   ImageToListSampleFilter(const Self &); //purposely not implemented
00137   void operator=(const Self &);          //purposely not implemented
00138 
00139   MaskPixelType m_MaskValue;
00140 };  // end of class ImageToListSampleFilter
00141 } // end of namespace Statistics
00142 } // end of namespace itk
00143 
00144 #ifndef ITK_MANUAL_INSTANTIATION
00145 #include "itkImageToListSampleFilter.hxx"
00146 #endif
00147 
00148 #endif
00149