ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLandmarkDisplacementFieldSource.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 __itkLandmarkDisplacementFieldSource_h
00019 #define __itkLandmarkDisplacementFieldSource_h
00020 
00021 #include "itkImageSource.h"
00022 #include "itkKernelTransform.h"
00023 #include "itkImageRegionIteratorWithIndex.h"
00024 
00025 namespace itk
00026 {
00048 template< class TOutputImage >
00049 class ITK_EXPORT LandmarkDisplacementFieldSource:
00050   public ImageSource< TOutputImage >
00051 {
00052 public:
00054   typedef LandmarkDisplacementFieldSource Self;
00055   typedef ImageSource< TOutputImage >     Superclass;
00056   typedef SmartPointer< Self >            Pointer;
00057   typedef SmartPointer< const Self >      ConstPointer;
00058 
00059   typedef TOutputImage                         OutputImageType;
00060   typedef typename OutputImageType::Pointer    OutputImagePointer;
00061   typedef typename OutputImageType::RegionType OutputImageRegionType;
00062 
00064   itkNewMacro(Self);
00065 
00067   itkTypeMacro(LandmarkDisplacementFieldSource, ImageSource);
00068 
00070   itkStaticConstMacro(ImageDimension, unsigned int,
00071                       TOutputImage::ImageDimension);
00072 
00077   typedef KernelTransform< double, itkGetStaticConstMacro(ImageDimension) > KernelTransformType;
00078   typedef typename KernelTransformType::PointSetType                        LandmarkPointSetType;
00079   typedef typename LandmarkPointSetType::PointType                          LandmarkPointType;
00080   typedef typename KernelTransformType::Pointer                             KernelTransformPointerType;
00081   typedef typename KernelTransformType::PointsContainer                     LandmarkContainer;
00082   typedef typename LandmarkContainer::ConstPointer                          LandmarkContainerPointer;
00083 
00085   typedef typename OutputImageType::SizeType OutputSizeType;
00086 
00088   typedef typename OutputImageType::IndexType OutputIndexType;
00089 
00091   typedef typename TOutputImage::PixelType    OutputPixelType;
00092   typedef typename OutputPixelType::ValueType OutputPixelComponentType;
00093 
00095   typedef typename TOutputImage::SpacingType   SpacingType;
00096   typedef typename TOutputImage::PointType     OriginPointType;
00097   typedef typename TOutputImage::DirectionType DirectionType;
00098 
00102   itkSetObjectMacro(KernelTransform, KernelTransformType);
00103 
00105   itkGetObjectMacro(KernelTransform, KernelTransformType);
00106 
00108   itkSetMacro(OutputRegion, OutputImageRegionType);
00109 
00111   itkGetConstReferenceMacro(OutputRegion, OutputImageRegionType);
00112 
00114   itkSetMacro(OutputSpacing, SpacingType);
00115   virtual void SetOutputSpacing(const double *values);
00117 
00119   itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00120 
00122   itkSetMacro(OutputOrigin, OriginPointType);
00123   virtual void SetOutputOrigin(const double *values);
00125 
00127   itkSetMacro(OutputDirection, DirectionType);
00128   itkGetConstReferenceMacro(OutputDirection, DirectionType);
00130 
00132   itkGetConstReferenceMacro(OutputOrigin, OriginPointType);
00133 
00135   itkSetConstObjectMacro(SourceLandmarks, LandmarkContainer);
00136   itkSetConstObjectMacro(TargetLandmarks, LandmarkContainer);
00138 
00144   virtual void GenerateOutputInformation();
00145 
00147   unsigned long GetMTime(void) const;
00148 
00149 protected:
00150   LandmarkDisplacementFieldSource();
00151   ~LandmarkDisplacementFieldSource() {}
00152   void PrintSelf(std::ostream & os, Indent indent) const;
00153 
00158   void GenerateData();
00159 
00163   void PrepareKernelBaseSpline();
00164 
00165 private:
00166   LandmarkDisplacementFieldSource(const Self &); //purposely not implemented
00167   void operator=(const Self &);         //purposely not implemented
00168 
00169   KernelTransformPointerType m_KernelTransform;      // Coordinate transform to
00170                                                      // use
00171 
00172   OutputImageRegionType m_OutputRegion;              // Region of the output
00173                                                      // image
00174   SpacingType     m_OutputSpacing;                   // output image spacing
00175   OriginPointType m_OutputOrigin;                    // output image origin
00176   DirectionType   m_OutputDirection;                 // output image direction
00177                                                      // cosines
00178 
00179   LandmarkContainerPointer m_SourceLandmarks;        // List of source landmarks
00180   LandmarkContainerPointer m_TargetLandmarks;        // List of target landmarks
00181 };
00182 } // end namespace itk
00183 
00184 #ifndef ITK_MANUAL_INSTANTIATION
00185 #include "itkLandmarkDisplacementFieldSource.hxx"
00186 #endif
00187 
00188 #endif
00189