diff --git a/stim/envi/binary.h b/stim/envi/binary.h index 62138ce..6650661 100644 --- a/stim/envi/binary.h +++ b/stim/envi/binary.h @@ -15,7 +15,7 @@ #include #endif -#ifdef CUDA_FOUND +#ifdef USE_CUDA //CUDA externs void gpu_permute(char* dest, char* src, size_t sx, size_t sy, size_t sz, size_t d0, size_t d1, size_t d2, size_t typesize); #include @@ -647,7 +647,7 @@ public: std::chrono::high_resolution_clock::time_point t0, t1; t0 = std::chrono::high_resolution_clock::now(); -#ifdef CUDA_FOUND +#ifdef USE_CUDA T* gpu_src; HANDLE_ERROR( cudaMalloc(&gpu_src, sx*sy*sz*sizeof(T)) ); HANDLE_ERROR( cudaMemcpy(gpu_src, src, sx*sy*sz*sizeof(T), cudaMemcpyHostToDevice) ); diff --git a/stim/image/image.h b/stim/image/image.h index ff155c4..b063eb9 100644 --- a/stim/image/image.h +++ b/stim/image/image.h @@ -141,7 +141,7 @@ public: //save a Netpbm file void load_netpbm(std::string filename) { - std::ifstream infile(filename, std::ios::in | std::ios::binary); //open an output file + std::ifstream infile(filename.c_str(), std::ios::in | std::ios::binary); //open an output file if (!infile) { std::cout << "Error opening input file in image::load_netpbm()" << std::endl; exit(1); @@ -244,7 +244,7 @@ public: //save a Netpbm file void save_netpbm(std::string filename) { - std::ofstream outfile(filename, std::ios::out | std::ios::binary); //open an output file + std::ofstream outfile(filename.c_str(), std::ios::out | std::ios::binary); //open an output file if(!outfile) { std::cout << "Error generating output file in image::save_netpbm()" << std::endl; exit(1); @@ -356,8 +356,8 @@ public: } /// Returns an std::vector containing each channel as a separate image - std::vector> split() const { - std::vector> r; //create an image array + std::vector< image > split() const { + std::vector< image > r; //create an image array r.resize(C()); //create images for each channel for (size_t c = 0; c < C(); c++) { //for each channel @@ -367,7 +367,7 @@ public: } /// Merge a series of single-channel images into a multi-channel image - void merge(std::vector>& list) { + void merge(std::vector< image >& list) { size_t x = list[0].width(); //calculate the size of the image size_t y = list[0].height(); allocate(x, y, list.size()); //re-allocate the image diff --git a/stim/math/filters/conv2.h b/stim/math/filters/conv2.h index 5c149ea..e34ea61 100644 --- a/stim/math/filters/conv2.h +++ b/stim/math/filters/conv2.h @@ -10,7 +10,7 @@ namespace stim { #ifdef __CUDACC__ //Kernel function that performs the 2D convolution. - template + template __global__ void kernel_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) { extern __shared__ T s[]; //declare a shared memory array size_t xi = blockIdx.x * blockDim.x + threadIdx.x; //threads correspond to indices into the output image @@ -52,7 +52,7 @@ namespace stim { //@param sy is the size of the input image along Y //@param kx is the size of the kernel along X //@param ky is the size of the kernel along Y - template + template void gpu_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) { cudaDeviceProp p; HANDLE_ERROR(cudaGetDeviceProperties(&p, 0)); @@ -77,7 +77,7 @@ namespace stim { //@param sy is the size of the input image along Y //@param kx is the size of the kernel along X //@param ky is the size of the kernel along Y - template + template void cpu_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) { size_t X = sx - kx + 1; //x size of the output image size_t Y = sy - ky + 1; //y size of the output image diff --git a/stim/math/filters/gauss2.h b/stim/math/filters/gauss2.h index b4c8520..44cae82 100644 --- a/stim/math/filters/gauss2.h +++ b/stim/math/filters/gauss2.h @@ -16,7 +16,7 @@ namespace stim { ///@param stdx is the standard deviation (in pixels) along the x axis ///@param stdy is the standard deviation (in pixels) along the y axis ///@param nstds specifies the number of standard deviations of the Gaussian that will be kept in the kernel - template + template stim::image cpu_gauss2(const stim::image& in, K stdx, K stdy, size_t nstds = 3) { size_t kx = stdx * nstds * 2; //calculate the kernel sizes size_t ky = stdy * nstds * 2; @@ -33,8 +33,8 @@ namespace stim { for (size_t yi = 0; yi < ky; yi++) gy[yi] = gauss1d((K)yi, muy, stdy); - std::vector> IN = in.split(); //split the input image into channels - std::vector> R = r.split(); //split the output image into channels + std::vector< stim::image > IN = in.split(); //split the input image into channels + std::vector< stim::image > R = r.split(); //split the output image into channels for (size_t c = 0; c < in.channels(); c++) //for each channel cpu_sepconv2(R[c].data(), IN[c].data(), gx, gy, IN[c].width(), IN[c].height(), kx, ky); diff --git a/stim/math/filters/sepconv2.h b/stim/math/filters/sepconv2.h index 90503aa..5809595 100644 --- a/stim/math/filters/sepconv2.h +++ b/stim/math/filters/sepconv2.h @@ -15,7 +15,7 @@ namespace stim { //@param sy is the size of the input image along Y //@param kx is the size of the kernel along X //@param ky is the size of the kernel along Y - template + template void gpu_sepconv2(T* out, T* in, K* k0, K* k1, size_t sx, size_t sy, size_t kx, size_t ky) { cudaDeviceProp p; HANDLE_ERROR(cudaGetDeviceProperties(&p, 0)); @@ -54,7 +54,7 @@ namespace stim { //@param sy is the size of the input image along Y //@param kx is the size of the kernel along X //@param ky is the size of the kernel along Y - template + template void cpu_sepconv2(T* out, T* in, K* k0, K* k1, size_t sx, size_t sy, size_t kx, size_t ky) { size_t X = sx - kx + 1; //x size of the output image size_t Y = sy - ky + 1; -- libgit2 0.21.4