source: branches/pixel-map-branch/src/Cubes/drawBlankEdges.cc

Last change on this file was 253, checked in by Matthew Whiting, 17 years ago
  • Added a mergeList(vector<Scan>) function to the PixelMap? namespace. This is usefu

l for combining lists of Scans into a set of independent ones.

  • Wrote a new spectralSelection function to deal with selection of a spectrum for development applications.
File size: 1.7 KB
Line 
1#include <cpgplot.h>
2#include <duchamp.hh>
3#include <param.hh>
4#include <Utils/mycpgplot.hh>
5#include <string>
6
7void drawBlankEdges(float *dataArray, int xdim, int ydim, Param &par)
8{
9  /**   
10   *   A subroutine that is designed to draw the edges of the blank
11   *   region of the cube on a moment/detection map. Uses the same
12   *   procedure as used in the reconstruction subroutines.
13   *
14   *   Note that it needs a PGPLOT device open. The colour used is the current
15   *    PGPLOT colour.
16   *
17   *   \param dataArray The array of pixel values
18   *   \param xdim      The size of the array in the x-direction.
19   *   \param ydim      The size of the array in the y-direction.
20   *   \param par       The Param set telling us what a BLANK pixel is.
21   */
22
23  if(par.getFlagBlankPix()){
24
25    if(!cpgtest())
26      duchampError("drawBlankEdges","There is no PGPlot device open!\n");
27    else{
28
29      float xoff,x2,yoff,y2;
30      cpgqwin(&xoff,&x2,&yoff,&y2);
31
32      bool *blank = new bool[xdim*ydim];
33      for(int i=0;i<xdim*ydim;i++) blank[i] = par.isBlank(dataArray[i]);
34
35      for(int x=0; x<xdim; x++){// for each column...
36        for(int y=1;y<ydim;y++){
37          int current = y*xdim + x;
38          int previous = (y-1)*xdim + x;
39          if( (blank[current]&&!blank[previous]) ||
40              (!blank[current]&&blank[previous])   ){
41            cpgmove(x-0.5, y-0.5);
42            cpgdraw(x+0.5, y-0.5);
43          }
44        }
45      }
46     
47      for(int y=0; y<ydim; y++){// for each row...
48        for(int x=1;x<xdim;x++){
49          int current = y*xdim + x;
50          int previous = y*xdim + x-1;
51          if( (blank[current]&&!blank[previous]) ||
52              (!blank[current]&&blank[previous])   ){
53            cpgmove(x-0.5, y-0.5);
54            cpgdraw(x-0.5, y+0.5);
55          }
56        }
57      }
58
59      delete [] blank;
60     
61    }
62
63 
64  }
65
66}
Note: See TracBrowser for help on using the repository browser.