ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkLabelOverlayImageFilter_h 00019 #define __itkLabelOverlayImageFilter_h 00020 00021 #include "itkLabelOverlayFunctor.h" 00022 #include "itkBinaryFunctorImageFilter.h" 00023 #include "itkConceptChecking.h" 00024 00025 namespace itk 00026 { 00053 template< typename TInputImage, class TLabelImage, typename TOutputImage > 00054 class ITK_EXPORT LabelOverlayImageFilter: 00055 public 00056 BinaryFunctorImageFilter< TInputImage, TLabelImage, TOutputImage, 00057 Functor::LabelOverlayFunctor< 00058 typename TInputImage::PixelType, 00059 typename TLabelImage::PixelType, 00060 typename TOutputImage::PixelType > > 00061 { 00062 public: 00064 typedef LabelOverlayImageFilter Self; 00065 00066 typedef BinaryFunctorImageFilter< TInputImage, TLabelImage, TOutputImage, 00067 Functor::LabelOverlayFunctor< 00068 typename TInputImage::PixelType, 00069 typename TLabelImage::PixelType, 00070 typename TOutputImage::PixelType > > Superclass; 00071 00072 typedef SmartPointer< Self > Pointer; 00073 typedef SmartPointer< const Self > ConstPointer; 00074 00075 typedef TOutputImage OutputImageType; 00076 typedef TLabelImage LabelImageType; 00077 typedef TInputImage InputImageType; 00078 00079 typedef typename TOutputImage::PixelType OutputPixelType; 00080 typedef typename TLabelImage::PixelType LabelPixelType; 00081 typedef typename TInputImage::PixelType InputPixelType; 00082 00084 itkTypeMacro(LabelOverlayImageFilter, BinaryFunctorImageFilter); 00085 00087 itkNewMacro(Self); 00088 00090 void SetLabelImage(const TLabelImage *input); 00091 00093 const LabelImageType * GetLabelImage() const; 00094 00098 itkSetMacro(Opacity, double); 00099 itkGetConstReferenceMacro(Opacity, double); 00101 00103 itkSetMacro(BackgroundValue, LabelPixelType); 00104 itkGetConstReferenceMacro(BackgroundValue, LabelPixelType); 00106 00107 #ifdef ITK_USE_CONCEPT_CHECKING 00108 00109 itkConceptMacro( OutputPixelShouldHaveValueType, 00110 ( Concept::HasValueType< OutputPixelType > ) ); 00111 itkConceptMacro( OutputPixelShouldHaveBracketOperator, 00112 ( Concept::BracketOperator< 00113 OutputPixelType, 00114 unsigned int, 00115 typename OutputPixelType::ValueType > ) ); 00116 00118 #endif 00119 00121 void ResetColors(); 00122 00124 unsigned int GetNumberOfColors() const; 00125 00127 typedef typename OutputPixelType::ComponentType ComponentType; 00128 00130 void AddColor(ComponentType r, ComponentType g, ComponentType b); 00131 00132 protected: 00133 LabelOverlayImageFilter(); 00134 virtual ~LabelOverlayImageFilter() {} 00135 00137 void BeforeThreadedGenerateData(void); 00138 00140 void PrintSelf(std::ostream & os, Indent indent) const; 00141 00142 void GenerateOutputInformation(); 00143 00144 private: 00145 LabelOverlayImageFilter(const Self &); //purposely not implemented 00146 void operator=(const Self &); //purposely not implemented 00147 00148 double m_Opacity; 00149 LabelPixelType m_BackgroundValue; 00150 }; 00151 } // end namespace itk 00152 00153 #ifndef ITK_MANUAL_INSTANTIATION 00154 #include "itkLabelOverlayImageFilter.hxx" 00155 #endif 00156 00157 #endif 00158