source: trunk/src/Cubes/invertCube.cc @ 272

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

Merging pixel-map-branch revisions 236:257 back into trunk.
The use of the PixelMap? functions is sorted now, so we put everything back into a uniform location.

File size: 1.0 KB
Line 
1#include <Cubes/cubes.hh>
2#include <Detection/detection.hh>
3
4void Cube::invert()
5{
6  /**
7   *  A function that multiplies all non-Blank pixels by -1.
8   *  This is used when searching for negative features.
9   */
10  for(int i=0; i<this->numPixels; i++)
11    if(!this->isBlank(i)){
12      this->array[i] *= -1.;
13      if(this->reconExists) this->recon[i] *= -1.;
14    }
15}
16
17void Cube::reInvert()
18{
19  /**
20   *  A function that switches the array back to the original sign.
21   *  This is used when searching for negative features.
22   */
23  for(int i=0; i<this->numPixels; i++){
24    if(!this->isBlank(i)){
25      this->array[i] *= -1.;
26      if(this->reconExists) this->recon[i] *= -1.;
27    }
28  }
29
30  for(int i=0; i<this->objectList.size(); i++){
31    this->objectList[i].setNegative(true);
32    this->objectList[i].setTotalFlux(-1. * this->objectList[i].getTotalFlux() );
33    this->objectList[i].setIntegFlux(-1. * this->objectList[i].getIntegFlux() );
34    this->objectList[i].setPeakFlux(-1. * this->objectList[i].getPeakFlux() );
35  }
36
37}
Note: See TracBrowser for help on using the repository browser.