aimsalgo 6.0.0
Neuroimaging image processing
gjacobian.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_GJACOBIAN_H
36#define AIMS_SIGNALFILTER_GJACOBIAN_H
37
38#include <aims/utility/converter_volume.h>
42
43
44template< class T >
46{
47public:
48
49 GaussianJacobian( float sx=1.0f, float sy=1.0f, float sz=1.0f );
50 virtual ~GaussianJacobian() { }
51
54
55private:
56
57 float sigx;
58 float sigy;
59 float sigz;
60};
61
62
63template< class T > inline
64GaussianJacobian< T >::GaussianJacobian( float sx, float sy, float sz )
65 : sigx( sx ), sigy( sy ), sigz( sz )
66{
67 ASSERT( sigx >= 0.1f && sigx <= 100.0f );
68 ASSERT( sigy >= 0.1f && sigy <= 100.0f );
69 ASSERT( sigz >= 0.1f && sigz <= 100.0f );
70}
71
72
73template< class T > inline AimsVector< carto::VolumeRef< float >, 3 >
75{
76 std::vector<float> vs = data->getVoxelSize();
77 float sx = sigx / vs[0];
78 float sy = sigy / vs[1];
79 float sz = sigz / vs[2];
80
83
85 imaF=carto::VolumeRef<float>( data->getSize() );
86 conv.convert( data, imaF );
87
88 for ( int i=0; i<3; i++ )
89 res[i]=imaF.copy();
90
91 GaussianSlices gsli;
92 GaussianLines glin;
93 GaussianColumns gcol;
94
95 // d / dx
96 glin.doit( res[ 0 ], GCoef( sx, GCoef::gradient ) );
97 gcol.doit( res[ 0 ], GCoef( sy ) ); // because default is smoothing
98 gsli.doit( res[ 0 ], GCoef( sz ) );
99
100 // d / dy
101 glin.doit( res[ 1 ], GCoef( sx ) );
102 gcol.doit( res[ 1 ], GCoef( sy, GCoef::gradient ) );
103 gsli.doit( res[ 1 ], GCoef( sz ) );
104
105 // d / dz
106 glin.doit( res[ 2 ], GCoef( sx ) );
107 gcol.doit( res[ 2 ], GCoef( sy ) );
108 gsli.doit( res[ 2 ], GCoef( sz, GCoef::gradient ) );
109
110 return res;
111}
112
113#endif
#define ASSERT(EX)
Definition gcoef.h:42
@ gradient
Definition gcoef.h:49
void doit(carto::rc_ptr< carto::Volume< float > > &)
virtual ~GaussianJacobian()
Definition gjacobian.h:50
GaussianJacobian(float sx=1.0f, float sy=1.0f, float sz=1.0f)
Definition gjacobian.h:64
AimsVector< carto::VolumeRef< float >, 3 > doit(const carto::rc_ptr< carto::Volume< T > > &)
Definition gjacobian.h:74
void doit(carto::rc_ptr< carto::Volume< float > > &)
void doit(carto::rc_ptr< carto::Volume< float > > &)
virtual void convert(const INP &in, OUTP &out) const
VolumeRef< T > copy() const