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
|
Line | |
---|
1 | #include <Cubes/cubes.hh> |
---|
2 | #include <Detection/detection.hh> |
---|
3 | |
---|
4 | enum STATUS { NONOBJECT, OBJECT }; |
---|
5 | |
---|
6 | void Image::spectrumDetect() |
---|
7 | { |
---|
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 | |
---|
19 | STATUS status; |
---|
20 | Detection *obj = new Detection; |
---|
21 | Pixel *pix = new Pixel; |
---|
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]){ |
---|
29 | pix->setXYF(pos, 0, this->array[pos] ); |
---|
30 | isObject = this->isDetection(pos,0); |
---|
31 | } |
---|
32 | |
---|
33 | if(isObject){ |
---|
34 | if(status != OBJECT) status = OBJECT; |
---|
35 | obj->addPixel(*pix); |
---|
36 | } |
---|
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(); |
---|
44 | } |
---|
45 | status = NONOBJECT; |
---|
46 | } |
---|
47 | |
---|
48 | } |
---|
49 | |
---|
50 | // clean up and remove declared memory |
---|
51 | delete obj; |
---|
52 | delete pix; |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.