aimsalgo 6.0.0
Neuroimaging image processing
transformation_d.h
Go to the documentation of this file.
1/* Copyright (C) 2000-2013 CEA
2 *
3 * This software and supporting documentation were developed by
4 * bioPICSEL
5 * CEA/DSV/I²BM/MIRCen/LMN, Batiment 61,
6 * 18, route du Panorama
7 * 92265 Fontenay-aux-Roses
8 * France
9 */
10
11
12#ifndef AIMS_REGISTRATION_TRANSFORMATION_D_H
13#define AIMS_REGISTRATION_TRANSFORMATION_D_H
14
15
16#include <aims/transformation/affinetransformation3d.h>
18#include <iostream>
19#include <math.h>
20
21
22template <class T>
24 const carto::rc_ptr<carto::Volume<T> > & test, Point3df p )
25{
26
27 float angle_rad = p[2] /180.0 * M_PI;
28 float c = cos( angle_rad );
29 float s = sin( angle_rad );
30 carto::VolumeRef<T> testtrans( test->getSizeX(), test->getSizeY() );
31
32 int x,y, nx = testtrans->getSizeX(), ny = testtrans->getSizeY();
33
34 for( y=0; y<ny; ++y )
35 for( x=0; x<nx; ++x )
36 {
37 testtrans(x,y) = T( 195 );
38
39 if( ((_cx + c*(x-_cx) + s*(y-_cy) - p[1]) < nx)
40 && ((_cx + c*(x-_cx) + s*(y-_cy) - p[1]) >= 0)
41 && ((_cy - s*(x-_cx) + c*(y-_cy) - p[0]) < ny)
42 && ((_cy - s*(x-_cx) + c*(y-_cy) - p[0]) >= 0) )
43 testtrans(x,y) = test->at(
44 unsigned( _cx + c*(x-_cx) + s*(y-_cy) - p[1]),
45 unsigned( _cy - s*(x-_cx) + c*(y-_cy)-p[0]) ) ;
46 }
47
48 return testtrans;
49}
50
51
52#endif
53
carto::VolumeRef< T > application(const carto::rc_ptr< carto::Volume< T > > &, Point3df)
const T & at(long x, long y=0, long z=0, long t=0) const
int getSizeY() const
int getSizeX() const
AimsVector< float, 3 > Point3df