ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkTwoOutputExampleImageFilter.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 __itkTwoOutputExampleImageFilter_h
00019 #define __itkTwoOutputExampleImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 
00023 namespace itk
00024 {
00043 template< class TImage >
00044 class ITK_EXPORT TwoOutputExampleImageFilter:
00045   public ImageToImageFilter< TImage, TImage >
00046 {
00047 public:
00049   typedef TwoOutputExampleImageFilter          Self;
00050   typedef ImageToImageFilter< TImage, TImage > Superclass;
00051   typedef SmartPointer< Self >                 Pointer;
00052   typedef SmartPointer< const Self >           ConstPointer;
00053 
00055   itkNewMacro(Self);
00056 
00058   typedef typename TImage::PixelType PixelType;
00059 
00061   itkTypeMacro(TwoOutputExampleImageFilter, ImageToImageFilter);
00062 
00065   itkSetMacro(OutsideValue, PixelType);
00066 
00068   itkGetConstMacro(OutsideValue, PixelType);
00069 
00071   void ThresholdAbove(PixelType & thresh);
00072 
00074   void ThresholdBelow(PixelType & thresh);
00075 
00077   void ThresholdOutside(PixelType & lower, PixelType & upper);
00078 
00079   typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00080 
00082   typedef TImage                               OutputImageType;
00083   typedef typename OutputImageType::Pointer    OutputImagePointer;
00084   typedef typename OutputImageType::RegionType OutputImageRegionType;
00085   typedef typename OutputImageType::PixelType  OutputImagePixelType;
00086 
00088   OutputImagePointer GetInverseOutput()
00089   { return static_cast< TImage * >( this->ProcessObject::GetOutput(1) ); }
00090 
00092   void SetInverseOutput(OutputImageType *output)
00093   { this->SetNthOutput(1, output); }
00094 
00095 #ifdef ITK_USE_CONCEPT_CHECKING
00096 
00097   itkConceptMacro( ComparableCheck,
00098                    ( Concept::Comparable< PixelType > ) );
00099   itkConceptMacro( OStreamWritableCheck,
00100                    ( Concept::OStreamWritable< PixelType > ) );
00101 
00103 #endif
00104 protected:
00105   TwoOutputExampleImageFilter();
00106   ~TwoOutputExampleImageFilter() {}
00107   void PrintSelf(std::ostream & os, Indent indent) const;
00109 
00120   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00121                             ThreadIdType threadId);
00122 
00123 private:
00124   TwoOutputExampleImageFilter(const Self &); //purposely not implemented
00125   void operator=(const Self &);              //purposely not implemented
00126 
00127   PixelType m_OutsideValue;
00128   PixelType m_Lower;
00129   PixelType m_Upper;
00130 };
00131 } // end namespace itk
00132 
00133 #ifndef ITK_MANUAL_INSTANTIATION
00134 #include "itkTwoOutputExampleImageFilter.hxx"
00135 #endif
00136 
00137 #endif
00138