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 __itkInterpolateImagePointsFilter_h 00029 #define __itkInterpolateImagePointsFilter_h 00030 00031 #include "itkBSplineInterpolateImageFunction.h" 00032 #include "itkImageToImageFilter.h" 00033 #include "itkImageRegionIterator.h" 00034 00035 namespace itk 00036 { 00076 template< class TInputImage, 00077 class TOutputImage, 00078 class TCoordType = typename TInputImage::PixelType, 00079 class InterpolatorType = BSplineInterpolateImageFunction< TInputImage, TCoordType > > 00080 class ITK_EXPORT InterpolateImagePointsFilter: 00081 public ImageToImageFilter< TInputImage, TOutputImage > 00082 { 00083 public: 00085 typedef InterpolateImagePointsFilter Self; 00086 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass; 00087 typedef SmartPointer< Self > Pointer; 00088 typedef SmartPointer< const Self > ConstPointer; 00089 00091 itkTypeMacro(InterpolateImagePointsFilter, ImageToImageFilter); 00092 00094 itkNewMacro(Self); 00095 00097 itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension); 00098 00100 typedef typename Superclass::InputImageType InputImageType; 00101 typedef typename Superclass::OutputImageType OutputImageType; 00102 typedef typename Superclass::InputImagePointer InputImagePointer; 00103 00105 typedef typename TOutputImage::Pointer OutputImagePointer; 00106 typedef ImageRegionIterator< InputImageType > OutputImageIterator; 00107 typedef typename OutputImageType::RegionType OutputImageRegionType; 00108 00110 typedef typename TOutputImage::PixelType PixelType; 00111 00113 typedef typename InterpolatorType::Pointer InterpolatorPointer; 00114 typedef typename InterpolatorType::ContinuousIndexType ContinuousIndexType; 00115 00117 typedef Image< TCoordType, itkGetStaticConstMacro(ImageDimension) > CoordImageType; 00118 00120 typedef ImageToImageFilterDetail::ImageRegionCopier< itkGetStaticConstMacro(ImageDimension), 00121 itkGetStaticConstMacro(ImageDimension) > RegionCopierType; 00122 00127 void SetInputImage(const TInputImage *inputImage); 00128 00131 void SetInterpolationCoordinate(const CoordImageType *coordinate, unsigned int setDimension); 00132 00134 itkSetMacro(DefaultPixelValue, PixelType); 00135 00137 itkGetConstMacro(DefaultPixelValue, PixelType); 00138 00140 InterpolatorPointer GetInterpolator() 00141 { return m_Interpolator; } 00142 00145 void GenerateOutputInformation(); 00146 00148 void GenerateInputRequestedRegion(); 00149 00150 #ifdef ITK_USE_CONCEPT_CHECKING 00151 00152 itkConceptMacro( InputHasNumericTraitsCheck, 00153 ( Concept::HasNumericTraits< typename TInputImage::PixelType > ) ); 00154 00156 #endif 00157 protected: 00158 InterpolateImagePointsFilter(); 00159 // ~InterpolateImagePointsFilter(){} default implemnetation ok 00160 00161 void PrintSelf(std::ostream & os, Indent indent) const; 00162 00168 void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, 00169 ThreadIdType threadId); 00170 00171 void BeforeThreadedGenerateData(); 00172 00178 virtual void VerifyInputInformation() {} 00179 00180 private: 00181 00183 typedef typename CoordImageType::Pointer CoordImageTypePointer; 00184 typedef ImageRegionConstIterator< CoordImageType > CoordImageIterator; 00185 typedef typename CoordImageType::RegionType CoordImageRegionType; 00186 00187 InterpolateImagePointsFilter(const Self &); //purposely not implemented 00188 void operator=(const Self &); //purposely not implemented 00189 00190 InterpolatorPointer m_Interpolator; 00191 PixelType m_DefaultPixelValue; // default pixel value if the 00192 // point is outside the image 00193 }; 00194 } // namespace itk 00195 00196 #ifndef ITK_MANUAL_INSTANTIATION 00197 #include "itkInterpolateImagePointsFilter.hxx" 00198 #endif 00199 00200 #endif 00201