main.cpp 1.72 KB
#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();           
}