ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkReconstructionImageFilter.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 __itkReconstructionImageFilter_h
00019 #define __itkReconstructionImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkShapedNeighborhoodIterator.h"
00023 #include "itkImageRegionIterator.h"
00024 #include "itkProgressReporter.h"
00025 #include <queue>
00026 
00027 //#define BASIC
00028 #define COPY
00029 
00030 #ifdef COPY
00031 #include "itkNeighborhoodAlgorithm.h"
00032 #endif
00033 
00034 namespace itk
00035 {
00054 template< class TInputImage, class TOutputImage, class TCompare >
00055 class ITK_EXPORT ReconstructionImageFilter:
00056   public ImageToImageFilter< TInputImage, TOutputImage >
00057 {
00058 public:
00060   typedef ReconstructionImageFilter                       Self;
00061   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00062 
00063   typedef SmartPointer< Self >       Pointer;
00064   typedef SmartPointer< const Self > ConstPointer;
00065 
00067   typedef TInputImage                            InputImageType;
00068   typedef typename InputImageType::SizeType      ISizeType;
00069   typedef TInputImage                            MarkerImageType;
00070   typedef typename MarkerImageType::Pointer      MarkerImagePointer;
00071   typedef typename MarkerImageType::ConstPointer MarkerImageConstPointer;
00072   typedef typename MarkerImageType::RegionType   MarkerImageRegionType;
00073   typedef typename MarkerImageType::PixelType    MarkerImagePixelType;
00074   typedef typename InputImageType::PixelType     InputImagePixelType;
00075   typedef typename InputImageType::IndexType     InputImageIndexType;
00076   typedef TInputImage                            MaskImageType;
00077   typedef typename MaskImageType::Pointer        MaskImagePointer;
00078   typedef typename MaskImageType::ConstPointer   MaskImageConstPointer;
00079   typedef typename MaskImageType::RegionType     MaskImageRegionType;
00080   typedef typename MaskImageType::PixelType      MaskImagePixelType;
00081   typedef TOutputImage                           OutputImageType;
00082   typedef typename OutputImageType::Pointer      OutputImagePointer;
00083   typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
00084   typedef typename OutputImageType::RegionType   OutputImageRegionType;
00085   typedef typename OutputImageType::PixelType    OutputImagePixelType;
00086   typedef typename OutputImageType::IndexType    OutputImageIndexType;
00087 
00091   itkStaticConstMacro(MarkerImageDimension, unsigned int,
00092                       TInputImage::ImageDimension);
00093   itkStaticConstMacro(MaskImageDimension, unsigned int,
00094                       TInputImage::ImageDimension);
00095   itkStaticConstMacro(OutputImageDimension, unsigned int,
00096                       TOutputImage::ImageDimension);
00098 
00100   itkNewMacro(Self);
00101 
00103   itkTypeMacro(ReconstructionImageFilter,
00104                ImageToImageFilter);
00105 
00111   void SetMarkerImage(const MarkerImageType *);
00112 
00113   const MarkerImageType * GetMarkerImage();
00114 
00118   void SetMaskImage(const MaskImageType *);
00119 
00120   const MaskImageType * GetMaskImage();
00121 
00128   itkSetMacro(FullyConnected, bool);
00129   itkGetConstReferenceMacro(FullyConnected, bool);
00130   itkBooleanMacro(FullyConnected);
00132 
00138   itkSetMacro(UseInternalCopy, bool);
00139   itkGetConstReferenceMacro(UseInternalCopy, bool);
00140   itkBooleanMacro(UseInternalCopy);
00141 protected:
00142   ReconstructionImageFilter();
00143   ~ReconstructionImageFilter() {}
00144   void PrintSelf(std::ostream & os, Indent indent) const;
00146 
00150   void GenerateInputRequestedRegion();
00151 
00153   void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00154 
00155   void GenerateData();
00156 
00160   typename TInputImage::PixelType m_MarkerValue;
00161 private:
00162   ReconstructionImageFilter(const Self &); //purposely not implemented
00163   void operator=(const Self &);            //purposely not implemented
00165 
00166   bool m_FullyConnected;
00167   bool m_UseInternalCopy;
00168 
00169   typedef typename itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< OutputImageType > FaceCalculatorType;
00170 
00171   typedef typename FaceCalculatorType::FaceListType           FaceListType;
00172   typedef typename FaceCalculatorType::FaceListType::iterator FaceListTypeIt;
00173 
00174   typedef ImageRegionConstIterator< InputImageType > InputIteratorType;
00175   typedef ImageRegionIterator< OutputImageType >     OutputIteratorType;
00176 
00177   typedef typename OutputImageType::IndexType               OutIndexType;
00178   typedef typename InputImageType::IndexType                InIndexType;
00179   typedef ConstShapedNeighborhoodIterator< InputImageType > CNInputIterator;
00180   typedef ShapedNeighborhoodIterator< OutputImageType >     NOutputIterator;
00181 }; // end of class
00182 } // end namespace itk
00183 
00184 #ifndef ITK_MANUAL_INSTANTIATION
00185 #include "itkReconstructionImageFilter.hxx"
00186 #endif
00187 
00188 #endif
00189