ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkChangeLabelLabelMapFilter.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 __itkChangeLabelLabelMapFilter_h
00019 #define __itkChangeLabelLabelMapFilter_h
00020 
00021 #include "itkInPlaceLabelMapFilter.h"
00022 #include <map>
00023 
00024 namespace itk
00025 {
00043 template< class TImage >
00044 class ITK_EXPORT ChangeLabelLabelMapFilter:
00045   public InPlaceLabelMapFilter< TImage >
00046 {
00047 public:
00049   typedef ChangeLabelLabelMapFilter       Self;
00050   typedef InPlaceLabelMapFilter< TImage > Superclass;
00051   typedef SmartPointer< Self >            Pointer;
00052   typedef SmartPointer< const Self >      ConstPointer;
00053 
00055   typedef TImage                              ImageType;
00056   typedef typename ImageType::Pointer         ImagePointer;
00057   typedef typename ImageType::ConstPointer    ImageConstPointer;
00058   typedef typename ImageType::PixelType       PixelType;
00059   typedef typename ImageType::IndexType       IndexType;
00060   typedef typename ImageType::LabelObjectType LabelObjectType;
00061 
00063   itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
00064 
00066   itkNewMacro(Self);
00067 
00069   itkTypeMacro(ChangeLabelLabelMapFilter, InPlaceLabelMapFilter);
00070 
00071   typedef typename std::map< PixelType, PixelType > ChangeMapType;
00072   typedef typename ChangeMapType::const_iterator    ChangeMapIterator;
00073 
00074 #ifdef ITK_USE_CONCEPT_CHECKING
00075 
00076 /*  itkConceptMacro(InputEqualityComparableCheck,
00077     (Concept::EqualityComparable<InputImagePixelType>));
00078   itkConceptMacro(IntConvertibleToInputCheck,
00079     (Concept::Convertible<int, InputImagePixelType>));
00080   itkConceptMacro(InputOStreamWritableCheck,
00081     (Concept::OStreamWritable<InputImagePixelType>));*/
00082 
00084 #endif
00085 
00088   void SetChangeMap(const ChangeMapType & changeMap);
00089 
00090   const ChangeMapType & GetChangeMap() const;
00091 
00092   void SetChange(const PixelType & oldLabel, const PixelType & newLabel);
00093 
00094   void ClearChangeMap();
00095 
00096 protected:
00097   ChangeLabelLabelMapFilter();
00098   ~ChangeLabelLabelMapFilter() {}
00099 
00100   void GenerateData();
00101 
00102   void PrintSelf(std::ostream & os, Indent indent) const;
00103 
00104   ChangeMapType m_MapOfLabelToBeReplaced;
00105 private:
00106   ChangeLabelLabelMapFilter(const Self &); //purposely not implemented
00107   void operator=(const Self &);            //purposely not implemented
00108 };                                         // end of class
00109 } // end namespace itk
00110 
00111 #ifndef ITK_MANUAL_INSTANTIATION
00112 #include "itkChangeLabelLabelMapFilter.hxx"
00113 #endif
00114 
00115 #endif
00116