ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkMorphologicalWatershedFromMarkersImageFilter.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 __itkMorphologicalWatershedFromMarkersImageFilter_h
00019 #define __itkMorphologicalWatershedFromMarkersImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 
00023 namespace itk
00024 {
00079 template< class TInputImage, class TLabelImage >
00080 class ITK_EXPORT MorphologicalWatershedFromMarkersImageFilter:
00081   public ImageToImageFilter< TInputImage, TLabelImage >
00082 {
00083 public:
00085   typedef MorphologicalWatershedFromMarkersImageFilter   Self;
00086   typedef ImageToImageFilter< TInputImage, TLabelImage > Superclass;
00087   typedef SmartPointer< Self >                           Pointer;
00088   typedef SmartPointer< const Self >                     ConstPointer;
00089 
00091   typedef TInputImage                           InputImageType;
00092   typedef TLabelImage                           LabelImageType;
00093   typedef typename InputImageType::Pointer      InputImagePointer;
00094   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00095   typedef typename InputImageType::RegionType   InputImageRegionType;
00096   typedef typename InputImageType::PixelType    InputImagePixelType;
00097   typedef typename LabelImageType::Pointer      LabelImagePointer;
00098   typedef typename LabelImageType::ConstPointer LabelImageConstPointer;
00099   typedef typename LabelImageType::RegionType   LabelImageRegionType;
00100   typedef typename LabelImageType::PixelType    LabelImagePixelType;
00101 
00102   typedef typename LabelImageType::IndexType IndexType;
00103 
00105   itkStaticConstMacro(ImageDimension, unsigned int,
00106                       TInputImage::ImageDimension);
00107 
00109   itkNewMacro(Self);
00110 
00112   itkTypeMacro(MorphologicalWatershedFromMarkersImageFilter,
00113                ImageToImageFilter);
00114 
00116   void SetMarkerImage(const TLabelImage *input)
00117   {
00118     // Process object is not const-correct so the const casting is required.
00119     this->SetNthInput( 1, const_cast< TLabelImage * >( input ) );
00120   }
00121 
00123   const LabelImageType * GetMarkerImage() const
00124   {
00125     return static_cast< LabelImageType * >(
00126              const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
00127   }
00128 
00130   void SetInput1(const TInputImage *input)
00131   {
00132     this->SetInput(input);
00133   }
00134 
00136   void SetInput2(const TLabelImage *input)
00137   {
00138     this->SetMarkerImage(input);
00139   }
00140 
00147   itkSetMacro(FullyConnected, bool);
00148   itkGetConstReferenceMacro(FullyConnected, bool);
00149   itkBooleanMacro(FullyConnected);
00151 
00157   itkSetMacro(MarkWatershedLine, bool);
00158   itkGetConstReferenceMacro(MarkWatershedLine, bool);
00159   itkBooleanMacro(MarkWatershedLine);
00160 protected:
00161   MorphologicalWatershedFromMarkersImageFilter();
00162   ~MorphologicalWatershedFromMarkersImageFilter() {}
00163   void PrintSelf(std::ostream & os, Indent indent) const;
00165 
00169   void GenerateInputRequestedRegion();
00170 
00174   void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00175 
00177   void GenerateData();
00178 
00179 private:
00180   //purposely not implemented
00181   MorphologicalWatershedFromMarkersImageFilter(const Self &);
00182   void operator=(const Self &); //purposely not implemented
00183 
00184   bool m_FullyConnected;
00185 
00186   bool m_MarkWatershedLine;
00187 }; // end of class
00188 } // end namespace itk
00189 
00190 #ifndef ITK_MANUAL_INSTANTIATION
00191 #include "itkMorphologicalWatershedFromMarkersImageFilter.hxx"
00192 #endif
00193 
00194 #endif
00195