ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkAffineGeometryFrame.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 __itkAffineGeometryFrame_h
00019 #define __itkAffineGeometryFrame_h
00020 
00021 #include "itkObject.h"
00022 #include "itkMacro.h"
00023 #include "itkScalableAffineTransform.h"
00024 #include "itkBoundingBox.h"
00025 
00026 namespace itk
00027 {
00032 template< class TScalarType = double, unsigned int NDimensions = 3 >
00033 class ITK_EXPORT AffineGeometryFrame:public Object
00034 {
00035 public:
00036   typedef AffineGeometryFrame        Self;
00037   typedef Object                     Superclass;
00038   typedef SmartPointer< Self >       Pointer;
00039   typedef SmartPointer< const Self > ConstPointer;
00040 
00041   typedef ScalableAffineTransform< TScalarType, NDimensions >     TransformType;
00042   typedef BoundingBox< IdentifierType, NDimensions, TScalarType > BoundingBoxType;
00043   typedef typename BoundingBoxType::BoundsArrayType               BoundsArrayType;
00044   typedef typename BoundingBoxType::Pointer                       BoundingBoxPointer;
00045 
00047   itkNewMacro(Self);
00048 
00050   itkTypeMacro(AffineGeometryFrame, Object);
00051 
00053   itkGetConstObjectMacro(BoundingBox, BoundingBoxType);
00054 
00055   const BoundsArrayType GetBounds() const
00056   {
00057     itkAssertInDebugAndIgnoreInReleaseMacro( m_BoundingBox.IsNotNull() );
00058     return m_BoundingBox->GetBounds();
00059   }
00060 
00064   virtual void SetBounds(const BoundsArrayType & bounds);
00065 
00067   TScalarType GetExtent(unsigned int direction) const
00068   {
00069     itkAssertInDebugAndIgnoreInReleaseMacro(direction < NDimensions);
00070     itkAssertInDebugAndIgnoreInReleaseMacro( m_BoundingBox.IsNotNull() );
00071     BoundsArrayType bounds = m_BoundingBox->GetBounds();
00072     return bounds[direction * 2 + 1] - bounds[direction * 2];
00073   }
00075 
00077   itkGetConstObjectMacro(IndexToObjectTransform, TransformType);
00078   itkGetObjectMacro(IndexToObjectTransform, TransformType);
00079   itkSetObjectMacro(IndexToObjectTransform, TransformType);
00081 
00083   itkGetConstObjectMacro(ObjectToNodeTransform, TransformType);
00084   itkGetObjectMacro(ObjectToNodeTransform, TransformType);
00085   itkSetObjectMacro(ObjectToNodeTransform, TransformType);
00087 
00089   itkGetConstObjectMacro(IndexToWorldTransform, TransformType);
00090   itkGetObjectMacro(IndexToWorldTransform, TransformType);
00091   itkSetObjectMacro(IndexToWorldTransform, TransformType);
00093 
00096   itkGetConstObjectMacro(IndexToNodeTransform, TransformType);
00097 
00099   virtual void Initialize();
00100 
00102   virtual LightObject::Pointer InternalClone() const;
00103 
00104 protected:
00105 
00106   AffineGeometryFrame();
00107   virtual ~AffineGeometryFrame();
00108   void PrintSelf(std::ostream & os, Indent indent) const;
00109 
00111   virtual void InitializeGeometry(Self *newGeometry) const;
00112 
00113   void SetBoundsArray(const BoundsArrayType & bounds,
00114                       BoundingBoxPointer & boundingBox);
00115 
00116   mutable BoundingBoxPointer m_BoundingBox;
00117 
00119   typename TransformType::Pointer m_IndexToObjectTransform;
00120   typename TransformType::Pointer m_ObjectToNodeTransform;
00121   typename TransformType::Pointer m_IndexToNodeTransform;
00122   typename TransformType::Pointer m_IndexToWorldTransform;
00123 private:
00124   AffineGeometryFrame(const Self &); //purposely not implemented
00125   void operator=(const Self &);      //purposely not implemented
00126 };
00127 } // namespace itk
00129 
00130 #ifndef ITK_MANUAL_INSTANTIATION
00131 #include "itkAffineGeometryFrame.hxx"
00132 #endif
00133 
00134 #endif /* __itkAffineGeometryFrame_h */
00135