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 __itkTransformToDisplacementFieldSource_h 00019 #define __itkTransformToDisplacementFieldSource_h 00020 00021 #include "itkTransform.h" 00022 #include "itkImageSource.h" 00023 00024 namespace itk 00025 { 00054 template< class TOutputImage, 00055 class TTransformPrecisionType = double > 00056 class ITK_EXPORT TransformToDisplacementFieldSource: 00057 public ImageSource< TOutputImage > 00058 { 00059 public: 00061 typedef TransformToDisplacementFieldSource Self; 00062 typedef ImageSource< TOutputImage > Superclass; 00063 typedef SmartPointer< Self > Pointer; 00064 typedef SmartPointer< const Self > ConstPointer; 00065 00066 typedef TOutputImage OutputImageType; 00067 typedef typename OutputImageType::Pointer OutputImagePointer; 00068 typedef typename OutputImageType::ConstPointer OutputImageConstPointer; 00069 typedef typename OutputImageType::RegionType OutputImageRegionType; 00070 00072 itkNewMacro(Self); 00073 00075 itkTypeMacro(TransformToDisplacementFieldSource, ImageSource); 00076 00078 itkStaticConstMacro(ImageDimension, unsigned int, 00079 TOutputImage::ImageDimension); 00080 00082 typedef Transform< TTransformPrecisionType, 00083 itkGetStaticConstMacro(ImageDimension), 00084 itkGetStaticConstMacro(ImageDimension) > TransformType; 00085 typedef typename TransformType::ConstPointer TransformPointerType; 00087 00089 typedef typename OutputImageType::PixelType PixelType; 00090 typedef typename PixelType::ValueType PixelValueType; 00091 typedef typename OutputImageType::RegionType RegionType; 00092 typedef typename RegionType::SizeType SizeType; 00093 typedef typename OutputImageType::IndexType IndexType; 00094 typedef typename OutputImageType::PointType PointType; 00095 typedef typename OutputImageType::SpacingType SpacingType; 00096 typedef typename OutputImageType::PointType OriginType; 00097 typedef typename OutputImageType::DirectionType DirectionType; 00098 00100 typedef ImageBase< itkGetStaticConstMacro(ImageDimension) > ImageBaseType; 00101 00109 itkSetConstObjectMacro(Transform, TransformType); 00110 00112 itkGetConstObjectMacro(Transform, TransformType); 00113 00115 virtual void SetOutputSize(const SizeType & size); 00116 00118 virtual const SizeType & GetOutputSize(); 00119 00122 virtual void SetOutputIndex(const IndexType & index); 00123 00125 virtual const IndexType & GetOutputIndex(); 00126 00128 itkSetMacro(OutputRegion, OutputImageRegionType); 00129 00131 itkGetConstReferenceMacro(OutputRegion, OutputImageRegionType); 00132 00134 itkSetMacro(OutputSpacing, SpacingType); 00135 virtual void SetOutputSpacing(const double *values); 00137 00139 itkGetConstReferenceMacro(OutputSpacing, SpacingType); 00140 00142 itkSetMacro(OutputOrigin, OriginType); 00143 virtual void SetOutputOrigin(const double *values); 00145 00147 itkGetConstReferenceMacro(OutputOrigin, OriginType); 00148 00150 itkSetMacro(OutputDirection, DirectionType); 00151 itkGetConstReferenceMacro(OutputDirection, DirectionType); 00153 00155 void SetOutputParametersFromImage(const ImageBaseType *image); 00156 00158 virtual void GenerateOutputInformation(void); 00159 00161 virtual void BeforeThreadedGenerateData(void); 00162 00164 unsigned long GetMTime(void) const; 00165 00166 #ifdef ITK_USE_CONCEPT_CHECKING 00167 00168 itkStaticConstMacro(PixelDimension, unsigned int, 00169 PixelType::Dimension); 00170 itkConceptMacro( SameDimensionCheck, 00171 ( Concept::SameDimension< ImageDimension, PixelDimension > ) ); 00172 00174 #endif 00175 protected: 00176 TransformToDisplacementFieldSource(void); 00177 ~TransformToDisplacementFieldSource(void) {} 00178 00179 void PrintSelf(std::ostream & os, Indent indent) const; 00180 00184 void ThreadedGenerateData( 00185 const OutputImageRegionType & outputRegionForThread, 00186 ThreadIdType threadId); 00187 00191 void NonlinearThreadedGenerateData( 00192 const OutputImageRegionType & outputRegionForThread, 00193 ThreadIdType threadId); 00194 00198 void LinearThreadedGenerateData( 00199 const OutputImageRegionType & outputRegionForThread, 00200 ThreadIdType threadId); 00201 00202 private: 00203 00204 TransformToDisplacementFieldSource(const Self &); //purposely not implemented 00205 void operator=(const Self &); //purposely not implemented 00206 00208 RegionType m_OutputRegion; // region of the output image 00209 TransformPointerType m_Transform; // Coordinate transform to use 00210 SpacingType m_OutputSpacing; // output image spacing 00211 OriginType m_OutputOrigin; // output image origin 00212 DirectionType m_OutputDirection; // output image direction cosines 00213 }; // end class 00214 // TransformToDisplacementFieldSource 00215 } // end namespace itk 00216 00217 #ifndef ITK_MANUAL_INSTANTIATION 00218 #include "itkTransformToDisplacementFieldSource.hxx" 00219 #endif 00220 00221 #endif // end #ifndef __itkTransformToDisplacementFieldSource_h 00222