#include #include #include //#include #include using namespace std; DetectionList *searchSpatially(Cube &cube, Param &par) { DetectionList *objectList = new DetectionList; long xdim = cube.getDimX(); long ydim = cube.getDimY(); long zdim = cube.getDimZ(); long *dim = new long[2]; dim[0] = xdim; dim[1] = ydim; bool flagMW = par.getFlagMW(); int minMW=zdim,maxMW=zdim; if(flagMW){ minMW = par.getMinMW(); maxMW = par.getMaxMW(); } ofstream fout(par.getLogFile().c_str(),ios::app); outputDetectionTextHeader(fout); // outputDetectionTextHeader(cerr); for(long numChannel=0;numChannelmaxMW)){ Image *slice = new Image(dim); // for(long j=0;jgetSize();j++){ float *array = new float[xdim*ydim]; for(int pos=0; possaveArray(array,xdim*ydim); /* This was the old way of doing it */ //findSources(*slice,par); /* This is the new way using the atrous reconstruction */ findSourcesAtrous2D(*slice,par); Image *newslice = new Image(dim); newslice->saveArray(array,xdim*ydim); for(int i=0;igetNumObj();i++){ Detection *thisobj = new Detection; *thisobj = slice->getObject(i); for(int j=0;jgetObject(i).getSize();j++){ // slice->getObject(i).setZ(j,numChannel); thisobj->setZ(j,numChannel); } thisobj->calcParams(); newslice->addObject(*thisobj); delete thisobj; } for(int pos=0; posgetMaskValue(pos); newslice->setMaskValue(pos,mask); } delete slice; slice = newslice; delete [] array; for(int i=0;igetNumObj();i++) { Detection *thisobj = new Detection; *thisobj = slice->getObject(i); outputDetectionText(fout,*thisobj,objectList->getSize()+1+i); // outputDetectionText(cerr,*thisobj,objectList->getSize()+1+i); delete thisobj; } for(int i=0;igetSize();i++){ short detect = cube.getDetectMapValue(i); detect += slice->getMaskValue(i); cube.setDetectMapValue(i, detect); } // add the newly found objects to the list for(int i=0;igetNumObj();i++) objectList->addObject(slice->getObject(i)); delete slice; } } fout<