CPlotView:PlotImageRow
The PlotImageRow method plots the pixel values along an image row, as a function of x-axis position.
bResult = CPlotView:PlotImageRow( CImage, x1, x2, y, sTitle, sCap, bWcs ) CImage is the image to plot. x1 is the minimum x (column) number to plot, beginning at 1 x2 is the maximum x (column) number to plot, beginning at 1. y value specifies the row number, beginning at 1. sTitle is a string for the Plot window title. sCap is a string for the plot caption. bWcs is true if the plot is to use world coordinates when a calibration exists. If omitted, it defaults to false. On success, the method returns bResult = true. On failure, false is returned. |
This method creates a graph of luminance value versus column number for the specified image row. The image coordinates are specified in pixel coordinates even if the plot is to be made using world coordinates (the bUseWcs argument). The x1, x2, and y arguments specify column and row positions, indexed with the first pixel at 1. If you need to plot from an image position in world coordinates, use the WcsToXy method to convert x1, x2, or y before calling PlotImageRow.
Assume that a CImage I exists. The following script fragment plots row 300 from column 100 through column 199. World Coordinates units are not plotted, since the bWcs value is not specified:
V = CPlotView:new() |
-- create a CPlotView |
x1 = 100 ; x2 = 199 ; y = 300 |
-- define the column and rows to plot |
sTitle = "My Plot" |
-- title |
sCap = "Column Plot" |
-- caption |
V:PlotImageRow( I, x1, x2, y, sTitle, sCap ) |
-- plot the row |
Alternatively, suppose an astronomical image is the current image and that it has an equatorial form of world coordinate calibration. The following script fragment plots the image luminance at coordinate (5:20:13.54,-12:15:20.4), over 100 pixels long and aligned in the column (vertical) direction. Since this fragment plots 200 rows, the cursor's column extent is unimportant and we need only to set the number of rows (height):
V = CPlotView:new() |
-- create a CPlotView |
sT = "My Plot" |
-- title |
sC = "Column Plot" |
-- caption |
sRa = "5:20:13.54" |
-- set the center coordinate (right ascension) |
sDec = "-12:15:20.4" |
-- set the center coordinate (right ascension) |
x, y = I:WcsToXy(sRA,sDec) |
-- position the image cursor |
if ( y >= 1 and y <= I:Rows() ) then |
-- check if y inside image |
x1 = math.max(1,x-100) |
-- make x1 inside the image |
x2 = math.min(I:Cols(),x+100) |
-- make x2 inside the image |
V:PlotImageRow(I,x1,x2,y,sT,sC,true) |
-- plot the row |
end |
|