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 /*========================================================================= 00019 * 00020 * Portions of this file are subject to the VTK Toolkit Version 3 copyright. 00021 * 00022 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00023 * 00024 * For complete copyright, license and disclaimer of warranty information 00025 * please refer to the NOTICE file at the top of the ITK source tree. 00026 * 00027 *=========================================================================*/ 00028 #ifndef __itkInPlaceLabelMapFilter_h 00029 #define __itkInPlaceLabelMapFilter_h 00030 00031 #include "itkLabelMapFilter.h" 00032 00033 namespace itk 00034 { 00082 template< class TInputImage > 00083 class ITK_EXPORT InPlaceLabelMapFilter:public LabelMapFilter< TInputImage, TInputImage > 00084 { 00085 public: 00087 typedef InPlaceLabelMapFilter Self; 00088 typedef LabelMapFilter< TInputImage, TInputImage > Superclass; 00089 typedef SmartPointer< Self > Pointer; 00090 typedef SmartPointer< const Self > ConstPointer; 00091 00093 itkTypeMacro(InPlaceLabelMapFilter, LabelMapFilter); 00094 00096 itkNewMacro(Self); 00097 00099 typedef typename Superclass::OutputImageType OutputImageType; 00100 typedef typename Superclass::OutputImagePointer OutputImagePointer; 00101 typedef typename Superclass::OutputImageRegionType OutputImageRegionType; 00102 typedef typename Superclass::OutputImagePixelType OutputImagePixelType; 00103 00105 typedef TInputImage InputImageType; 00106 typedef typename InputImageType::Pointer InputImagePointer; 00107 typedef typename InputImageType::ConstPointer InputImageConstPointer; 00108 typedef typename InputImageType::RegionType InputImageRegionType; 00109 typedef typename InputImageType::PixelType InputImagePixelType; 00110 typedef typename InputImageType::LabelObjectType LabelObjectType; 00111 00112 typedef typename InputImageType::PixelType PixelType; 00113 typedef typename InputImageType::IndexType IndexType; 00114 typedef typename InputImageType::RegionType RegionType; 00115 00116 typedef TInputImage TOutputImage; 00117 00119 itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); 00120 itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); 00122 00125 itkSetMacro(InPlace, bool); 00126 itkGetMacro(InPlace, bool); 00127 itkBooleanMacro(InPlace); 00129 00136 bool CanRunInPlace() const 00137 { 00138 return true; // used to test if TInputImage == TOutputImage. But 00139 // if you look above, the superclass declaration 00140 // specifies 00141 // LabelMapFilter<TInputImage,TOutputImage> so there's 00142 // no way this couldn't be true. 00143 } 00144 00145 protected: 00146 InPlaceLabelMapFilter(); 00147 ~InPlaceLabelMapFilter(); 00148 00149 virtual void PrintSelf(std::ostream & os, Indent indent) const; 00150 00163 virtual void AllocateOutputs(); 00164 00169 virtual InputImageType * GetLabelMap() 00170 { 00171 return this->GetOutput(); 00172 } 00173 00174 private: 00175 InPlaceLabelMapFilter(const Self &); //purposely not implemented 00176 void operator=(const Self &); //purposely not implemented 00177 00178 bool m_InPlace; 00179 }; 00180 } // end namespace itk 00181 00182 #ifndef ITK_MANUAL_INSTANTIATION 00183 #include "itkInPlaceLabelMapFilter.hxx" 00184 #endif 00185 00186 #endif 00187