#include #include #include #include #include #include #include #include #include void Cube::CubicSearch() { /** * Cube::SimpleSearch3D() * A front end to the cubic searching routine that does not * involve any wavelet reconstruction. * If baseline-removal is required that is done prior to searching. * Once searching is complete, the detection map is updated and * the intermediate detections are logged in the log file. */ this->setCubeStats(); this->objectList = search3DArray(this->axisDim,this->array, this->par,this->Stats); this->updateDetectMap(); if(this->par.getFlagLog()) this->logDetectionList(); } vector search3DArray(long *dim, float *Array, Param &par, StatsContainer &stats) { /** * cubicSearch * Takes a dimension array and data array as input (and Parameter set) * and searches for detections in a combination of 1D and 2D searches. * Returns a vector list of Detections. * No reconstruction is assumed to have taken place, so statistics are * calculated (using robust methods) from the data array itself. */ vector outputList; long zdim = dim[2]; long xySize = dim[0] * dim[1]; int num = 0; bool *doPixel = new bool[xySize]; int goodSize=0; for(int npix=0; npix1){ if(par.isVerbose()) { std::cout << " 1D: "; bar.init(xySize); } for(int npix=0; npixsaveParam(par); spectrum->saveStats(stats); spectrum->pars().setBeamSize(2.); // beam size: for spectrum, only neighbouring channels correlated spectrum->extractSpectrum(Array,dim,npix); spectrum->removeMW(); // only works if flagMW is true spectrum->setMinSize(par.getMinChannels()); spectrum->spectrumDetect(); num += 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, npix%dim[0]); object->setY(pix, npix/dim[0]); } object->addOffsets(par); object->calcParams(); mergeIntoList(*object,outputList,par); delete object; } delete spectrum; } } // num = outputList.size(); if(par.isVerbose()) { bar.rewind(); std::cout <<"Found " << num <<";" << std::flush; } } // SECOND SEARCH -- IN EACH CHANNEL if(par.isVerbose()){ std::cout << " 2D: "; bar.init(zdim); } num = 0; for(int z=0; zsaveParam(par); channelImage->saveStats(stats); channelImage->extractImage(Array,dim,z); channelImage->setMinSize(par.getMinPix()); channelImage->lutz_detect(); num += channelImage->getNumObj(); for(int obj=0;objgetNumObj();obj++){ Detection *object = new Detection; *object = channelImage->getObject(obj); // Fix up coordinates of each pixel to match original array for(int pix=0;pixgetSize();pix++) object->setZ(pix, z); object->addOffsets(par); object->calcParams(); mergeIntoList(*object,outputList,par); delete object; } delete channelImage; } } if(par.isVerbose()){ bar.rewind(); std::cout << "Found " << num << "."; printSpace(44); std::cout << std::endl << std::flush; } delete [] doPixel; return outputList; }