#include #include #include #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 #include #include #include #include #include #include string imageType[4] = {"point", "spectrum", "image", "cube"}; vector readAndSearch(Param &par) { vector outputList; short int maxdim=3; long *dimAxes = new long[maxdim]; for(int i=0;i1) std::cout << "x" << dimAxes[1]; if(numAxes>2) std::cout << "x" << dimAxes[2]; std::cout << std::endl; int anynul; long *fpixel = new long[numAxes]; long *lpixel = new long[numAxes]; long *inc = new long[numAxes]; // the data-sampling increment for(int i=0;isaveParam(par); spectrum->pars().setBeamSize(2.); // only neighbouring channels correlated for(int y=0;yclearDetectionList(); if(par.getFlagATrous()){ float *recon = new float[dimAxes[2]]; atrous1DReconstruct(dimAxes[2],array,recon,par); float *resid = new float[dimAxes[2]]; for(int i=0;isaveArray(recon,dimAxes[2]); delete [] recon, resid; spectrum->removeMW(); // only works if flagMW is true spectrum->setStats(median,sigma,par.getCut()); if(par.getFlagFDR()) spectrum->setupFDR(); spectrum->setMinSize(par.getMinChannels()); spectrum->spectrumDetect(); } else{ sigma = findMADFM(array,dimAxes[2])/correctionFactor; spectrum->saveArray(array,dimAxes[2]); spectrum->removeMW(); // only works if flagMW is true spectrum->setStats(median,sigma,par.getCut()); if(par.getFlagFDR()) spectrum->setupFDR(); spectrum->setMinSize(par.getMinChannels()); spectrum->spectrumDetect(); } numDetected += spectrum->getNumObj(); for(int obj=0;objgetNumObj();obj++){ Detection *object = new Detection; *object = spectrum->getObject(obj); for(int pix=0;pixgetSize();pix++) { // Fix up coordinates of each pixel to match original array object->setZ(pix, object->getX(pix)); object->setX(pix, x); object->setY(pix, y); object->setF(pix, array[object->getZ(pix)]); // NB: set F to the original value, not the recon value. } object->addOffsets(par); object->calcParams(); mergeIntoList(*object,outputList,par); delete object; } } // end of loop over y printBackSpace(6); std::cout << std::flush; } // end of loop over x delete spectrum; delete [] bigarray, array, fpixel, lpixel, inc, dimAxes, specdim; return outputList; }