35 #ifndef AIMS_SIGNALFILTER_CONVOL_H 36 #define AIMS_SIGNALFILTER_CONVOL_H 74 int x,
int y,
int z,
int t);
77 int x,
int y,
int z,
int t);
80 int x,
int y,
int z,
int t);
104 _sources(sources), _mask(mask) { }
108 int x,
int y,
int z,
int t);
111 int x,
int y,
int z,
int t);
119 template<
class T >
inline 137 for ( t=0; t<dt; t++ )
138 for ( z=0; z<dz; z++ )
139 for ( y=0; y<dy; y++ )
140 for ( x=0; x<dx; x++ )
143 if ( val >
max() ) val =
max();
144 else if ( val <
min() ) val =
min();
145 res( x, y, z, t ) = val;
151 template<
class T >
inline 153 int x,
int y,
int z,
int t)
158 template<
class T >
inline 162 int i, j, k, idx, idy, idz;
164 int mx = kernel.
dimX();
165 int my = kernel.
dimY();
166 int mz = kernel.
dimZ();
178 for ( k=0; k<mz; k++ )
179 for ( j=0; j<my; j++ )
180 for ( i=0; i<mx; i++ )
186 if ( idx >= 0 && idy >= 0 && idz >= 0 &&
187 idx < dx && idy < dy && idz < dz )
188 val += kernel( i, j, k ) * img( idx, idy, idz, t );
194 template<
class T >
inline 198 int i, j, k, idx, idy, idz;
200 int mx = kernel.
dimX();
201 int my = kernel.
dimY();
202 int mz = kernel.
dimZ();
210 for ( k=0; k<mz; k++ )
211 for ( j=0; j<my; j++ )
212 for ( i=0; i<mx; i++ )
218 val += kernel( i, j, k ) * img( idx, idy, idz, t );
224 template<
class T >
inline 228 if (_mask(x, y, z, t) == _sources)
return img(x, y, z, t);
232 template<
class T >
inline 236 if (_mask(x, y, z, t) == _sources)
return img(x, y, z, t);
370 #if !defined(__sun__) || !defined(_CHAR_IS_SIGNED)
virtual T doit_voxel_safe(AimsData< T > &img, AimsData< T > &kernel, int x, int y, int z, int t)
called for each voxel (safe version)
Make convolution only on a specified mask.
T(AimsConvolution::* _doit_voxel_method)(AimsData< T > &img, AimsData< T > &kernel, int x, int y, int z, int t)
virtual ~AimsMaskedConvolution()
virtual T doit_voxel_unsafe(AimsData< T > &img, AimsData< T > &kernel, int x, int y, int z, int t)
called for each voxel (unsafe version)
The template class to make convolutions.
virtual T doit_voxel_safe(AimsData< T > &img, AimsData< T > &kernel, int x, int y, int z, int t)
called for each voxel (safe version)
T doit_voxel(AimsData< T > &img, AimsData< T > &kernel, int x, int y, int z, int t)
called for each voxel (user selected function)
AimsData< short > & _mask
virtual T doit_voxel_unsafe(AimsData< T > &img, AimsData< T > &kernel, int x, int y, int z, int t)
called for each voxel (unsafe version)
AimsConvolution(bool safe=true)
void set_safe_status(bool safe=true)
AimsMaskedConvolution(AimsData< short > &mask, short sources=0, bool safe=true)
virtual ~AimsConvolution()
void setSizeXYZT(float sizex=1.0f, float sizey=1.0f, float sizez=1.0f, float sizet=1.0f)
AimsData< T > doit(AimsData< T > &, AimsData< T > &)