source: trunk/src/Detection/spectrumDetect.cc @ 222

Last change on this file since 222 was 222, checked in by Matthew Whiting, 17 years ago

Large commit, but mostly documentation-oriented.

Only non-doc-related changes are:

  • To remove two deprecated files and any declarations of the functions in them
  • To move drawBlankEdges to the Cubes/ directory
  • Some small changes to the implementation of the StatsContainer? functions.
  • Creation of Utils/devel.hh to hide functions not used in Duchamp
  • To move the trimmedHist stats functions to their own file, again to hide them.
File size: 1.2 KB
RevLine 
[50]1#include <Cubes/cubes.hh>
[177]2#include <Detection/detection.hh>
[50]3
4enum STATUS { NONOBJECT, OBJECT };
5
6void Image::spectrumDetect()
7{
[222]8/**
9 *  A detection algorithm that searches in a single 1-D spectrum.  It
10 *  simply scans along the spectrum, storing connected sets of
11 *  detected pixels, where "detected" means according to the
12 *  Image::isDetection(long,long) function.
13 *
14 *  Upon return, the detected objects are stored in the
15 *  Image::objectList vector.
16 *
17 */
18
[50]19  STATUS status;
[136]20  Detection *obj = new Detection;
[137]21  Pixel *pix = new Pixel;
[50]22  bool isObject;
23
24  status = NONOBJECT;
25  for(int pos=0;pos<(this->axisDim[0]+1);pos++){
26
27    isObject=false;
28    if(pos<this->axisDim[0]){
[137]29      pix->setXYF(pos, 0, this->array[pos] );
[50]30      isObject = this->isDetection(pos,0);
31    }
32
33    if(isObject){
[177]34      if(status != OBJECT) status = OBJECT;
[137]35      obj->addPixel(*pix);
[50]36    }
[136]37    else{
38      if(status == OBJECT){ // if we were on an object and have left
39        if(obj->getSize() >= this->minSize){ // if it's big enough
40          obj->calcParams(); // work out midpoints, fluxes etc
41          this->addObject(*obj);  // add to list.
42        }
43        obj->clearDetection();
[50]44      }
45      status = NONOBJECT;
46    }
47
48  }
49
[177]50  // clean up and remove declared memory
[205]51  delete obj;
52  delete pix;
[50]53}
Note: See TracBrowser for help on using the repository browser.