| mkpattern | noao.artdata | mkpattern |
mkpattern - Make/add patterns in images
mkpattern input
replace - Replace the image with the pattern.
add - Add the pattern to the image.
multiply - Multiply the pattern with the image values.
WHEN CREATING NEW IMAGES
This task creates or modifies images with a choice of patterns. New images are created with the specified dimensions, datatype, and pattern. Existing images may have the pattern replace, add, or multiply the pixel values. Existing images may be modified in place or new images may be created and image sections are allowed.
For new images a set of header keywords may be added by specifying an image or data file with the header parameter (see also mkheader ). If a data file is specified lines beginning with FITS keywords are entered in the image header. Leading whitespace is ignored and any lines beginning with words having lowercase and nonvalid FITS keyword characters are ignored.
This task is the simplest one for creating empty images to be used for mosaicing with imcopy and making patterns for testing display and image operators. The replace option is generally used with image sections to place constant values in regions. The multipy option is useful for making masks of the given pattern when the values are 0 and 1.
Though the patterns make sense extending to higher dimensions they are only defined in two dimensions. One dimensional images may be thought of as the first line of the two dimensional pattern. Images with dimensions greater than 2 simply repeat the two dimensional pattern into the higher dimensions. The reason for stopping at two dimensions is simplicity.
The patterns have the following precise definitions where P(i,j) is the pixel value at column i and line j, v1 and v2 are the pattern values, size is the pattern size, ncols and nlines are the number of columns and lines in the image, int is the integer function, mod is the modulus function, and sqrt is the square root function.
k = int ((i-1)/size), l = int ((j-1)/size)
ksr = int (sqrt (k)), lsr = int (sqrt (l))
slope = (v2-v1) / ((ncols+nlines-2)/size)
constant: P(i,j) = v1
grid: P(i,j) = v2 when mod(i,size)=1 or mod(j,size)=1
P(i,j) = v1 otherwise
coordinates: P(i,j) = i + j * ncols
checker: P(i,j) = v1 when mod(k,2)=0 and mod(l,2)=0
P(i,j) = v2 when mod(k,2)=1 and mod(l,2)=0
P(i,j) = v2 when mod(k,2)=0 and mod(l,2)=1
P(i,j) = v1 when mod(k,2)=1 and mod(l,2)=1
slope: P(i,j) = v1 + slope * (k + l)
square: P(i,j) = v1 when mod(ksr,2)=0 and mod(lsr,2)=0
P(i,j) = v2 when mod(ksr,2)=1 and mod(lsr,2)=0
P(i,j) = v2 when mod(ksr,2)=0 and mod(lsr,2)=1
P(i,j) = v1 when mod(ksr,2)=1 and mod(lsr,2)=1
1. Create an empty (constant value of zero) three dimensional image.
cl> mkpattern cube ndim=3 nc=100 nl=100 n3=100
2. Replace a square region of an image with the value -1000.
cl> mkpat alpha[201:250,1:50] v1=-1000
3. Put a grid pattern on an image to create a new image.
cl> mkpat dev$pix out=gridpix pat=grid op=mul v1=1 v2=0
Now allows type ushort pixel type.