1 | #include <cpgplot.h> |
---|
2 | #include <duchamp.hh> |
---|
3 | #include <param.hh> |
---|
4 | #include <Utils/utils.hh> |
---|
5 | #include <string> |
---|
6 | |
---|
7 | void drawBlankEdges(float *dataArray, int xdim, int ydim, Param &par) |
---|
8 | { |
---|
9 | /** |
---|
10 | * drawBlankEdges(float *dataArray, int xdim, int ydim, Param &par) |
---|
11 | * |
---|
12 | * A subroutine that is designed to draw (in tasteful purple) the |
---|
13 | * edges of the blank region of the cube on a moment/detection map. |
---|
14 | * Uses the same procedure as used in the reconstruction subroutines. |
---|
15 | * Needs a pgplot device open! |
---|
16 | * INPUTS: dataArray -- the array of pixel values |
---|
17 | * xdim, ydim -- the sizes of the array in the x- and y- directions |
---|
18 | * par -- how we know what a BLANK pixel value is. |
---|
19 | */ |
---|
20 | |
---|
21 | if(par.getFlagBlankPix()){ |
---|
22 | |
---|
23 | if(!cpgtest()) |
---|
24 | duchampError("drawBlankEdges","There is no PGPlot device open!\n"); |
---|
25 | else{ |
---|
26 | |
---|
27 | float xoff,x2,yoff,y2; |
---|
28 | cpgqwin(&xoff,&x2,&yoff,&y2); |
---|
29 | |
---|
30 | bool *blank = new bool[xdim*ydim]; |
---|
31 | for(int i=0;i<xdim*ydim;i++) blank[i] = par.isBlank(dataArray[i]); |
---|
32 | |
---|
33 | for(int x=0; x<xdim; x++){// for each column... |
---|
34 | for(int y=1;y<ydim;y++){ |
---|
35 | int current = y*xdim + x; |
---|
36 | int previous = (y-1)*xdim + x; |
---|
37 | if( (blank[current]&&!blank[previous]) || |
---|
38 | (!blank[current]&&blank[previous]) ){ |
---|
39 | cpgmove(x-0.5, y-0.5); |
---|
40 | cpgdraw(x+0.5, y-0.5); |
---|
41 | } |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | for(int y=0; y<ydim; y++){// for each row... |
---|
46 | for(int x=1;x<xdim;x++){ |
---|
47 | int current = y*xdim + x; |
---|
48 | int previous = y*xdim + x-1; |
---|
49 | if( (blank[current]&&!blank[previous]) || |
---|
50 | (!blank[current]&&blank[previous]) ){ |
---|
51 | cpgmove(x-0.5, y-0.5); |
---|
52 | cpgdraw(x-0.5, y+0.5); |
---|
53 | } |
---|
54 | } |
---|
55 | } |
---|
56 | |
---|
57 | delete [] blank; |
---|
58 | |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | } |
---|
63 | |
---|
64 | } |
---|