[641] | 1 | // ----------------------------------------------------------------------- |
---|
| 2 | // plotImage.cc: Functions to plot 2D images |
---|
| 3 | // ----------------------------------------------------------------------- |
---|
| 4 | // Copyright (C) 2006, Matthew Whiting, ATNF |
---|
| 5 | // |
---|
| 6 | // This program is free software; you can redistribute it and/or modify it |
---|
| 7 | // under the terms of the GNU General Public License as published by the |
---|
| 8 | // Free Software Foundation; either version 2 of the License, or (at your |
---|
| 9 | // option) any later version. |
---|
| 10 | // |
---|
| 11 | // Duchamp is distributed in the hope that it will be useful, but WITHOUT |
---|
| 12 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
| 13 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
| 14 | // for more details. |
---|
| 15 | // |
---|
| 16 | // You should have received a copy of the GNU General Public License |
---|
| 17 | // along with Duchamp; if not, write to the Free Software Foundation, |
---|
| 18 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
---|
| 19 | // |
---|
| 20 | // Correspondence concerning Duchamp may be directed to: |
---|
| 21 | // Internet email: Matthew.Whiting [at] atnf.csiro.au |
---|
| 22 | // Postal address: Dr. Matthew Whiting |
---|
| 23 | // Australia Telescope National Facility, CSIRO |
---|
| 24 | // PO Box 76 |
---|
| 25 | // Epping NSW 1710 |
---|
| 26 | // AUSTRALIA |
---|
| 27 | // ----------------------------------------------------------------------- |
---|
| 28 | #include <iostream> |
---|
| 29 | #include <math.h> |
---|
| 30 | #include <cpgplot.h> |
---|
| 31 | #include <duchamp/param.hh> |
---|
| 32 | #include <duchamp/Utils/utils.hh> |
---|
| 33 | |
---|
| 34 | void plotImage(float *array, int xdim, int ydim) |
---|
| 35 | { |
---|
| 36 | const float tr[6] = {0.,1.,0.,0.,0.,1.}; |
---|
| 37 | |
---|
| 38 | cpgenv(0.5,xdim+0.5,0.5,ydim+0.5,0,0); |
---|
| 39 | float z1,z2; |
---|
| 40 | zscale(xdim*ydim,array,z1,z2); |
---|
| 41 | cpggray(array,xdim,ydim,1,xdim,1,ydim,z1,z2,tr); |
---|
| 42 | cpgbox("bcstn",0,0,"bc",0,0); |
---|
| 43 | cpgwedg("rg",1,2,z1,z2,""); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | void plotImage(float *array, int xdim, int ydim, duchamp::Param par) |
---|
| 47 | { |
---|
| 48 | const float tr[6] = {0.,1.,0.,0.,0.,1.}; |
---|
| 49 | |
---|
| 50 | cpgenv(0.5,xdim+0.5,0.5,ydim+0.5,0,0); |
---|
| 51 | float z1,z2; |
---|
| 52 | zscale(xdim*ydim,array,z1,z2,par.getBlankPixVal()); |
---|
| 53 | cpggray(array,xdim,ydim,1,xdim,1,ydim,z1,z2,tr); |
---|
| 54 | cpgbox("bcstn",0,0,"bc",0,0); |
---|
| 55 | cpgwedg("rg",1,2,z1,z2,""); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | void plotImage(float *array, int xdim, int ydim, float z1, float z2) |
---|
| 59 | { |
---|
| 60 | const float tr[6] = {0.,1.,0.,0.,0.,1.}; |
---|
| 61 | |
---|
| 62 | cpgenv(0.5,xdim+0.5,0.5,ydim+0.5,0,0); |
---|
| 63 | cpggray(array,xdim,ydim,1,xdim,1,ydim,z1,z2,tr); |
---|
| 64 | cpgbox("bc",0,0,"bc",0,0); |
---|
| 65 | cpgwedg("rg",1,2,z1,z2,""); |
---|
| 66 | } |
---|
| 67 | |
---|