cmtkVolume.h

Go to the documentation of this file.
00001 /*
00002 //
00003 //  Copyright 1997-2010 Torsten Rohlfing
00004 //
00005 //  Copyright 2004-2010 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 __cmtkVolume_h_included_
00034 #define __cmtkVolume_h_included_
00035 
00036 #include <cmtkconfig.h>
00037 
00038 #include <Base/cmtkDataGrid.h>
00039 
00040 #include <Base/cmtkMacros.h>
00041 #include <Base/cmtkMathUtil.h>
00042 #include <Base/cmtkFixedVector.h>
00043 #include <Base/cmtkVector3D.h>
00044 #include <Base/cmtkAffineXform.h>
00045 #include <Base/cmtkProbeInfo.h>
00046 #include <Base/cmtkLandmarkList.h>
00047 #include <Base/cmtkAnatomicalOrientation.h>
00048 
00049 #include <System/cmtkSmartPtr.h>
00050 #include <System/cmtkThreads.h>
00051 #include <System/cmtkMemory.h>
00052 
00053 #include <algorithm>
00054 
00055 namespace
00056 cmtk
00057 {
00058 
00061 
00068 class Volume : 
00070   public DataGrid 
00071 {
00072 public:
00074   typedef Volume Self;
00075 
00077   typedef DataGrid Superclass;
00078 
00080   typedef SmartPointer<Self> SmartPtr;
00081   
00083   typedef Region<3,Types::Coordinate> CoordinateRegionType;
00084 
00086   typedef CoordinateRegionType::IndexType CoordinateVectorType;
00087 
00091   CoordinateVectorType m_Offset;
00092 
00094   void SetOffset( const Vector3D& o )
00095   {
00096     this->m_Offset = o;
00097   }
00098 
00100   LandmarkList::SmartPtr m_LandmarkList;
00101 
00108   FixedVector<3,Types::Coordinate> Size;
00109 
00111   Volume() : m_Offset( CoordinateVectorType::Init( 0.0 ) ) {}
00112 
00116   virtual ~Volume () {};
00117 
00121   virtual Types::Coordinate MinSize () const 
00122   {
00123     return std::min<Types::Coordinate>( Size[0], std::min<Types::Coordinate>( Size[1], Size[2] ) );
00124   }
00125   
00129   virtual Types::Coordinate MaxSize () const 
00130   {
00131     return std::max<Types::Coordinate>( Size[0], std::max<Types::Coordinate>( Size[1], Size[2] ) );
00132   }
00133   
00137   virtual Types::Coordinate TotalVolume () const 
00138   {
00139     return Size[0] * Size[1] * Size[2];
00140   }
00141   
00143   virtual Types::Coordinate AverageVoxelVolume () const 
00144   {
00145     return ( (Size[0]*Size[1]*Size[2]) / ((this->m_Dims[0]-1)*(this->m_Dims[1]-1)*(this->m_Dims[2]-1)) );
00146   }
00147   
00151   Vector3D GetCenter () const;
00152 
00153 protected:
00158   bool GetTrilinear ( ProbeInfo&, const int, const int, const int, const Vector3D&, const Types::Coordinate*, const Types::Coordinate* ) const;
00159 };
00160 
00162 
00163 } // namespace cmtk
00164 
00165 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines