Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1488 |
|
Package | general | |
Module | images | |
Tool | regionmanager |
box | in | The axis to concatenate along | |
Allowed: | world box region | ||
regions | in | World regions | |
Allowed: | Record containing world regions | ||
comment | in | A comment stored with the region | |
Allowed: | String |
This function (short-hand name concat) creates a region which is the concatenation along a new axis of the given world regions.
This function is similar to the extension function. The concatenation function allows you to take many world regions, and concatenate them along one axis (rather than take one region and extend it along many axes which is what function extension does).
For example, you may have generated a different polygonal region for each spectral pixel of a spectral-line cube and you wish to concatenate them together to form the overall region for use in a deconvolution application.
The axis to concatenate along is specified as a 1-dimensional world box. The shape of the 1D box must contain as many pixels (although you don't have to specify it in pixels) as there are regions to concatenate.
Because this function is most likely to be used in a script, the interface takes a record containing region tools, rather than the names of the tools themselves (there might be a lot of them).
- im := image('cube') - cs := im.coordsys() - drm.setcoordinates(cs, verbose=F) # Don't tell us each time # private coordinates used - box := drm.wbox(blc="20pix", trc="25pix", pixelaxes=[3]) - bb := im.boundingbox(box) - - rec := [=]; - local x, y; - j := 1; - for (i in bb.blc[3]:bb.trc[3]) { + # Some code in function `mypolygon' generates the + # x and y vectors for this spectral pixel, perhaps interactively + + mypolygon(x,y); + rec[j] := drm.wpolygon(x,y,[1,2]) + j +:= 1; + } - rc := drm.concat(box, rec) - - im.stats(region=rc, axes=[1,2]) Plane Freq Npts Sum Mean Rms Sigma Minimum Maximum 20 1.413724e+09 25 -4.778154e+00 -1.911262e-01 2.578399e-01 1.766359e-01 -4.252437e-01 1.820721e-01 21 1.413744e+09 40 -7.476902e+00 -2.990761e-01 3.692736e-01 2.210687e-01 -6.073643e-01 1.634156e-01 22 1.413763e+09 32 -2.696485e+00 -1.078594e-01 1.916686e-01 1.617070e-01 -3.295788e-01 1.422531e-01 23 1.413783e+09 77 4.889158e-01 1.955663e-02 3.148451e-02 2.518293e-02 -3.671944e-02 6.521463e-02 24 1.413803e+09 25 -1.337832e+00 -5.351327e-02 6.296221e-02 3.385893e-02 -1.232493e-01 1.014871e-02 25 1.413823e+09 15 1.091297e+00 4.365189e-02 7.252339e-02 5.910932e-02 -6.364560e-02 1.630955e-01
In this example, we create a 1D box and use it to concatenate 2D xy polygons along the z axis. We then ask for the statistics of each plane in the region. There is a differerent number of pixels per plane as each polygon is different.