CImage:Pos
The Pos method returns the array position corresponding to a pixel coordinate. The return value is an integral number such that the first pixel of the image has an offset of 1. Also see the inverse method, CoordOf.
nPos = CImage:Pos( tCoord[] ) where |
tCoord[] is a coordinate table containing 1-based axis positions.
nPos is the linear pixel offset into the data array. The first pixel has nOffset = 1.
The following script creates a 3-D image and then returns the offset of an element in the image array.
|
-- create a CImage 100 x 200 x 50 pixels |
|
-- get the offset at column 10, row 20, plane 40 |
|
-- result: ArrayPos = 783810 |