input_create2D

Input

create2D, which contains the following modules:
	vcustom
	vgauss
	vgbox
	vgcirc
	vgconst
	vgfractal
	vggauss
	vgpwl
	vgshot
	vgsin
	vimpulse
	vmarr
Any mention of xvimage is actually a "field 2D".  Also, the INPUTs and

Outputs

 which are mapped to avs parameters, inputs, and outputs, are for the
khoros library routine.
*********************************************************************************
Documentation for avs module vcustom
INPUT
     image          pointer to xvimage structure pointer
     rows           number of rows of image to generate
     cols           number of columns of image to generate

Type

         data type of image to generate
OUTPUT
     image          output xvimage structure.

Description

     vcustom allows the user to create a custom kernel  file  in
     the VIFF format.
     An xvimage structure pointer, image, must be  passed  in  to
     vcustom.    The  parameters  of  image_type,  row_size  and
     col_size are used to determine the  characteristics  of  the
     created kernel.
     vcustom returns a zero if failure and a one upon success.

See also

     vcustom(1), intro(3), vipl(3), verror(3), vutils(3)
RESTRICTIONS
     vcustom can only create byte, short,  int  and  float  data
     storage types.
***  vcustom will not work if avs is running in cli mode !!

Author

     Richard Krukar
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vgauss
INPUT
OUTPUT
DESCRIPTION
     vgauss generates and image that contains one or  more  Gaus-
     sian  distributions.  The bivariate mean and variance can be
     specified along with a (possibly normalized)  amplitude  and
     rotation  angle between the major and minor axes of the iso-
     contour ellipse. These parameters can be  specified  on  the
     command  line  when only a single Gaussian is desired in the
     output image.  When  multiple  Gaussians  are  desired,  the

Parameters

 are  specified  in  a  multiband image where the
     number of vectors in the image controls the number of  Gaus-
     sians to be generated.
     For the multiple Gaussian case the parameters  image  should
     contain  six  bands: 1) X peak location, 2) Y peak location,
     3) X variance, 4) Y variance, 5)  Rotation  Angle,  6)  Peak
     amplitude. All six bands must be present and be in the above
     order.
     If the normalize flag (-n) is set then the amplitude  infor-
     mation (either from the command line of the parameter image)
     is ignored, and the proper amplitude is computed so that the
     Gaussian distribution is a probability distribution.
     The rotation angle argument controls the correlation between
     the  variables in the distribution. The correleation coeffi-
     cient is the sine of this angle  (in  degrees).  This  angle
     must  lie  in  the  range  of -90 < 0 < 90. Note that +/- 90
     degrees are EXCLUDED from the range since this is  a  degen-
     erate case.
     If the parameter image is supplied then the values  it  con-
     tains,  overrides  all  other distribution parameters except
     the normalize flag.
SEE ALSO
     vgauss(1), intro(3), vipl(3), verror(3), vutils(3)
RESTRICTIONS
     The output image is of type FLOAT.
AUTHOR
     Scott Wilson
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vgbox
INPUT
     n_cols         unsigned short  number of cols (x)
     n_rows         unsigned short  number of rows (y)
     px_x_w         float           active area  pixel  width  in
                    the pixel_cell
     px_y_h         float           active area pixel  height  in
                    the pixel_cell
     px_x_of        float           active pixel offset from left
                    pixel_cell
     px_y_of        float           active pixel offset from  top
                    pixel_cell
     grey_out       unsigned char   grey level outside of  paral-
                    lelogram
     grey_in        unsigned char   grey level inside  of  paral-
                    lelogram
     im_x_w         float           parallelogram euclidian width
                    (in pixel unit)
     im_y_h         float              parallelogram    euclidian
                    height (in pixel unit)
     im_x_of        float           parallelogram: x right offset
                    (origine: parallelogram center = CCD center)
     im_y_of        float            parallelogram:  y   downward
                    offset  (origine:  parallelogram center = CCD
                    center)
     phi            float           clockwise parallelogram rota-
                    tion  (radians,  rot.  center = parallelogram
                    center)
     psi            float            first  parallelogram  corner
                    angle (radians)
OUTPUT
     pt_image_data  unsigned char   a pointer to the memory allo-
                    cated  by  the  calling  routine.   holds the
                    result of the image data generation
DESCRIPTION
     vgbox
      This procedure fills a buffer with a grey  level  represen-
     tion of a parallelogram projected on a CCD sensor.
      It calculates the grey level of each pixel from the  inter-
     section  of  the theorical parallelogram and the rectangular
     active area of each sensor-pixel.
      The sensor is made of pixels suposed to be  all  identical,
     composed  of  an  active  rectangular  area in a rectangular
     cell.
       15 parameters are to be provided:
          The buffer,
          For the sensor:
            its number of rows (=cols_size) and number of columns
            (=rows_size)
            the size of each pixel active area,
            the position of active area on the whole pixel area.
          For the parallelogram:
            X and Y sizes,
            its position (horizontal and vertical shifts),
            its rotation (in radians).
            its first corner angle (in radians).
          The grey levels of full lighted pixels  and  full  dark
     pixels.
             Return Value:   0 on success,
                             n=1 on warning,
                             n=2 on error.
             speed: about 0.5 ms /pixel on a Sun 3.
                    about 0.04 ms /pixel on a Sun 4 sparc station
     ipc.
SEE ALSO
     vgbox(1), intro(3), vipl(3), verror(3), vutils(3) vgbox(1)
RESTRICTIONS
     Pixel width + pixel offset must be egal or less than 1.000.
     The CCD cells are supposed square in  order  to  obtain  the
     asked angles, although the active area can be rectangular.
     For a parallelepipedic box, the width and  heigth  sizes  of
     the  box  are  the  euclidian distances between the parallel
     lines.
AUTHOR
     Jean-Pierre GUERIN  (CEA)
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vgcirc
INPUT
     image          input image structure
     rows           the desired number of rows in output image
     cols           the desired number of columns in output image
     type           the data storage type of the resulting image
     bgnd           the background intensity
     fgnd           the forground intensity
     x              the X coordinate of the center of the circle
     y              the Y coordinate of the center of the circle
     d              diameter of circle (in pixels)
OUTPUT
     image          holds the resulting output image.
DESCRIPTION
     vgcirc creates an image of a filled circle.  The  background
     intensity  is set by the -b argument. The foreground or cir-
     cle intensity is set by the -f argument.  The circle can  be
     placed  anywhere,  and  is  NOT  required  to lie completely
     within the image boundaries.
     The position of the center of the circle  and  its  diameter
     can  all  be  specified  as floating point numbers, allowing
     sub-pixel positioning of the circle.
SEE ALSO
     vgcirc(1), intro(3), vipl(3), verror(3), vutils(3)
RESTRICTIONS
     vgcirc will generate only BYTE or FLOAT images.
AUTHOR
     Scott Wilson
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vgconst
INPUT
     Input to vgconst :
     image          pointer to VIFF  structure  containing  image
                    data to be processed.
     rows           number of rows in output image.
     cols           number of columns in output image.
     type      Uses the data storage  type  convension  from  the
               defines  in  the  viff  header.   VFF_TYP_1_BYTE =
               char, VFF_TYP_2_BYTE  =  short,  VFF_TYP_4_BYTE  =
               int, VFF_TYP_FLOAT = float, VFF_TYP_COMPLEX = com-
               plex,     VFF_TYP_DOUBLE     =     double,     and
               VFF_TYP_DCOMPLEX = dcomplex.
     real      specifices the constant value (level) for the real
               part
     imag      specifices the constant value  for  the  imaginary
               part.
     bands     defines the number of data bands for the resulting
               image.
OUTPUT
     Output from vgconst :
     image          pointer to VIFF  structure  containing  image
                    data after processing.
     Return Value:  1 on success, 0 on failure.
DESCRIPTION
     vgconst : creates an image of dimension rows  *  columns  *
     bands.  The  image  pixel  values are constant. The user can
     specify the constant value (level).
     This routine will create multiband  images  and  works  with
     data types BIT, BYTE, SHORT, INT, FLOAT, DOUBLE and COMPLEX,
     and DCOMPLEX.
     For byte type images:
     If the level value specified by user is  greater  than  255,
     the  level  value  will  be scaled down to 255. If the level
     specified by user is less than 0, the level  value  will  by
     scaled up to 0.
     The resulting images may be of  type  byte,  short,  int  or
     float, or complex.
SEE ALSO
     vgconst(1), intro(3), vipl(3), verror(3), vutils(3)
RESTRICTIONS
     does not support transformed images.
AUTHOR
     Marcelo Teran, Ramiro Jordan, Tom Sauer
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vgfractal
INPUT
     image          xvimage structure
     maxlevel       maximum number of recursions
     hurst          desired hurst coeffient of image
     sigma          standard deviation of random numbers
     seed           seed for random number generator
     add_flag       flag to turn random additions on/off
OUTPUT
     image          output xvimage structure. Holds the resulting
                    the fractal image.
     Return Value:  1 on success, 0 on failure.
DESCRIPTION
     vgfractal creates a fractal image  with  a  desired  fractal
     dimension.   A  fractal  image is created using the midpoint
     displacement algorithm, which uses  a  recursive  generation
     technique.   Numerous types of fractal images may be created
     by varying the input parameters.
     The output image, which corresponds to the  image  argument,
     is  stored  as  data  type  FLOAT, and will be a single band
     image.  The size of the resulting image will  be  determined
     by  the  maximum number of recursions, (maxlevel).  That is,
     the resulting image will be square, with dimensions  (2^max-
     level +1) by (2^maxlevel +1).
     The input parameters include:
       (maxlevel)    maximum number of recursions,
       (hurst)       desired hurst coefficient,
       (sigma)       standard deviation of random numbers,
       (seed)        random number generator seed,
       (coast)       coastlines,
       (add_flag)    random additions.
     Descriptions on the use of these parameters follow.
     The maximum number of recursions (iterations)  is  specified
     by  the "maxlevel" recursive iteration argument.  The recur-
     sive iteration argument must be an integer ranging from 2 to
     10.   The  size  of  the image will be a power of two of the
     recursive iteration argument. That is,  it  will  create  an
     image  with  sizes  ranging from (5 by 5) to (1025 by 1025).
     The default number of recursions is 6, which will result  in
     an image of size 65 by 65 pixels.
     The hurst coefficient of the generated image may be  altered
     with  the  "hurst" argument.  This allows the user to change
     the fractal dimension of the  generated  image.   Since  the
     hurst  coefficient  is a measure of the slope of window size
     vs range in pixel values, the  valid  range  for  the  hurst
     coefficient is  0 < H < 1.
     The fractal dimension is calculated from the  hurst  coeffi-
     cient as follows:
                         D = 3 - H
        where,
                 D is the fractal dimension
                 H is the hurst coefficient.
     The  parameter  3  reflects  the   3-dimensional   Euclidian
     geometry of the system (ie. X, Y, and Z or pixel value).
     The standard deviation of  the  randomly  generated  numbers
     used  to  create  the fractal image may be altered using the
     "sigma" argument.  Increasing the  standard  deviation  will
     permit a wider range of values to be generated by the random
     number generator.  This will have the same effect as scaling
     the values that are generated.
     A "seed" may be entered to allow the same image to  be  gen-
     erated,  or  the  system  time  may  be used to set the seed
     (default).
     The coastline argument, "coast" can be toggled  on  (default
     is  off),  which  will effectively generate a "coastline" by
     setting all generated values that  fall  below  zero  to  be
     equal  to  zero.  This creates the effect of a body of water
     running up against a landform, or a "coastline".
     The random additions argument, "add_flag",  can  be  toggled
     on,  which  will  allow  random elements to be added to each
     point, whereas with random additions turned  off  (default),
     random  elements  are  added  only to the new midpoints gen-
     erated in each stage.
     Note that in order to display the image as  a  three  dimen-
     sional relief plot, the data can be plotted in Xprism3.
     Theory - The midpoint displacement algorithm constructs  the
     image  using  a recursive generation technique.  This method
     works with square lattices of points  or  pixels.   Given  a
     resolution  (w)  of  such  a lattice or grid, another square
     grid is obtained with a resolution of  w/sqrt(2)  by  adding
     the  midpoints  of  all squares.  The oreintation of the new
     lattice is rotated by 45 degrees, and adding  the  midpoints
     of  all squares yields the next lattice with a resolution of
     w/2 and the same orientation as the first.  This  is  illus-
     trated as follows:
           o   x   o            o   o   o           o x o x o
                                  x   x             x o x o x
           x   o   x    ---->   o   o   o   ---->   o x o x o
                                  x   x             x o x o x
           o   x   o            o   o   o           o x o x o
       where,      o = old points
                   x = new points
     The input parameters passed into the routine are:
       maxlevel  -    specifies the maximum number of recursions,
                      or image size. ie. 2^maxlevel.
       hurst     -    desired hurst coefficient,
       sigma     -    standard deviation of random numbers,
       seed      -    random number generator seed,
       coast     -    coastlines flag, 0 = off,  1 = on.
       add_flag  -    random additions, 0 = off, 1 = on.
SEE ALSO
     vgfractal(1), intro(3), vipl(3), verror(3), vutils(3)
RESTRICTIONS
     The resulting output image will be of type FLOAT.
AUTHOR
     Charlie Gage
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vggauss
INPUT
     image          pointer to VIFF  structure  containing  image
                    data to be processed.
     rows           number of rows in image
     cols           number of columns in image
     bands          number of data bands in image
     mean           mean of Gaussian data
     variance       variance of Gaussian data
     type           data type of resulting image.  Must be either
                    VFF_TYP_FLOAT or VFF_TYP_COMPLEX
     doadd          flag to indicate if data is to  be  added  to
                    the  input  image.  If this flag is set, then
                    add the noise to the data that currently sits
                    in image.
OUTPUT
     image          pointer to VIFF  structure  containing  image
                    data after processing.
     Return Value:  1 on success, 0 on failure.
DESCRIPTION
     creates a two dimensional multi-band Gaussian (noise)  image
     of  dimension  rows  * columns or adds noise to the optional
     input image. The Gaussian image is generated using the  Box-
     Muller transformation.
SEE ALSO
     vggauss(1), intro(3), vipl(3), verror(3), vutils(3)
RESTRICTIONS
     can only generate  VFF_TYP_FLOAT  and  VFF_TYP_COMPLEX  type
     images.
AUTHOR
     Ramiro Jordan, Jeremy Worley
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vgpwl
INPUT
     image          resulting image.
     rows           number of rows in image
     cols           number of columns in image
     fs             sampling frequency
     minimum        minimum value of function
     maximum        maximum value of function
     xperiod        X period of the function in seconds
     yperiod        Y period of the function in seconds
     xrise          X rise time in seconds
     yrise          Y rise time in seconds
     xfall          X fall time in seconds
     yfall          Y fall time in seconds
     xwidth         X width of pulse
     ywidth         Y width of pulse
     type           data type of  output  image.   This  must  be
                    either VFF_TYP_FLOAT or VFF_TYP_COMPLEX.
OUTPUT
     image          holds the result of the data generation.
     return Value:  1 on success, 0 on failure.
DESCRIPTION
     creates a two dimensional piecewise linear image.  The image
     pixel  values follow a square waveform. The user can specify
     the period, phase, minima and  maxima,  sampling  frequency,
     rise and fall times, and image dimensions.
     NOTE: According to the Sampling Theorem, the  sampling  fre-
     quency should be at least twice that of the signal frequency
     to generate a signal properly.
SEE ALSO
     vgpwl(1), intro(3), vipl(3), verror(3), vutils(3)
RESTRICTIONS
     can only generate  VFF_TYP_FLOAT  and  VFF_TYP_COMPLEX  type
     images.
AUTHOR
     Jeremy Worley
COPYRIGHT
     Copyright  1992,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vgshot
INPUT
     image          pointer to VIFF  structure  containing  image
                    data to be processed.
     percent        spikes percentage
OUTPUT
     image          pointer to VIFF  structure  containing  image
                    data after processing.
     Return Value:  1 on success, 0 on failure.
DESCRIPTION
     corrupts an image uniformly with spikes. The  percentage  of
     spikes  must  be  specified by the user. Spike locations are
     determined using a uniformly distributed random number  gen-
     erator.
SEE ALSO
     vgshot(1), intro(3), vipl(3), verror(3), vutils(3)
RESTRICTIONS
     can work only with data storage type byte images.
AUTHOR
     Marcelo Teran, Ramiro Jordan
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vgsin
INPUT
     image          pointer to VIFF  structure  containing  image
                    data to be processed.
     rows           rows is an integer that specifies the  number
                    of rows in the resultant image.
     cols           cols is an integer that specifies the  number
                    of columns in the resultant image.
     bands          bands is an integer that specifies the number
                    of bands in the resultant image.
     amp            amp is an float that  specifies  the  maximum
                    amplitude of the signal.
     fs             fs is a float  that  specifies  the  sampling
                    frequency for signal generation.
     fx             fx is a float that specifies the frequency of
                    the    signal   in   the   X   direction   in
                    radians/pixel.
     fy             fy is a float that specifies the frequency of
                    the   signal   in   the   Y   direction.   in
                    radians/pixel
     px             px is a float that specifies the phase  shift
                    in the X direction in radians.
     py             py is a float that specifies the phase  shift
                    in the Y direction in radians.
     type           type is an int that specifies the output data
                    type.   It  must  be  one of VFF_TYP_FLOAT or
                    VFF_TYP_COMPLEX.
OUTPUT
     image          pointer to VIFF  structure  containing  image
                    data after processing.
     Return Value:  1 on success, 0 on failure.
DESCRIPTION
     vgsin creates a two dimensional image of dimension  rows  *
     columns.   The   image  pixel  values  follow  a  sinusoidal
     waveform. The user can specify the frequency, phase,  ampli-
     tude, sampling frequency and image dimensions.
     The spatial frequencies are specified in radians/pixel,  and
     the  phase  offsets are specified in radians. The expression
     generated is then
     sin(fx*x + px + fy*y + py)
     where fx and fy are the frequencies in the X  and  Y  direc-
     tions respectively, and px an py are the phase shifts in the
     X and Y directions respectively.
     The phase fronts of the sinusoid  are  perpedicular  to  the
     direction  given by the angle atan2(b,a). For a reference on
     this see J. Goodman, "Introduction to Fourier Optics".
     The sampling frequency modifies the generated expression  as
     follows:
     sin(fx*x/fs + px + fy*y/fs + py)
     which allows one to shift the frequency to match that of  an
     incoming data stream (in 1D).
     The resulting images may be of type  FLOAT  or  COMPLEX.   A
     complex  image  is  generated using the formula cos[stuff] +
     j*sin[stuff].
SEE ALSO
     vgsin(1),   intro(3),    vipl(3),    verror(3),    vutils(3)
     lvgconst(3)
RESTRICTIONS
     vgsin can only generate VFF_TYP_FLOAT  and  VFF_TYP_COMPLEX
     type images.
AUTHOR
     Jeremy Worley, Marcelo Teran, Ramiro Jordan
COPYRIGHT
     Copyright  1992,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vimpulse
INPUT
     image          pointer to VIFF  structure  containing  image
                    data to be processed.
     deltax         impulse spacing in x direction
     deltay         impulse spacing in y direction
     nx             number of impulses in x direction
     ny             number of impulses in y direction
     xoff           the X offset for the first impulse  from  the
                    upper left corner of the image
     yoff           the Y offset for the first impulse  from  the
                    upper left corner of the image
     rows           number of rows in the image to be generated
     cols           number of columns in the  image  to  be  gen-
                    erated
OUTPUT
     image          pointer to VIFF  structure  containing  image
                    data after processing.
     Return Value:  1 on success, 0 on failure.
DESCRIPTION
DIAGNOSTICS
     The inputs are:
     *image - pointer to xvimage  structure  pointer  to  receive
     address of image
     deltax - impulse spacing in x direction
     deltay - impulse spacing in y direction
     nx - number of impulses in x direction
     ny - number of impulses in y direction
     xoff - the X offset for the first  impulse  from  the  upper
     left corner of the image
     yoff - the Y offset for the first  impulse  from  the  upper
     left corner of the image
     rows,cols - size of the image to be generated
     The output image contains all zeros,  except  for  the  unit
     impulses.
     vimpulse returns a zero upon failure and a  one  upon  suc-
     cess.
SEE ALSO
     vimpulse(1), intro(3), vipl(3), verror(3), vutils(3)
RESTRICTIONS
     generates only byte data storage type output files.
AUTHOR
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.
*********************************************************************************
Documentation for avs module vmarr
INPUT
     image          pointer to VIFF  structure  containing  image
                    data to be processed.
     rows           number of rows in kernel.
     cols           number of columns in kernel.
     var            the variance of the Gaussian
OUTPUT
     image          pointer to VIFF  structure  containing  image
                    data after processing.
     Return Value:  1 on success, 0 on failure.
DESCRIPTION
     creates a convolution  filter  kernel  using  the  following
     equation.   pixel  = [-1/(PI*var*var)]*[1-r*r/(2*var)]*exp[-
     r*r/(2*var)], where r is the calculated  distance  from  the
     center of the kernel.
     A Marr filter  is  the  Laplacian  of  a  Gaussian,  and  is
     intended  for high lighting image edges and at the same time
     smooth out the noise.  vmarr  creates  image  data  of  type
     float.
SEE ALSO
     vmarr(1), intro(3),  vipl(3),  verror(3),  vutils(3)  lvcus-
     tom(3)
RESTRICTIONS
     only generates float kernels, vconvert can change the  image
     to other data types.
AUTHOR
     Richard Krukar, John Rasure, Robert Estes
COPYRIGHT
     Copyright  1991,  University  of  New  Mexico.   All  rights
     reserved.