I want to fill a 2D image along its polar radius, the data are stored in a image where each row or column corresponds to the radius in target image. How can I fill the target image efficiently? Such as with iradius or some functions? I do not prefer a pix-pix operation.
Are you looking for something like this?
number maxR = 100
image rValues := realimage("I(r)",4,maxR)
rValues = 10 + trunc(100*random())
image plot :=realimage("Ring",4,2*maxR,2*maxR)
rValues.ShowImage()
plot.ShowImage()
plot = rValues.warp(iradius,0)
You might also want to check out the relevant example code from the F1 help documentation of GMS itself:
Explaining warp
a bit:
plot = rValues.warp(iradius,0)
Assigns values to plot
based on a value-lookup in rValues
.
For each pixel in plot
a coordinate position in rValues
is computed, and the value is simply looked up. If the computed coordinate is non-integer, bilinear interpolation between the 4 closest points is used.
In the example, the two 'formulas' for the coordinate calculation are simple x' = iradius
and y' = 0
where iradius
is an expression computed from the coordinate in plot
, for convenience.
You can feed any expression into the parameters for warp( )
and the command is closely related to just using the square bracket notation of addressing values. In fact, the only difference is that warp
performs the bilinear interpolation of values instead of truncating the coordinates to integer values.