cmtkPlane.h

Go to the documentation of this file.
00001 /*
00002 //
00003 //  Copyright 1997-2009 Torsten Rohlfing
00004 //
00005 //  Copyright 2004-2011 SRI International
00006 //
00007 //  This file is part of the Computational Morphometry Toolkit.
00008 //
00009 //  http://www.nitrc.org/projects/cmtk/
00010 //
00011 //  The Computational Morphometry Toolkit is free software: you can
00012 //  redistribute it and/or modify it under the terms of the GNU General Public
00013 //  License as published by the Free Software Foundation, either version 3 of
00014 //  the License, or (at your option) any later version.
00015 //
00016 //  The Computational Morphometry Toolkit is distributed in the hope that it
00017 //  will be useful, but WITHOUT ANY WARRANTY; without even the implied
00018 //  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 //  GNU General Public License for more details.
00020 //
00021 //  You should have received a copy of the GNU General Public License along
00022 //  with the Computational Morphometry Toolkit.  If not, see
00023 //  <http://www.gnu.org/licenses/>.
00024 //
00025 //  $Revision: 2752 $
00026 //
00027 //  $LastChangedDate: 2011-01-17 11:33:31 -0800 (Mon, 17 Jan 2011) $
00028 //
00029 //  $LastChangedBy: torstenrohlfing $
00030 //
00031 */
00032 
00033 #ifndef __cmtkPlane_h_included_
00034 #define __cmtkPlane_h_included_
00035 
00036 #include <cmtkconfig.h>
00037 
00038 #include <Pipeline/cmtkPipelineObject.h>
00039 
00040 #include <Base/cmtkMacros.h>
00041 #include <Base/cmtkTypes.h>
00042 #include <Base/cmtkVector3D.h>
00043 
00044 namespace
00045 cmtk
00046 {
00047 
00050 
00053 class Plane : 
00054   public PipelineObject
00055 {
00056 public:
00058   static Plane* New() { return new Plane; }
00059 
00061   igsClassParameter2Array(unsigned int,Dims);
00062 
00064   igsClassParameter2Array(Types::Coordinate,Spacing);
00065 
00067   igsClassParameter3Array(Types::Coordinate,Origin);
00068 
00070   igsClassParameter3Array(Types::Coordinate,DirectionX);
00071 
00073   igsClassParameter3Array(Types::Coordinate,DirectionY);
00074 
00079   void CopyStructure( const Plane *plane );
00080 
00082   virtual unsigned int GetNumPixels() const { return Dims[0]*Dims[1]; }
00083 
00085   void GetPixelLocation( Vector3D& v, const unsigned int x, const unsigned int y ) const 
00086   {
00087     for ( int dim = 0; dim<3; ++dim )
00088       v[dim] = Origin[dim] + x * DirectionX[dim] * Spacing[0] + y * DirectionY[dim] * Spacing[1];
00089   }
00090 
00095   void Project( Vector3D& p, const Vector3D& q ) const;
00096   
00102   void ProjectPixel( const Vector3D& v, unsigned int& i, unsigned int& j ) const;
00103   
00104 protected:
00108   Plane();
00109 
00111   virtual ~Plane() {};
00112 };
00113 
00115 
00116 } // namespace cmtk
00117 
00118 #endif // #ifndef __cmtkPlane_h_included_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines