ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkBinaryReconstructionLabelMapFilter.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 __itkBinaryReconstructionLabelMapFilter_h
00019 #define __itkBinaryReconstructionLabelMapFilter_h
00020 
00021 #include "itkInPlaceLabelMapFilter.h"
00022 #include "itkAttributeLabelObject.h"
00023 
00024 namespace itk {
00043 template<class TImage, class TMarkerImage, class TAttributeAccessor=
00044   typename Functor::AttributeLabelObjectAccessor< typename TImage::LabelObjectType > >
00045 class ITK_EXPORT BinaryReconstructionLabelMapFilter :
00046     public InPlaceLabelMapFilter<TImage>
00047 {
00048 public:
00050   typedef BinaryReconstructionLabelMapFilter Self;
00051   typedef InPlaceLabelMapFilter<TImage>      Superclass;
00052   typedef SmartPointer<Self>                 Pointer;
00053   typedef SmartPointer<const Self>           ConstPointer;
00054 
00056   typedef TImage                              ImageType;
00057   typedef typename ImageType::Pointer         ImagePointer;
00058   typedef typename ImageType::ConstPointer    ImageConstPointer;
00059   typedef typename ImageType::PixelType       PixelType;
00060   typedef typename ImageType::IndexType       IndexType;
00061   typedef typename ImageType::LabelObjectType LabelObjectType;
00062 
00063   typedef TMarkerImage                              MarkerImageType;
00064   typedef typename MarkerImageType::Pointer         MarkerImagePointer;
00065   typedef typename MarkerImageType::ConstPointer    MarkerImageConstPointer;
00066   typedef typename MarkerImageType::PixelType       MarkerImagePixelType;
00067 
00068   typedef TAttributeAccessor AttributeAccessorType;
00069 
00071   itkStaticConstMacro(ImageDimension, unsigned int,
00072                       TImage::ImageDimension);
00073 
00075   itkNewMacro(Self);
00076 
00078   itkTypeMacro(BinaryReconstructionLabelMapFilter,
00079                InPlaceLabelMapFilter);
00080 
00081 #ifdef ITK_USE_CONCEPT_CHECKING
00082 
00083 /*  itkConceptMacro(InputEqualityComparableCheck,
00084     (Concept::EqualityComparable<PixelType>));
00085   itkConceptMacro(IntConvertibleToInputCheck,
00086     (Concept::Convertible<int, PixelType>));
00087   itkConceptMacro(InputOStreamWritableCheck,
00088     (Concept::OStreamWritable<PixelType>));*/
00089 
00091 #endif
00092 
00094   void SetMarkerImage(TMarkerImage *input)
00095     {
00096     // Process object is not const-correct so the const casting is required.
00097     this->SetNthInput( 1, const_cast<TMarkerImage *>(input) );
00098     }
00099 
00101   MarkerImageType * GetMarkerImage()
00102     {
00103     return static_cast<MarkerImageType*>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
00104     }
00105 
00107   void SetInput1(TImage *input)
00108     {
00109     this->SetInput( input );
00110     }
00111 
00113   void SetInput2(TMarkerImage *input)
00114     {
00115     this->SetMarkerImage( input );
00116     }
00117 
00122   itkSetMacro(ForegroundValue, MarkerImagePixelType);
00123   itkGetConstMacro(ForegroundValue, MarkerImagePixelType);
00125 
00126 protected:
00127   BinaryReconstructionLabelMapFilter();
00128   ~BinaryReconstructionLabelMapFilter() {};
00129 
00130   virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject );
00131 
00132   void PrintSelf(std::ostream& os, Indent indent) const;
00133 
00134 private:
00135   BinaryReconstructionLabelMapFilter(const Self&); //purposely not implemented
00136   void operator=(const Self&); //purposely not implemented
00137 
00138   MarkerImagePixelType m_ForegroundValue;
00139 
00140 }; // end of class
00141 
00142 } // end namespace itk
00143 
00144 #ifndef ITK_MANUAL_INSTANTIATION
00145 #include "itkBinaryReconstructionLabelMapFilter.hxx"
00146 #endif
00147 
00148 #endif
00149