#include #include #include //#include using namespace std; //void searchVelocity(Cube &cube, Detection *objectList, int &numObjects) DetectionList *searchVelocity(Cube &cube, Param &par) { DetectionList *objectList = new DetectionList; int xdim=cube.getDimX(),ydim=cube.getDimY(),zdim = cube.getDimZ(); long *dim = new long[2]; dim[0] = zdim; dim[1] = 1; ofstream fout(par.getLogFile().c_str(),ios::app); outputDetectionTextHeader(fout); // outputDetectionTextHeader(cerr); for(int npixel=0;npixelsaveArray(array,zdim); /* This was the old way of doing it */ //findSources(*spectrum,par); /* This is the new way using the atrous reconstruction */ for(int i=0;isetMaskValue(i,0); findSourcesAtrous1D(*spectrum,par); for(long zpos=0;zposgetMaskValue(zpos); if(mask>1) cerr << "**** "<saveArray(array,zdim); // set the proper positional parameters for each object for(int objCtr=0;objCtrgetNumObj();objCtr++){ Detection *obj = new Detection; *obj = spectrum->getObject(objCtr); for(int pixCtr=0;pixCtrgetSize();pixCtr++){ int zpos = obj->getX(pixCtr); int xpos = npixel%xdim; int ypos = npixel/xdim; obj->setZ(pixCtr,zpos); obj->setY(pixCtr,ypos); obj->setX(pixCtr,xpos); } obj->calcParams(); newSpectrum->addObject(*obj); delete obj; } for(long zpos=0;zposgetMaskValue(zpos); if(mask>1) cerr << "**** "<setMaskValue(zpos, mask ); } delete spectrum; spectrum = newSpectrum; delete [] array; for(int objCtr=0;objCtrgetNumObj();objCtr++){ Detection *obj = new Detection; *obj = spectrum->getObject(objCtr); outputDetectionText(fout,*obj,objectList->getSize()+1+objCtr); // outputDetectionText(cerr,*obj,objectList->getSize()+1+objCtr); delete obj; } short detect = cube.getDetectMapValue(npixel); for(int i=0;igetMaskValue(i); detect += mask; } cube.setDetectMapValue(npixel, detect); // add the newly found objects to the list for(int i=0;igetNumObj();i++) objectList->addObject(spectrum->getObject(i)); delete spectrum; } delete [] dim; fout<