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 | // char *status = new char[10]; |
---|
24 | // int statusLength = sizeof(status); |
---|
25 | // cpgqinf("STATE",status,&statusLength); |
---|
26 | // string stat = status; |
---|
27 | // delete [] status; |
---|
28 | // if( stat == "CLOSED" ) |
---|
29 | // duchampError("drawBlankEdges","There is no PGPlot device open!\n"); |
---|
30 | // else{ |
---|
31 | |
---|
32 | if(!cpgtest()) |
---|
33 | duchampError("drawBlankEdges","There is no PGPlot device open!\n"); |
---|
34 | else{ |
---|
35 | |
---|
36 | float xoff,x2,yoff,y2; |
---|
37 | cpgqwin(&xoff,&x2,&yoff,&y2); |
---|
38 | |
---|
39 | for(int x=0; x<xdim; x++){// for each column... |
---|
40 | for(int y=1;y<ydim;y++){ |
---|
41 | int current = y*xdim + x; |
---|
42 | int previous = (y-1)*xdim + x; |
---|
43 | if(((par.isBlank(dataArray[current]))&&!par.isBlank(dataArray[previous])) || |
---|
44 | (!par.isBlank(dataArray[current])&&par.isBlank(dataArray[previous]))){ |
---|
45 | cpgmove(x+xoff, y+yoff); |
---|
46 | cpgdraw(x+xoff+1, y+yoff); |
---|
47 | } |
---|
48 | } |
---|
49 | } |
---|
50 | |
---|
51 | for(int y=0; y<ydim; y++){// for each row... |
---|
52 | for(int x=1;x<xdim;x++){ |
---|
53 | int current = y*xdim + x; |
---|
54 | int previous = y*xdim + x-1; |
---|
55 | if(((par.isBlank(dataArray[current]))&&!par.isBlank(dataArray[previous])) || |
---|
56 | (!par.isBlank(dataArray[current])&&par.isBlank(dataArray[previous]))){ |
---|
57 | cpgmove(x+xoff, y+yoff); |
---|
58 | cpgdraw(x+xoff, y+yoff+1); |
---|
59 | } |
---|
60 | } |
---|
61 | } |
---|
62 | |
---|
63 | } |
---|
64 | |
---|
65 | |
---|
66 | } |
---|
67 | |
---|
68 | } |
---|