aimsalgo  5.0.5
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/data/data_g.h>
17 #include <aims/resampling/motion.h>
19 #include <iostream>
20 #include <math.h>
21 
22 
23 template <class T>
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  AimsData<T> testtrans(test.dimX(), test.dimY());
31 
32 
33  int x,y;
34  ForEach2d(testtrans, x, y)
35  {
36  testtrans(x,y) = T( 195 );
37 
38  if(((_cx+c*(x-_cx)+s*(y-_cy)-p[1])<test.dimX())&&((_cx+c*(x-_cx)+s*(y-_cy)-p[1])>=0)&&((_cy-s*(x-_cx)+c*(y-_cy)-p[0])<test.dimY())&&((_cy-s*(x-_cx)+c*(y-_cy)-p[0])>=0))
39  testtrans(x,y) = test( unsigned(_cx+c*(x-_cx)+s*(y-_cy)-p[1]), unsigned(_cy-s*(x-_cx)+c*(y-_cy)-p[0]) ) ;
40  }
41 
42  return (testtrans);
43 }
44 
45 
46 #endif
47 
#define ForEach2d(thing, x, y)
int dimY() const
AimsData< T > application(const AimsData< T > &, Point3df)
int dimX() const