#include #include #include #include #include #define WCSLIB_GETWCSTAB // define this so that we don't try and redefine // wtbarr (this is a problem when using gcc v.4+ #include #include using std::string; void addGaussian(float *array, long *dim, float *pos, float *fwhm, float norm); void write_header_info(fitsfile *fptr); int main() { srandom(37); long *dim = new long[3]; dim[0] = 100; dim[1] = 100; dim[2] = 128; int size = dim[0]*dim[1]*dim[2]; float *array = new float[size]; for(int i=0;i T min(T x1, T x2) { if(x1 T max(T x1, T x2) { if(x1>x2) return x1; else return x2; } void addGaussian(float *array, long *dim, float *pos, float *fwhm, float norm) { long size = dim[0] * dim[1] * dim[2]; float sigsig = fwhm[0]*fwhm[0] + fwhm[1]*fwhm[1] + fwhm[2]*fwhm[2]; int x1 = int(max(0.,pos[0]-10.)); int x2 = int(min(float(dim[0]),pos[0]+11)); int y1 = int(max(0.,pos[1]-10.)); int y2 = int(min(float(dim[1]),pos[1]+11)); int z1 = int(max(0.,pos[2]-10.)); int z2 = int(min(float(dim[2]),pos[2]+11)); for(int x=x1;x