tkImgDip Documentation

Name

dip – Data Image Portal


Synopsis

image create dip

?name? ?configuration-options? ?input-options?

Description

A dip is an image whose pixels represent arbitrary data values. A dip image is stored internally as an arbitrary data array. The arbitrary data for a dip image can be obtained from a file, channel or a variable, or it can be supplied from C code through a procedural interface. An interface also exists to allow additional image formats to be added easily.


Creating Dips

Like all images, dips are created using the image create command.

When a dip image is created, Tk also creates a new command whose name is the same as the image. This command may be used to invoke various operations on the image. It has the following general form:

imageName option ?arg arg ...?

Option and the args parameters determine the exact behavior of the command.

When creating a dip image you also have the ability to specify the options list under the "imageName configure" command and the "imageName read" command. All "configure" options must be list before any "read" options.

IMAGE COMMAND

When a dip image is created, Tk also creates a new command whose name is the same as the image. This command may be used to invoke various operations on the image. It has the following general form:

imageName option ?arg arg ...?

Option and the args parameters determine the exact behavior of the command.

The following commands are possible for dip images:

imageName configure ?option? ?value option value ...?
Query or modify the configuration options for the image. If no option is specified, returns a list describing all of the available options for imageName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given option(s) to have the given value(s); in this case the command returns an empty string. The following options are available to this command:
-height number [0]
Specifies the height of the image, in pixels. This option is useful primarily in situations where the user wishes to display only a portion of the available data.

 
-width number [0]
Specifies the width of the image, in pixels. This option is useful primarily in situations where the user wishes to display only a portion of the available data.

 
-minHeight number [0]
Specifies the minimum height of the image, in pixels. Prevents the height of the image from becoming less than number pixels.

 
-minWidth number [0]
Specifies the minimum width of the image, in pixels. Prevents the width of the image from becoming less than number pixels.

 
-maxHeight number [-1]
Specifies the maximum height of the image, in pixels. Prevents the height of the image from becoming greater than number pixels. Specifying a number less than zero indicates no limit is to be placed on maximum height.

 
-maxWidth number [-1]
Specifies the maximum width of the image, in pixels. Prevents the width of the image from becoming greater than number pixels wide. Specifying a number less than zero indicates no limit is to be placed on maximum width.

 
-resizeWidth size-paramter [default]
Specifies how and when the dip image size is changed. Any change to width will be clipped to be within the range specified by "-minWidth" and "-maxWidth."

 
fixed
Width of image is fixed at its current size until its resize mode is changed or until its width is manually changed via the "-width" option of "image dip create" or "imageName configure".
auto
Width of image is adjusted to match width of the data times the X Zoom factor.
grow
Width of image will grow to match width of data times the X Zoom factor, but will not shrink.
shrink
Width of image will shrink to match width of data times the X Zoom factor, but will not grow.
default
Width of image will match width of the current data (if any) times the X Zoom factor. If no data is currently loaded it will be set to the width of the next data read into image * the X Zoom factor. After the width is set this parameter will revert to fixed.

 
-resizeHeightsize-paramter [default]
Specifies how and when the dip image height is changed. Any change to height will be clipped to be within the range specified by "-minHeight" and "-maxHeight."

 
fixed
Height of image is fixed at its current size until its resize mode is changed or until its height is manually changed via the "-height" option of "image dip create" or "imageName configure".
auto
Height of image is adjusted to match the height of the data times the Y Zoom factor.
grow
Height of image will grow to match the height of the data times the Y Zoom factor, but will not shrink.
shrink
Height of image will shrink to match the height of the data time the Y Zoom factor, but will not grow
default
Height of image will match height of the current data (if any) times the Y Zoom factor. If no data is currently loaded it will be set to the height of the next data read into image * the Y Zoom factor. After the height is set this parameter will revert to fixed.

 
-rangeMin number [minimum of data array]
Specifies the minimum data value to view in this portal. Any values less than this will be displayed as if they were this value.

 
-rangeMax number [maximum of data array]
Specifies the maximum data value to view in this portal. Any values greater than this will be displayed as if they were this value.

 
-autoRangeMin range-string [auto]
Specifies how the display range minimum is determined.

 
fixed
Minimum value is fixed at its current value until the -autoRangeMin mode is changed or until manually changed via the "-rangeMin" option of "image dip create" or "imageName configure."
auto
Minimum value automatically changes as the minimum value of the data set changes.

 
-autoRangeMax range-string [auto]
Specifies how the display range maximum is determined.

 
fixed
Maximum value is fixed at its current value until the -autoRangeMax mode is changed or until manually changed via the "-rangeMax" option of "image dip create" or "imageName configure."
auto
Maximum value automatically changes as the maximum value of the data set changes.

 
-zoomX zoom-value [1.0]
Specifies the X Zoom factor to apply to the portal view of the data. May be any positive floating point value. Zooming is performed by simple pixel replication.

 
-zoomY zoom-value [1.0]
Specifies the Y Zoom factor to apply to the portal view of the data. May be any positive floating point value. Zooming is performed by simple pixel replication.

 
-panX pan-value [0]
Specifies the X Pan offset to apply to the portal view of the data. May be any integer value.

 
-panY pan-value [0]
Specifies the Y Pan offset to apply to the portal view of the data. May be any integer value.

The Following are Currently Umimplemented


 
-colormap colormap-name [greyscale]
Map normalized data values to the colors represented by this named colormap. Standard colormap available are:
 
greyscale
spectrum
inverse
 
Additional named colormaps can be created with the "dip define colormap" and "dip read colormap" commands.

 
-dtf dtf-name [identity]
Map normalized data values through the named display transfer function before looking up colors in the colormap.
identity
inverse
 
Additional named display transfer functions can be created with the "dip define dtf" and "dip read dtf" commands.

 
-minDtfinput value [0]
Specifies the minimum input value to the display transfer function (dtf). Any values less than this will be mapped to this value prior to input to the dtf.

 
-maxDtfinput value [255]
Specifies the maximum input value to the display transfer function (dtf). Any values greater than this will be mapped to this value prior to input to the dtd.

 
-minDtfoutput value [0]
Specifies the minimum value to be output by the display transfer function (dtf).

 
-maxDtfoutput value [255]
Specifies the maximum value to be output by the display transfer function (dtf).
imageName cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the imageName configure command.

 
imageName read ?option value option value ...?
Query or modify the configuration options for the image. If no option is specified, returns a list describing all of the available options for imageName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command.
-fopt string []
Format specific options. See –format for available formats and their options.
-data string []
Create an image from the data given in string. See –format for available formats which can read strings.
-file string []
Create an image from the file given in string. See –format for available formats which can read files.
-channel string []
Create an image from the channel given in string. See –format for available formats which can read from channels.
-format string
Specifies format for data specified with the -data/-file/-channel options.

Built in formats include

RAW -file or -channel

GIF -file or -channel

PPM -file or -channel

PGM -file or -channel

RAS -file or -channel

VIFF -file or -channel

VIEW -file or -channel

SUPRIM -file or -channel

DIP -data only

SIPS -data only

VIEWIT -data only

EMSCOPE -data only

-xdim
X Dimension of raw data (-format raw)
-ydim
Y Dimension of raw data (-format raw)
-zdim
Z Dimension of raw data (-format raw)
-skip
Number of bytes to skip before reading raw data (-format raw)
-datatype
Data type of raw data (-format raw).

Data types allowed include:

uint8 or byte: an unsigned 8 bit integer value

sint16 or short: a signed 16 bit integer value

uint16: an unsigned 16 bit integer value

sint32 or int: a signed 32 bit integer value

float32 or float: a 32 bit floating point value

-from x1 y1 [x2 y2]
Specifies rectangular area of image to read
-to x y
Specifies coordinates to write read data to
-zsample
-frame
-z
Specifies which slice of data to read in a 3D data format
-zoom x y
Repeat every column x times and every row y times when reading data
-subsample x y
Skip every xth column and every yth row when reading data

 
imageName copy dipImage
Copy one dip image to another

 
imageName rdbinary -file fileName options
Reads raw binary data from file fileName to imageName using the same options as "create image" with the exception that "-format raw" is assumed to be preset.

 
imageName cmap_level [value]
With no arguments, returns the current level for the image displayed. With an argument in the range [0-3], changes the colormap.

 
imageName cmap_stretch [intensity|red|green|blue] cwidth clen x0 y0 ... xn yn
Stretches the colormap in a piecewise-linear way. Each of the intensity, red, green, blue look-up tables can be changed independently. The coordinates of the points are in the range [0,cwidth] and [0,clen] for x and y respectively. The first point should have either its x or y value set to 0. The last point should have its x value set to cwidth or its y value set to clen. If you installed the plb_segment library, and no arguments, a histogram stretch will be performed.

 
imageName cmap_threshold loval hival
Thresholds the colormap so that all the pixels between loval and hival appear white and the rest black.

 
imageName colormap [gray | ct | hot | cold | hls | rgb | spectrum | invert | random | bowlerhat | tophat | hatgray | hatct]
Loads one of the default look-up tables.

 
imageName clip -loval loval [-hival hival]
Clips source image. All the pixels below loval will be set to loval. All the pixels above hival will be set to hival.

 
imageName get x y
Returns actual pixel value (not normalized for display) at pixel x y.

 
imageName getline x0 y0 x1 y1
Returns profile of image along segment [(x0,y0),(x1,y1)]

 
imageName getmin
Returns the minimum value of the image.

 
imageName getmax
Returns the maximum value of the image.

 
imageName histogram
Returns image histogram.

 
imageName overlay enable
Sets up the overlay mode.

 
imageName overlay disable
Goes back to normal

 
imageName overlay setgc [or | xor | and | set | clear | set/copy | invert | copyinverted]
Sets the Graphic Context, i.e the way the overlays will be displayed and combined.

 
imageName overlay line x0 y0 x1 y1 [x2 y2]
Overlays a line. If the optional argument is present, a second line (x0,y0,x2,y2) will be drawed as well.

 
imageName overlay fill x0 y0 .... xn yn
Overlays a filled polygon.

 
imageName overlay bezier x0 y0 .... xn yn
Overlays a Bezier spline

 
imageName overlay fillbezier x0 y0 .... xn yn
Overlays a filled Bezier Spline

 
imageName overlay rectangle x y width height
Overlays a rectangle

 
imageName overlay ellipse x y width height
Overlays an ellipse

 
imageName overlay putmask maskName
Overlays the mask maskName onto imageName

 
imageName overlay getmask imageName
Transfer the overlays displayed over imageName into maskName

 
imageName range min max
Sets a minimum and maximum value for images. Side effects only for non-byte images. Useful to compare short, int or float images that don't have the same dynamic range. It is the user's responsibility to ensure the range specified is larger than the actual range.

 
imageName redither
Redithers the image.

 
imageName rxsize rxsize
Specifies physical dimension of pixel in x-direction

 
imageName rysize rysize
Specifies physical dimension of pixel in y-direction

 
imageName snap2photo destPhotoImage
Performs a snapshot and store 24-bit image in photo image.

 
imageName snap2pict destPictImage
Performs a snapshot and store gray-scale image in pict image.

 
imageName type
Returns type of image.

 
imageName thres_isodata
Returns threshold value which separates best a bimodal histogram according to the isodata clustering algorithm.

 
imageName write fileName [options]
Writes image data into file fileName (only VIEW, PGM and RAS supported)
-format formatName
Specifies image format for the output file.
-from x1 y1 x2 y2
Specifies a rectangular of the image to copy from.

 
imageName wrbinary -file fileName
Writes image data into raw binary file fileName

 
imageName wrbinary -channel channelName
Writes image data into raw binary file channelName