/tomo/pyhst

To get this branch, use:
bzr branch http://darksoft.org/webbzr/tomo/pyhst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <string.h>
#include <math.h>

extern "C" {
#include "gputomo.h"
}

main() {

	int num_x=2048;
	int num_y=2048;
	int num_proj = 1800;
	int num_bins=2048;
	float axis_position= 1024.0;
	float gpu_offset_x=0;	
	float gpu_offset_y=0;		
	
	float *SLICE = new float [  num_y* num_x ] ;
	float *WORK_perproje = new float [ num_proj*num_bins ] ;

	float * axis_position_s = new float [  num_proj      ] ; 
	float * cos_s = new float [  num_proj      ] ; 
	float * sin_s = new float [  num_proj      ] ; 

	int hpos;

	memset( WORK_perproje , 0 ,   num_proj*num_bins *sizeof(float)      );

	for(int i=0; i<num_proj; i++) {
	  axis_position_s[i] = axis_position;
	  cos_s[i] = cos( i*3.1415/num_proj    ) ;
	  sin_s[i] = sin( i*3.1415/num_proj    ) ;
	  
	  hpos = (int)( 100*cos_s[i]+axis_position);
	  WORK_perproje  [ i*num_bins +hpos] = 1.0 ;
	}

	
	gpu_main(NULL, num_y,  num_x,   SLICE,  num_proj,  num_bins, WORK_perproje , 
		  axis_position,  axis_position_s,  cos_s, sin_s , 
		  gpu_offset_x, gpu_offset_y);

	
	FILE *f=fopen("risultato2","w");
	fwrite(SLICE,2048*2048,4,f);
	fclose(f);
}