cmtkFilterVolume.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 __cmtkFilterVolume_h_included_
00034 #define __cmtkFilterVolume_h_included_
00035 
00036 #include <cmtkconfig.h>
00037 
00038 #define COUPE_BLOCK_SIZE 27
00039 #define COUPE_BLOCK_RADIUS 1
00040 
00041 #include <Base/cmtkUniformVolume.h>
00042 #include <Base/cmtkTypedArray.h>
00043 #include <Base/cmtkUnits.h>
00044 
00045 namespace
00046 cmtk
00047 {
00048 
00051 
00053 class FilterVolume
00054 {
00055 public:
00056 
00057   typedef Types::DataItem CoupeBlock[COUPE_BLOCK_SIZE];
00058 
00069   static TypedArray::SmartPtr GaussianFilter( const UniformVolume* volume, const Units::GaussianSigma& width, const Types::Coordinate radius = 1.0, const TypedArray* maskData = NULL );
00070 
00079   static TypedArray::SmartPtr CoupeFilter
00080   ( const UniformVolume* volume, 
00081     const int windowRadius,
00082     const float beta = 0.5 );
00083 
00097   static TypedArray::SmartPtr RohlfingFilter
00098   ( const UniformVolume* volume, const TypedArray* subjectData,
00099     const TypedArray* maskData, const Units::GaussianSigma& iFilterSigma,
00100     const Units::GaussianSigma& filterWidth, const Types::Coordinate filterRadius );
00101   
00121   static TypedArray::SmartPtr StudholmeFilter
00122   ( const UniformVolume* volume, const TypedArray* subjectData,
00123     const TypedArray* averageData, const TypedArray* maskData,
00124     std::list<TypedArray::SmartPtr> imgList, const Types::DataItem binWidth,
00125     const Units::GaussianSigma& filterWidth, const Types::Coordinate filterRadius );
00126 
00148   static TypedArray::SmartPtr StudholmeFilter
00149   ( const UniformVolume* volume, 
00150     std::list<TypedArray::SmartPtr> subjectData,
00151     const TypedArray* averageData, const TypedArray* maskData,
00152     std::list<TypedArray::SmartPtr> imgList, const Types::DataItem binWidth,
00153     const Units::GaussianSigma& filterWidth, const Types::Coordinate filterRadius );
00154 private:
00158   static Types::DataItem Mean( CoupeBlock items );
00159 
00164   static Types::DataItem Variance( CoupeBlock items, const Types::DataItem mean );
00165  
00177   static void GetCoupeBlock( CoupeBlock block, const TypedArray* data, const int* dims, const int x, const int y, const int z );
00178 
00184   static double ComputeCoupeWeight
00185   ( const Types::DataItem smoothingParam,
00186     CoupeBlock centerBlock, 
00187     CoupeBlock outerBlock );
00188 
00193   static void BlockAddInPlace
00194   ( CoupeBlock v1, CoupeBlock v2 );
00195 
00201   static void BlockSubtract( CoupeBlock diff, CoupeBlock v1, CoupeBlock v2 );
00202 
00208   static void BlockConstMult( CoupeBlock prod, CoupeBlock items, const Types::DataItem mult );
00209   
00212   static double BlockSquaredDistance( CoupeBlock centerBlock, CoupeBlock outerBlock );
00213  
00229    static void ComputeNLWithinWindow
00230   ( CoupeBlock NL,
00231     const TypedArray* blockLocations,
00232     const TypedArray* data, const int* dims, const Types::DataItem smoothingParam,
00233     const int x, const int y, const int z, 
00234     const int windowRadius, 
00235     const float beta, 
00236     const TypedArray* localMeansMap, 
00237     const TypedArray* localVariancesMap, 
00238     CoupeBlock centerBlock );
00239 };
00240 
00242 
00243 } // namespace cmtk
00244 
00245 #endif // #ifndef __cmtkFilterVolume_h_included_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines