/** * spectrumDetect.cc * * A detection algorithm that searches in a single 1-D spectrum. * * INPUTS: * image -- an Image object, containing a 1-D image that has been * processed such that its pValue array is defined. * OUTPUTS: * The detection and mask arrays in image will be filled, according to * the location of the objects in the image. * */ #include #include enum STATUS { NONOBJECT, OBJECT }; void Image::spectrumDetect() { STATUS status; vector *obj = new vector ; Pixel pix; bool isObject; status = NONOBJECT; for(int pos=0;pos<(this->axisDim[0]+1);pos++){ isObject=false; if(posaxisDim[0]){ pix.setXYF(pos, 0, this->array[pos] ); isObject = this->isDetection(pos,0); } if(isObject){ if(status != OBJECT){ status = OBJECT; obj->resize(obj->size()+1); } obj->back().addPixel(pix); } else if(obj->size()>0){ if(obj->back().getSize() >= this->minSize){ // is it big enough? obj->back().calcParams(); // work out midpoints, fluxes etc this->addObject(obj->back()); // add to list. this->maskObject(obj->back()); } obj->pop_back(); status = NONOBJECT; } } // clean up and remove declared arrays delete obj; }