00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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 }
00244
00245 #endif // #ifndef __cmtkFilterVolume_h_included_