map.h 2.29 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
#ifndef BIOEM_MAP_H
#define BIOEM_MAP_H

#include "defs.h"
#include <complex>
#include <math.h>

class bioem_param;

class bioem_map
{
public:
13
	myfloat_t points[BIOEM_MAP_SIZE_X][BIOEM_MAP_SIZE_Y];
14
15
16
17
18
};

class bioem_RefMap
{
public:
19
20
21
22
	bioem_RefMap()
	{
		RefMapsFFT = NULL;
	}
23
24
	int readRefMaps(bioem_param& param);
	int PreCalculateMapsFFT(bioem_param& param);
25
26
27
28
29
30
31
	int  read_int(int *currlong, FILE *fin, int swap);
	int  read_float(float *currfloat, FILE *fin, int swap);
	int  read_float_empty (FILE *fin);
	int  read_char_float (float *currfloat, FILE *fin) ;
	int  test_mrc (const char *vol_file, int swap);
	int  read_MRC(const char* filename, bioem_param& param);

32
	mycomplex_t* RefMapsFFT;
33
34
35
36
37
38
39
40

	const char* filemap;
	int ntotRefMap;
	bioem_map Ref[BIOEM_MAX_MAPS];
	myfloat_t sum_RefMap[BIOEM_MAX_MAPS];
	myfloat_t sumsquare_RefMap[BIOEM_MAX_MAPS];
	myfloat_t ForLogProbfromRef[BIOEM_MAX_MAPS];

41
	bool dumpMap, loadMap, readMRC, readMultMRC;
42

43
44
45
46
47
48
49
50
	__host__ __device__ inline myfloat_t get(int map, int x, int y) const {return(Ref[map].points[x][y]);}
	__host__ __device__ inline const myfloat_t* getp(int map, int x, int y) const {return(&Ref[map].points[x][y]);}
};

class bioem_RefMap_Mod
{
public:

51
52
53
54
55
56
57
	const char* filemap;
	int ntotRefMap;
	myfloat_t Ref[BIOEM_MAP_SIZE_X][BIOEM_MAP_SIZE_Y][BIOEM_MAX_MAPS];
	myfloat_t sum_RefMap[BIOEM_MAX_MAPS];
	myfloat_t sumsquare_RefMap[BIOEM_MAX_MAPS];
	myfloat_t ForLogProbfromRef[BIOEM_MAX_MAPS];

58
	__host__ __device__ inline myfloat_t get(int map, int x, int y) const {return(Ref[x][y][map]);}
59

60
	bioem_RefMap_Mod() {ntotRefMap = 0;}
61

62
63
64
65
66
67
	bioem_RefMap_Mod(const bioem_RefMap& map)
	{
		ntotRefMap = map.ntotRefMap;
		memcpy(sum_RefMap, map.sum_RefMap, sizeof(sum_RefMap));
		memcpy(sumsquare_RefMap, map.sumsquare_RefMap, sizeof(sumsquare_RefMap));
		memcpy(ForLogProbfromRef, map.ForLogProbfromRef, sizeof(ForLogProbfromRef));
68
69
		#pragma omp parallel for
		for (int i = 0; i < ntotRefMap; i++)
70
		{
71
			for (int j = 0; j < BIOEM_MAP_SIZE_X; j++)
72
			{
73
				for (int k = 0; k < BIOEM_MAP_SIZE_Y; k++)
74
75
76
77
78
79
80
81
82
83
84
				{
					Ref[j][k][i] = map.get(i, j, k);
				}
			}
		}
	}
};

class bioem_Probability
{
public:
85
86
87
88
89
	myfloat_t forAngles[MAX_ORIENT];
	myfloat_t Total;
	myfloat_t Constoadd;
	myfloat_t ConstAngle[MAX_ORIENT];
	myfloat_t max_prob;
90
91
92
	int max_prob_cent_x, max_prob_cent_y, max_prob_orient, max_prob_conv;
};
#endif