aimsalgo  5.0.5
Neuroimaging image processing
ghessian.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef AIMS_SIGNALFILTER_GHESSIAN_H
36 #define AIMS_SIGNALFILTER_GHESSIAN_H
37 
42 
43 
44 template< class T >
46 {
47 public:
48 
49  GaussianHessian( float sx=1.0f, float sy=1.0f, float sz=1.0f );
50  virtual ~GaussianHessian() { }
51 
53 
54 private:
55 
56  float sigx;
57  float sigy;
58  float sigz;
59 };
60 
61 
62 template< class T > inline
63 GaussianHessian< T >::GaussianHessian( float sx, float sy, float sz )
64  : sigx( sx ), sigy( sy ), sigz( sz )
65 {
66  ASSERT( sigx >= 0.1f && sigx <= 100.0f );
67  ASSERT( sigy >= 0.1f && sigy <= 100.0f );
68  ASSERT( sigz >= 0.1f && sigz <= 100.0f );
69 }
70 
71 
72 template< class T > inline AimsVector< AimsData< float >, 6 >
74 {
75  float sx = sigx / data.sizeX();
76  float sy = sigy / data.sizeY();
77  float sz = sigz / data.sizeZ();
78 
81 
82  AimsData< float> imaF;
83  imaF=AimsData<float>( data.dimX(), data.dimY(), data.dimZ(),
84  data.dimT() );
85  conv.convert( data, imaF );
86 
87  for ( int i=0; i<6; i++ )
88  res[i]=imaF.clone();
89 
90  GaussianSlices gsli;
91  GaussianLines glin;
92  GaussianColumns gcol;
93 
94  // d2 / dx2
95  glin.doit( res[ 0 ], GCoef( sx, GCoef::laplacian ) );
96  gcol.doit( res[ 0 ], GCoef( sy ) ); // because default is smoothing
97  gsli.doit( res[ 0 ], GCoef( sz ) );
98 
99  // d2 / dxdy
100  glin.doit( res[ 1 ], GCoef( sx, GCoef::gradient ) );
101  gcol.doit( res[ 1 ], GCoef( sy, GCoef::gradient ) );
102  gsli.doit( res[ 1 ], GCoef( sz ) );
103 
104  // d2 / dxdz
105  glin.doit( res[ 2 ], GCoef( sx, GCoef::gradient ) );
106  gcol.doit( res[ 2 ], GCoef( sy ) );
107  gsli.doit( res[ 2 ], GCoef( sz, GCoef::gradient ) );
108 
109  // d2 / dy2
110  glin.doit( res[ 3 ], GCoef( sx ) );
111  gcol.doit( res[ 3 ], GCoef( sy, GCoef::laplacian ) );
112  gsli.doit( res[ 3 ], GCoef( sz ) );
113 
114  // d2 / dydz
115  glin.doit( res[ 4 ], GCoef( sx ) );
116  gcol.doit( res[ 4 ], GCoef( sy, GCoef::gradient ) );
117  gsli.doit( res[ 4 ], GCoef( sz, GCoef::gradient ) );
118 
119  // d2 / dz2
120  glin.doit( res[ 5 ], GCoef( sx ) );
121  gcol.doit( res[ 5 ], GCoef( sy ) );
122  gsli.doit( res[ 5 ], GCoef( sz, GCoef::laplacian ) );
123 
124  return res;
125 }
126 
127 #endif
void doit(AimsData< float > &)
AimsVector< AimsData< float >, 6 > doit(const AimsData< T > &)
Definition: ghessian.h:73
int dimZ() const
float sizeZ() const
int dimY() const
virtual void convert(const INP &in, OUTP &out) const
void doit(AimsData< float > &)
GaussianHessian(float sx=1.0f, float sy=1.0f, float sz=1.0f)
Definition: ghessian.h:63
float sizeX() const
Definition: gcoef.h:41
virtual ~GaussianHessian()
Definition: ghessian.h:50
AimsData< float > clone() const
void doit(AimsData< float > &)
float sizeY() const
int dimT() const
#define ASSERT(EX)
int dimX() const