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

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

Summary:

  • Fixed the scale bar plotting for the spectral output, so that it can deal properly with very fine angular scales.
    • Improved the loop in Cube::drawScale
    • Included code in angularSeparation to deal with finely-separated positions.
  • Moved the ProgressBar? class to a new header file Utils/feedback.hh from duchamp.hh
    • Updated #include statements in many files
  • Fixed allocation bug in param copy constructor (related to offsets array).
File size: 1.8 KB
Line 
1#include <Cubes/cubes.hh>
2#include <ATrous/atrous.hh>
3#include <Utils/feedback.hh>
4#include <Utils/Hanning.hh>
5
6void Cube::SmoothCube()
7{
8  /**
9   *  Cube::SmoothCube()
10   *
11   *   A function that smooths each spectrum in the cube using the
12   *    Hanning smoothing function. The degree of smoothing is given
13   *    by the parameter hannWidth.
14   */
15
16  Hanning::Hanning hann(this->par.getHanningWidth());
17 
18  long xySize = this->axisDim[0]*this->axisDim[1];
19  long zdim = this->axisDim[2];
20
21  float *spectrum = new float[this->axisDim[2]];
22
23  ProgressBar bar;
24  std::cout<<"  Smoothing... ";
25  if(par.isVerbose()) bar.init(xySize);
26
27  for(int pix=0;pix<xySize;pix++){
28
29    if( par.isVerbose() ) bar.update(pix+1);
30   
31    for(int z=0;z<zdim;z++){
32      if(this->isBlank(z*xySize+pix)) spectrum[z]=0.;
33      else spectrum[z] = this->array[z*xySize+pix];
34    }
35
36    float *smoothed = hann.smooth(spectrum,zdim);
37
38    for(int z=0;z<zdim;z++){
39      if(this->isBlank(z*xySize+pix))
40        this->recon[z*xySize+pix]=this->array[z*xySize+pix];
41      else
42        this->recon[z*xySize+pix] = smoothed[z];
43    }
44    delete [] smoothed;
45  }
46  this->reconExists = true;
47  bar.remove();
48  std::cout << "All Done.\n";
49
50  delete [] spectrum;
51
52}
53
54
55void Cube::SmoothSearch()
56{
57  /**
58   * Cube::SmoothSearch()
59   *   The Cube is first smoothed, using Cube::SmoothCube().
60   *   It is then searched, using searchReconArray.
61   *   The resulting object list is stored in the Cube, and outputted
62   *    to the log file if the user so requests.
63   */
64 
65  this->SmoothCube();
66  this->setCubeStats();
67  std::cout << "  Searching... " << std::flush;
68 
69  this->objectList = search3DArray(this->axisDim,this->recon,
70                                   this->par,this->Stats);
71
72  this->updateDetectMap();
73  if(this->par.getFlagLog()) this->logDetectionList();
74 
75
76}
Note: See TracBrowser for help on using the repository browser.