source: tags/release-1.0.7/src/Cubes/invertCube.cc

Last change on this file was 193, checked in by Matthew Whiting, 18 years ago

Fixes related to negative searches:

  • Recon array is now inverted if read in from file rather than calculated.
  • Threshold reported is given the appropriate sign.
  • Label on the image brightness wedge is presented better.
File size: 1.1 KB
Line 
1#include <Cubes/cubes.hh>
2#include <Detection/detection.hh>
3
4void Cube::invert()
5{
6  /**
7   *  Cube::invert()
8   *   A function that multiplies all non-Blank pixels by -1.
9   *   This is used when searching for negative features.
10   */
11  for(int i=0; i<this->numPixels; i++)
12    if(!this->isBlank(i)){
13      this->array[i] *= -1.;
14      if(this->reconExists) this->recon[i] *= -1.;
15    }
16}
17
18void Cube::reInvert()
19{
20  /**
21   *  Cube::reInvert()
22   *   A function that switches the array back to the original sign.
23   *   Any objects will have the flux of each pixel inverted as well.
24   *   This is used when searching for negative features.
25   */
26  for(int i=0; i<this->numPixels; i++){
27    if(!this->isBlank(i)){
28      this->array[i] *= -1.;
29      if(this->reconExists) this->recon[i] *= -1.;
30    }
31  }
32
33  for(int i=0; i<this->objectList.size(); i++){
34    this->objectList[i].setNegative(true);
35    for(int pix=0; pix<this->objectList[i].getSize(); pix++){
36      this->objectList[i].setF(pix, -1. * this->objectList[i].getF(pix) );
37    }
38    this->objectList[i].calcParams();
39  }
40
41}
Note: See TracBrowser for help on using the repository browser.