main.cpp
1.72 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <fstream>
#include <cuda_runtime.h>
#include <stim/math/vector.h>
#include <stim/parser/arguments.h>
#include <stim/parser/filename.h>
#include <stim/grids/image_stack.h>
#include <stim/grids/grid.h>
#include <stim/visualization/colormap.h>
#define pi 3.14159
void gaussian_blur3(float* lhs, float rhs, unsigned int x, unsigned int y, unsigned int z);
int main(int argc, char** argv){
float sigma =5;
// load the imagestack from the given directory
std::string file_mask = "D:\\source\\ivote3\\data\\nissl\\*.png";
stim::image_stack<float> I;
unsigned int x =512;
unsigned int y =512;
unsigned int z =512;
unsigned int bytes = x*y*z* sizeof(float);
stim::vec<unsigned int> R(x, y, z);
I.read("D:\\source\\ivote3\\data\\nissl\\nissl-rat.vol", 512, 512, 512, 1, 12);
//float test = I.get(128, 128, 128);
//std::cout<< test<<std::endl;
float* ptr0 = I.data();
float* cpuI = (float*) malloc(512*512*512*sizeof(float));
memcpy (cpuI, ptr0, bytes);
std::ofstream outfile ("data\\original.vol");
outfile.write((char*)cpuI, 512*512*512);
gaussian_blur3(cpuI, sigma, x, y, z);
std::ofstream blurfile ("data\\Blur.vol");
blurfile.write((char*)cpuI, 512*512*512);
//int n = memcmp(cpuI, ptr0, bytes);
//std::cout << n << std::endl;
//std::cin >> n;
//multiply(cpuI, 10, x*y*z);
//int n = memcmp (cpuI, ptr0, bytes);
//std::cout << n << std::endl;
//std::fstream file2;
//file2.write((char*)cpuI, 512*512*512*sizeof(unsigned char));
//I.write("data\\volume1.raw");
//test = ptr0[128*128*128];
//std::cout<< test<<std::endl;
//std::cin>> x;
//memset(I.data(), 0, 512*512*512);
//I.write("data\\volume.raw");
//I.save_images("data\\????.bmp");
// cudaDeviceReset();
}