Macro Commands

This is list, in alphabetical order, of the commands in NIH Image's Pascal-like macro programming language. See Appendix A of the manual for more information about the macro language.
abs(n) / Math Functions
Returns absolute value of n.

Acquire('Plug-in Name') / File Menu
Loads and runs a Photoshop compatible acquisition plug-in. The plug-in is assumed to be in the Plug-ins folder.

AddConstant(n) / Process Menu
Adds n to the current image or rectangular selection, where -255 <= n <= 255.

AddSlice / Stacks Menu
Adds a slice following the current slice.

AdjustAreas(b) / Analyze Menu
Sets the "Adjust Areas" flag in Measurement/Options. b =true or false.

AllSameSize / Miscellaneous Functions
Returns true if all open images have the same dimensions.

AnalyzeParticles('options') / Analyze Menu
Does particle analysis, where 'options' (optional) contains some combination of 'label', 'outline', 'ignore', 'include' and 'reset'. Any option not listed is disabled. Use "AnalyzeParticles('dialog')" to display the dialog box using the existing settings.

ApplyLUT / Process Menu
Transforms the pixel data using the current look-up table.

arctan(n) / Math Functions
Returns arctangent of n (radians).

AutoOutline(x,y) / Miscellaneous Macro Commands
Equivalent to clicking with the wand tool at location x,y . The outline was successfully created if GetRoi returns a width greater than zero.

AutoThreshold / Options Menu
Set threshold level to an automatically determined value.

AverageFrames('str',frames) / Special Menu
Averages or integrates video frames.'str' is some combination of 'Average', 'Integrate', 'Video Rate Capture' and 'On-chip' and frames is the number of frames. Any option not specified is disabled. Set frames to zero to display the Average Frames dialog box.

AverageSlices / Stacks Menu
Averages all the slices in the current stack.

Beep / Miscellaneous Macro Commands
Makes a short sound.

BitAnd(n1,n2) / Math Functions
Returns n1 AND n2.

BitOr(n1,n2) / Math Functions
Returns n1 OR n2.

Button / Miscellaneous Functions
Returns true if mouse button is down.

Calibrate('fit', 'unit', m1, k1, m2, k2, ...) / Analyze Menu
'fit' is one of 'straight', 'poly2', 'poly3', 'poly4', 'exp', 'power', 'log', 'rodbard', 'uncalibrated' or 'uncalibrated od'. 'unit' is the unit of measurement, m1 , m2 , etc. are the measured values and k1 , k2 , etc. are the known values. For example, "Calibrate('Straight', 'Invert', 0, 255, 255, 0)" sets up a simple inverting function. Use "Calibrate('Uncalibrated OD')" to enable uncalibrated OD and "Calibrate('Uncalibrated')" to disable calibration.

Calibrated / Miscellaneous Functions
Returns true if current image is density calibrated.

CallExport('Plug-in Name') / File Menu
Loads and runs the specified export plug-in.

CallFilter('name') / Process Menu
Runs the specified filter plug-in, which is assumed to be in the Plug-ins folder.

Capture / Special Menu
Captures and displays a single video frame.

Capture Color / Stacks Menu
Capures a 24-bit RGB color image.

ChangeValues(v1,v2,v3) / Miscellaneous Macro Commands
Changes the value of all pixels with a value in the range v1 -v2 to v3.

ChangeValues(v1,v2,v3) / Process Menu
Changes pixels with a value in the range v1 -v2 to v3.

ChoosePic(n) / Miscellaneous Macro Commands
Selects then Nth image window without activating it. Faster than SelectPic but changes, if any, are not displayed. Also accepts PidNumbers (see description of PidNumber function).

ChooseSlice(n) / Miscellaneous Macro Commands
Selects the Nth slice in a stack without displaying it. ChooseSlice is faster than SelectSlice but changes, if any, are not displayed. Use SelectSlice before exiting macro to make sure the stack is correctly displayed.

Clear / Edit Menu
Erases current ROI to background color.

Close / File Menu
Closes the active image, text, profile plot, Histogram or Results window.

Convolve('Kernel file name') / Process Menu
Note that the name can be a directory path such as 'HD80:Image:Kernels:Smooth'.

Copy / Edit Menu
Copies contents of the current ROI to the Clipboard.

CopyResults / Edit Menu
Copies measurement results to Clipboard.

cos(n) / Math Functions
Returns cosine of n (radians).

cValue(PixelValue) / Miscellaneous Functions
Converts a raw pixel value (an integer in the range 0-255) to a density calibrated value.

Delete(str,index,count) /String Functions
Removes count characters from str , beginning at index.

DeleteSlice / Stacks Menu
Deletes the current slice.

Dilate / Process Menu
Adds pixels to the edges of objects.

Dispose / File Menu
Similar to Close, but user is never prompted to save changes.

DisposeAll / File Menu
Closes all open image windows without prompting to ask if changes should be saved.

DoCopy, DoAnd, DoOr, DoXor, DoReplace, DoBlend, Add, Subtract, Multiply, Divide / Paste Control Related Commands
These commands are equivalent to clicking on the corresponding button in the Paste Control dialog box. The must be used immediately after the Paste command. Preceed DoCopy, DoAnd, etc. with SetOption to switch paste transfer modes, otherwise the operation is performed and the paste operation terminated. The foreground color is set to black and the background color to white unless SetOption is used. See the "More Macros" macro file for examples of how to use SetOption with these commands. Add, Subtract, Multiple and Divide only work with rectangular selections.

DrawBoundary / Edit Menu
Outlines current ROI using foreground color. Use SetLineWidth to control width of outline.

DrawScale / Edit Menu
Draws a grayscale ramp in the current rectangular ROI.

Duplicate('Window Title') / File Menu
Creates a new image window using the specified name and copies the contents of the current selection to the new window.

EnhanceContrast / Process Menu
Does a histogram stretch on the LUT. Does not alter pixel values.

Erode / Process Menu
Removes pixels from the edges of objects.

Exit / Miscellaneous Macro Commands
Terminates execution of the macro.

exp(n) / Math Functions
Returns exponential of n

Export('name') / File Menu
Use SetExport to specify what to export. Similar to SaveAs, the dialog box is not displayed more than once per macro and full folder paths are allowed.

FFT('Display Power Spectrum') / Process Menu
Recomputes the power spectrum.

FFT('foreward') / Process Menu
Generates a Fourier transform of a square, power of two size image. The image can be either 8-bit or real. For real images, the transformation is done in-place.

FFT('inverse with filter') / Process Menu
Uses the 8-bit grayscale component of the FFT window as a filter that the frequency domain image is multiplied by prior to retransformation. This means that the power spectrum must be replaced by a grayscale filter before retransformation. The "High Pass" and "Low Pass" macros in "FFT Macros" use this variation of the FFT command.

FFT('inverse with mask') / Process Menu
Same as FFT('inverse').

FFT('inverse without filter') / Process Menu
No masking or filtering is done before retransformation.

FFT('inverse') / Process Menu
Does an in-place inverse transform with black or white reqions in the 8-bit power spectrum used as a mask to generate a filter. Duplicates the behavior of the "Inverse FFT" menu command.

FFT('Swap Quadrants') / Process Menu
Swaps quadrants 1 and 3 and quadrants 2 and 4 of the current 8-bit image.

Fill / Edit Menu
Fills current ROI with foreground color.

Filter('name') / Process Menu
Runs the specified filter, where 'name' is one of the following: 'smooth', 'smooth more', 'sharpen', 'sharpen more', 'find edges' (or 'sobel'), 'median', 'max', 'min' or 'dither'.

FlipHorizontal / Edit Menu
Horizontally inverts the current rectangular image or ROI.

FlipVertical / Edit Menu
Vertically inverts the current rectangular image or ROI.

Get('FreeMem') / Miscellaneous Functions
Returns the total amount of free memory, in bytes.

Get('MaxBlock') / Miscellaneous Functions
Returns the size (in bytes) of the largest free memory block.

Get('MaxMeasurements') / Miscellaneous Functions
Returns the value of "Max Measurements".

Get('RoiType') / Miscellaneous Functions
Returns a code that specifies the current ROI type, where 0 = no ROI or no image, 1 = rectangle, 2 = oval, 3 = polygon, 4 = freehand, 5=traced, 6 = straight line, 7 = freehand line and 8 = segmented line.

Get('UndoBufSize') / Miscellaneous Functions
Returns size (in bytes) of the Undo and Clipboard buffers.

GetColumn(x,y,length) / Miscellaneous Macro Commands
Copies a column of pixels from active image to the built-in LineBuffer array.

GetFileInfo(FullPath, FileType, FileSize) /String Functions
Returns information about the file specified by FullPath, a string containing a path name (e.g. 'HD500:Images:image01'). Returns the file type ('TIFF', 'PICT', 'TEXT' etc) in the string variable FileType and the file size in bytes in the integer variable FileSize. If the file
isn't found, FileType is set to an empty string and FileSize is set to -1. See the 'File Paths Demo' macro in 'Input/Output Macros' for an example of how to use GetFileInfo.

GetHistogram(left,top,w,h) / Miscellaneous Macro Commands
Generates a density histogram of the specified rectangular ROI and stores it in the built-in histogram array.

GetInfo / File Menu
Creates a new image window that displays information about the current image window.

GetLine(x1,y1,x2,y2,LineWidth) / Miscellaneous Macro Commands
Returns the starting coordinates, ending coordinates and width of current straight line selection. Sets x1 = -1 if there is no line selection.

GetMouse(x,y) / Miscellaneous Macro Commands
Returns the current cursor location in local pixel coordinates.

GetNumber('Prompt', default, d) / Miscellaneous Functions
Displays a dialog box and returns with the value entered. Prompt is the prompting string. Default is the default value. d (optional) is the number of digits to the right of the decimal point (default is 2). Set d to zero to display an integer default value.

GetPath('pref'): path := GetPath('pref') /String Functions
Returns the path of the Preferences folder in the System Folder.

GetPath('startup'): path := GetPath('startup') /String Functions
Returns the path of the folder from which NIH Image was started.

GetPath('window'): path := GetPath('window') /String Functions
Returns the folder path (e.g. 'HD500:Images:') of the current current image or text window. Returns an empty string if no window is open or the current window has no file associated it. The 'File Paths Demo' macro in 'Input/Output Macros' demonstrates how to use the GetPath functions.

GetPicSize(width,height) / Miscellaneous Macro Commands
Returns, in pixels, the width and height of active image.

GetPixel(x,y) / Miscellaneous Functions
Returns the value of the pixel at x,y .

GetPlotData(count,ppv,min,max) / Analyze Menu
Performs the equivalent of PlotProfile and returns the results in the built-in PlotData array. Count is the number of values, ppv is the number of pixels averaged for each value, and min and max are the minimum and maximum values.

GetResults(n,mean,mode,min,max) / Analyze Menu
Use after Measure. Returns the pixel count, the mean pixel value, the most frequently occuring pixel value, and the minimum and maximum pixel values. Values are always uncalibrated. Use cValue function to calibrate them.

GetRoi(left,top,width,height) / Miscellaneous Macro Commands
Returns ROI location and size in pixels. Sets width =0 if no ROI. Returns location and size of bounding rectangle for non-rectangular ROIs and for line selections.

GetRow(x,y,length) / Miscellaneous Macro Commands
Copies a row of pixels from the active image to the built-in LineBuffer array.

GetScale(scale,unit,AspectRatio) / Analyze Menu
Returns the number of pixels per unit of measurement in the real variable scale , the unit of measurement in the string variable unit , and (optional) the pixel aspect ratio in the real variable AspectRatio . For uncalibrated images, scale and AspectRatio are set to 1.0 and unit to 'pixel'.

GetSerial: str:=GetSerial /Serial I/O
Returns the next available character in the serial (modem) input buffer as a one character string or returns an empty string if the buffer is empty.

GetSliceSpacing / Miscellaneous Functions
Returns slice spacing (in pixels) of current stack.

GetString: str:=GetString('Prompt','default') / String Functions
Displays a dialog box and returns with the string entered. The first argument is the prompting message and the second argument (optional) is the default input string.

GetThresholds(lower,upper) / Options Menu
In density slicing mode, returns the lower and upper thresholds. In thresholding mode, lower is set to the threshold and upper is set to 255. Otherwise, both are set to zero.

GetTime(year, month, day, hour, minute, second, dayofweek) / Miscellaneous Macro Commands
Returns the current date and time.

ImageMath('op',pic1,pic2,scale,offset,result) / Process Menu
Where 'op' is one of 'add', 'sub', 'mul', 'div', 'and', 'or', 'xor', 'min', 'max' or 'copy'. Add the keyword 'real' (e.g. 'add real') to generate a 32-bit real result. Pic1 and pic2 are pic numbers or pid numbers. ImageMath performs the specified operation, the result is multiplied by scale , offset is added and, if real wasn't specified, the final result is clipped to 8-bits. The arithmetic operation is performed in the upper left corner of each image using the largest common rectangle. Result can be either a string or a pid number. If it's a string, a window with that name is created to store the result, otherwise the result is stored in the image specified by the pid number.

Import('File Name') / File Menu
Imports the specified file using parameters specified by SetImport, SetCustom and SetImportMinMax.

IncludeInteriorHoles(b) / Analyze Menu
Enables/disables "Interior Holes" option. b =true or false.

IndexedToRGB / Stacks Menu
Converts an 8-bit color image to a 3-slice RGB stack.

InsetRoi(delta) / Miscellaneous Macro Commands
Shrinks or expands (if delta <0) the current ROI by delta.

Invert / Edit Menu
Inverts image or ROI, i.e., value = 255 - value for all pixels in the image or ROI.

InvertLUT / Options Menu
Inverts the video look-up table.

InvertY(b) / Options Menu
Invert Y-coordinates if b is true.

KeyDown('key') / Miscellaneous Functions
Checks the state of the specified modifier key. 'key' is one of: 'option', 'shift' or 'control'. Returns TRUE if the specified key is down.

KillRoi / Miscellaneous Macro Commands
Disables the current "marching ants" selection.

length(str): i:=length(str) /String Functions
Returns the length of str.

LineTo(x,y) / Miscellaneous Macro Commands
Draws a line from current location to x,y .

ln(n) / Math Functions
Returns natural logarithm of n.

MakeBinary / Process Menu
Converts the current grayscale image to binary.

MakeLineRoi(x1,y1,x2,y2) / Miscellaneous Macro Commands
Creates a new straight line selection. The origin (0,0) is assumed to be the upper left corner of the image. Coordinates are in pixels but they can be real numbers.

MakeMovie('str',frames,interval) / Stacks Menu
Captures a sequence of video frames to a stack. 'str' is some combination of 'blind', 'buffer', 'time stamp', 'existing', 'trigger first', 'trigger each', and 'dialog'. Frames is the number of frames to capture, and interval is the interval between frames in seconds. See the "Movie Making" macro file for examples.

MakeNewStack('name') / Miscellaneous Macro Commands
Creates a new 1-slice stack. Use SetNewSize to specify the size.

MakeNewWindow('Name') / File Menu
Creates a new image window. Use SetNewSize to specify the size of the new window.

MakeOvalRoi(left,top,width,height) / Miscellaneous Macro Commands
Creates an elliptical ROI, where left and top define the upper left corner of the bounding rectangle..

MakeRoi(left,top,width,height) / Miscellaneous Macro Commands
Creates a new rectangular selection. Left and top are the coordinates (in pixels) of the upper left corner of the ROI. The origin (0,0) of the coordinate system is the upper left corner of the image.

MarkSelection / Analyze Menu
Same as the Label Selection menu command.

Measure / Analyze Menu
Results are stored in the results arrays rArea[], rMean[], etc. and in the Histogram[] array.

MoveRoi(dx,dy) / Miscellaneous Macro Commands
Moves ROI right dx pixels and down dy pixels.

MoveTo(x,y) / Miscellaneous Macro Commands
Sets the current drawing location. The origin is always assumed to be the upper left corner of the image.

MoveWindow(x,y) / Miscellaneous Macro Commands
Moves current window to global screen coordinates x,y .

MultiplyByConstant(n) / Process Menu
Multiplies the current image or rectangular selection by n , where 0.0 <= n <= 255.0.

nCoordinates / Miscellaneous Functions
Returns the number of XY coordinates used to define the current selection. The coordinates are stored in the xCoordinates[] and yCoordinates[] built-in arrays.

NewTextWindow('Name',w,h) / File Menu
Creates a new text window with the title 'Name' . W and h
(optional) specify the width and height of the new window.

NextWindow / Windows Menu
Switches to the next image window.

nPics / Miscellaneous Functions
Returns number of image windows.

nSlices / Miscellaneous Functions
Returns number of slices in current stack.

odd(n) / Math Functions
Returns TRUE if integer n is odd.

Open('File Name') / File Menu
Opens the specified image file.

OpenSerial('Options') /Serial I/O
Sets up the modem port for serial I/O. 'Options' contains '300 baud', '1200 baud', '2400 baud', '9600 baud' or '19200 baud'; 'no parity', 'even parity' or 'odd parity'; 'seven data' or 'eight data'; 'One stop' or 'two stop'. The default is 9600 baud, no parity, eight data, one stop.

ord(str): n:=ord(str) /String Functions
Returns the ordinal number of the first character in a string (e.g. ord('A')=65). Returns -1 if the string is empty.

Outline / Process Menu
Generates one pixel wide object outlines.

Paste / Edit Menu
Pastes into current ROI if Clipboard object and ROI have the same dimensions, otherwise, pastes into center of image.

PasteLive / Edit Menu
Pastes "live" from video (frame grabber) source into a selection. Note that the destination window cannot be larger that the Camera window.

PhotoMode(b) / Special Menu
Set b true to enable "Photo Mode" and false to disable it.

PicNumber / Miscellaneous Functions
Returns number (used by SelectPic) of the active image.

PidExists(pid) / Miscellaneous Functions
Returns TRUE if image with this PidNumber is still open.

PidNumber / Miscellaneous Functions
Returns a negative permanent ID number for the current image. This number can be passed at a later time to SelectPic or ChoosePic to activate this image.

PlotProfile / Analyze Menu
Generates a gray scale profile plot of the current rectangular selection or line selection.

PlotXYZ / Miscellaneous Macro Commands
Plots XYZ coordinate data stored in a text file. See the example macro in "Plotting Macros".

pos(substr,str): i:=pos(substr,str) /String Functions
Searches for substr within str and returns an integer that is the index of the first character of substr within str . Returns zero if substr is not found.

Print / File Menu
Prints the active image (or selection), text, Plot, Results or Histogram window.

Project / Stacks Menu
Does 3D projection of current stack. Dialog box is not displayed if SetProjection() has been called.

PropagateDensity / Options Menu
Propagates current density calibration to all other open images.

PropagateLUT / Options Menu
Propagates current LUT to all other open images.

PropagateSpatial / Options Menu
Propagates current spatial calibration to all other open images.

PutColumn(x,y,length) / Miscellaneous Macro Commands
Copies length pixels from the built-in LineBuffer array to a column starting at x,y in the current image.

PutMessage('message') / Miscellaneous Macro Commands
Displays 'message' in a dialog box. Like the Write routine, accepts multiple string and numeric arguments.

PutPixel(x,y,value) / Miscellaneous Macro Commands
Stores value (an integer in the range 0-255) at location x,y . When
storing a sequence of pixels, it's usually faster to store them in the
built-in LineBuffer array and use PutRow to display the line.

PutRow(x,y,length) / Miscellaneous Macro Commands
Copies length pixels from the built-in LineBuffer array to a row in the current image starting at x,y .

PutSerial(str) /Serial I/O
Writes 'str' to the modem port. Like the Write routine, it accepts multiple arguments (e.g. PutSerial('v=',v:1:2)).

random / Math Functions
Returns a random number between 0 and 1.

rCount / Miscellaneous Functions
Returns current measurement counter value.

Redirect(b) / Analyze Menu
Enables/disables redirected sampling. b =true or false.

RequiresVersion(n) / Miscellaneous Macro Commands
Aborts macro if Image version number is less than n, where n is a real number.

ResetCounter / Analyze Menu
Sets the measurement counter to zero.

ResetGrayMap / Miscellaneous Macro Commands
Equivalent to using the Options/Grayscale menu command or clicking on the reset icon in Map window.

Reslice / Stacks Menu
Reslice stack along current line selection.

RestoreRoi / Analyze Menu
Same as the Restore Selection menu command.

RestoreState / Miscellaneous Macro Commands
Restores settings saved by SaveState.

RevertToSaved / File Menu
Restores the the previously saved version of the current image from disk.

RGBToIndexed('string') / Stacks Menu
Converts a 3-slice RGB stack to an 8-bit image with color LUT. 'String' contains some combination of 'System LUT', 'Existing LUT', 'Custom LUT' and 'Dither'. Custom LUT and Dither are the defaults.

RotateLeft(b) / Edit Menu
Rotates the current image or rectangular ROI counter-clockwise 90 degrees. Creates a new window if b is true.

RotateRight(b) / Edit Menu
Rotates the current image or rectangular ROI clockwise 90 degrees. Creates a new window if b is true.

round(n) / Math Functions
Converts a real value to an integer with rounding.

Save / File Menu
Resaves the contents of the current image or text window.

SaveAll / File Menu
Saves all open image windows.

SaveAs('name') / File Menu
Saves the current image using the specified file name. Use SetSave to specify the format. Uses the window title as the file name when saving a text file or if SaveAs is used with no argument. When saving images, the dialog box should only be displayed the first time SaveAs is called within a macro. For both image and text windows, 'name ' can be a full folder path (e.g., 'HD400:Images:MyImage'). In this case, no dialog box is displayed.

SaveState / Miscellaneous Macro Commands
Saves foreground and background color, new window width and height, status of Invert Y flag, text attributes, and various ScaleAndRotate and SetScaling parameters. Use RestoreState to restore the saved settings.

ScaleAndRotate(xscale,yscale,angle) / Edit Menu
Scales and/or rotates the current rectangular ROI, where 0.05 <= xscale ,yscale <= 25.0 and -180 <= angle <= 180.

ScaleConvolutions(b) / Options Menu
Sets or resets Scale Convolutions flag in Preferences, whereb =true or false.

ScaleMath(b) / Miscellaneous Macro Commands
b =true or false. Sets or resets Scale Math flag in the Paste Control dialog box.

SelectAll / Edit Menu
Creates a rectangular ROI consisting of the entire image.

SelectPic(n) / Miscellaneous Macro Commands
Activates the Nth image window. Also accepts PidNumbers (see description of PidNumber function).

SelectSlice(n) / Miscellaneous Macro Commands
Displies the Nth slice of the current stack.

SelectTool(tool) / Miscellaneous Macro Commands
Selects a tool from the tool palette, where tool is one of: 'magnifier', 'grabber', 'pencil', 'eraser', 'brush', 'drawline', 'paintbucket', 'profile', 'wand', 'angletool', 'rectangle', 'oval', 'polygon', 'freehand', 'straightline', 'freeline', 'segmentline', 'lut', 'text',
'spraycan', 'picker' or 'crosshair'.

SelectWindow('name') / Miscellaneous Macro Commands
Activates the window with the title 'name'.

SetBackgroundColor(c) / Miscellaneous Macro Commands
Sets the background color, where 0 <= c <= 255.

SetBinaryCount(n) / Process Menu
See description of Set Count command.

SetChannel(channel) / Special Menu
Sets the video input channel, where channel=1, 2, 3, or 4.

SetCounter(n) / Miscellaneous Macro Commands
Sets the measurement counter to n.

SetCursor('shape') / Miscellaneous Macro Commands
Changes the cursor shape, where 'shape' is 'watch', 'cross', 'arrow' or 'finger'.

SetCustom(width,height,offset,slices) / File Menu
Specifies the width , height , offset , and number of slices for imported files. The slices argument is optional.

SetDensitySlice(lower,upper) / Options Menu
Sets the lower and upper threshold levels, where 1 <= lower ,upper <= 254. SetDensitySlice(255,255) enables density slicing without changing the levels. SetDensitySlice(0,0) disables density slicing.

SetExport('mode') / File Menu
Sets various file Export options, where mode is one of: 'Raw', 'MCID', 'Text', 'LUT', 'Measurements', 'Plot Values', Histogram Values' or 'XY Coordinates'

SetFont('Font name') / Options Menu
Specifies the typeface used for drawing text, where 'Font Name' is 'Geneva', 'Monoco', 'Helvetica', 'Times', etc.

SetFontSize(size) / Options Menu
Sets font size in points, where 6<=size <=720.

SetForegroundColor(c) / Miscellaneous Macro Commands
Sets the foregound color, where 0 <= c <= 255 (note that 0=white and 255=black).

SetImport('string') / File Menu
Set various file Import options, where string contains some combination of: 'TIFF', 'DICOM', 'MCID', 'Palette', 'Text', 'Custom', '8-bits', '16-bits Unsigned', '16-bits Signed', 'Swap Bytes', 'Auto-Scale', Fixed Scale', 'Calibrate' and 'Open All'.

SetImportMinMax(min,max) / File Menu
Disables auto-scaling and fixes the range for imported 16-bit images and images in text (ASCII) format.

SetLineWidth(width) / Miscellaneous Macro Commands
Specifies the line width (in pixels) used by LineTo, DrawBoundary and MakeLineRoi.

SetNewSize(width,height) / File Menu
Specifies width and height of new image windows.

SetOption / Miscellaneous Macro Commands
Equivalent to holding down option key while executing the immediately following macro command.

SetOptions('string') / Analyze Menu
Specifies meaurement options as listed in the Options dialog box. 'String' should contain some combination of 'Area', 'Mean', 'Std. Dev.', 'X-Y Center', 'Mode', 'Perimeter' (or 'Length'), 'Major', 'Minor', 'Angle', 'Int. Den.', 'Min/Max', 'User1' or 'User2'. Any variable not listed is disabled.

SetPalette(string, ExtraColors) / Options Menu
Loads a new look-up table, where string is one of: 'Grayscale', 'PseudoColor', 'System Palette', 'Rainbow' or 'Spectrum'. ExtraColors (optional) is the number (0-6) of LUT entries reserved for extra colors.

SetParticleSize(min,max) / Analyze Menu
Particles smaller than minimum (pixels) and larger than maximum (pixels) will be ignored by AnalyzeParticles.

SetPicName('Name') / Miscellaneous Macro Commands
Renames the active image window.

SetPlotLabels(b) / Options Menu
Specifies whether ot not profile plots are to be labeled, where, b=true or false.

SetPlotScale(min,max) / Options Menu
Set min and max to zero for auto-scaling.

SetPlotSize(width,height) / Options Menu
Set width and height to zero for auto-sizing of plots.

SetPrecision(digits,fwidth) / Analyze Menu
Specifies the format of displayed results, were digits is the number of digits to the right of the decimal point and fwidth (optional) is the field width.

SetProjection('string') / Stacks Menu
Set projection options, where 'string' is one of: 'X-Axis', 'Y-Axis', Z-Axis, 'Nearest', 'Brightest', 'Mean Value'

SetProjection('string',b) / Stacks Menu
Set projections flags, where b is boolean (true or false) and 'string' is either 'Save Projections' or 'Minimize Size'.

SetProjection('string',n) / Stacks Menu
Specifies 3D projection variables, where n is integer and 'string' is one of the following: 'Initial Angle', 'Total Rotation', 'Rotation Increment', 'Surface Opacity', 'Surface Depth-Cueing' or 'Interior Depth-Cueing'. Use SetDensitySlice to set the transparency bounds.

SetSaveAs('mode') / File Menu
Sets various file Save options, where 'mode' is one of: 'TIFF', 'RGB TIFF', 'PICT', MacPaint', 'PICS', 'LUT' or 'Outline'.

SetScale(scale,'unit',AspectRatio) / Analyze Menu
Scale is the number of pixels per unit of measurement. Set 'Unit' to 'nm', ' m', 'mm', 'cm', 'meter', 'km', inch', 'ft', 'mile' or 'pixel' or use an arbitrary unit up to 11 characters in length. AspectRatio (optional) is the x/y pixel aspect ratio. Us SetScale(0,'pixel') to disable spatial calibration and SetScale(0,'') to activate the Set Scale dialog box.

SetScaling('string') / Edit Menu
Sets ScaleAndRotate options, where string contains some combination of: 'Nearest', 'Bilinear', 'New Window', 'Same Window' or 'Interactive'.

SetSliceSpacing(n) / Miscellaneous Macro Commands
Sets the slice spacing (in pixels) used by the Reslice and Project commands.

SetText(string) / Options Menu
Specifies text style, where string contains some combination of: 'Bold', 'Italic', 'Underline', 'Outline', 'Shadow', 'Left Justified', 'Right Justified', 'Centered', 'No Background' or 'With Background'.

SetThreshold(level) / Options Menu
Sets the threshold, where 0 <= level <= 255. SetThreshold(-1) disables thresholding.

SetUser1Label('Label') / Miscellaneous Macro Commands
Replaces the label used for User 1 column in Results window. The maximum length of the label is 9 characters.

SetUser2Label('Label') / Miscellaneous Macro Commands
Replaces the label used for User 2 column in Results window. The maximum length of the label is 9 characters.

SetVideo('string',gain,offset) / Special Menu
Where 'string' is some combination of 'Invert, 'Highlight', 'Oscillating', 'Trigger', 'Blind' or 'Separate'. Any option not specified is disabled. Gain and Offset (optional) are integers in the range 0-255.

Shadow('direction') / Process Menu
Set 'direction' (optional) to 'N', 'NE', 'E', 'SE', 'S', 'SW', 'W' or 'NW'.

ShowHistogram / Analyze Menu
Generates a density histogram and displays it in the Histogram window.

ShowMessage('message') / Miscellaneous Macro Commands
Displays 'message' in the Info window. Accepts multiple arguments in the same way the Write routine does. Use a back-slash ('\') to start a new line.

ShowPasteControl / Windows Menu
Activates the Paste Control window.

ShowResults / Analyze Menu
Displays the Results window.

sin(n) / Math Functions
Returns sine of n (radians).

Skeletonize / Process Menu
Reduces objects to single pixel wide skeletons.

SliceNumber / Miscellaneous Functions
Returns number of current slice in a stack.

SortPalette / Miscellaneous Macro Commands
Sorts the current LUT by hue.

sqr(n) / Math Functions
Returns square of n.

sqrt(n) / Math Functions
Returns square root of n.

StartCapturing / Special Menu
Starts "live" video capture.

StopCapturing / Special Menu
Stops "live" video capture.

str:=chr(n) /String Functions
Converts a positive integer in the range 0..255 to a one character string (e.g. chr(65) = 'A').

str:=concat(str1, str2,...) /String Functions
Concatenates a series of strings. Will also convert one or more numbers to a string.

StringToNum: n:=StringToNum(str) /String Functions
Converts a string to a real number. Returns zero if the string contains no digits.

SubtractBackground('str',radius) / Process Menu
Where 'str' is one of: '1D Horizontal', '1D Vertical', '2D Rolling Ball' or '2D Remove Streaks'. Add 'faster' to 'str' (e.g. '2D Rolling Ball (faster)') for faster operation.

SurfacePlot / Analyze Menu
Creates a surface plot of the current image. Use SetNewSize to specify the size of the plot.

TickCount / Miscellaneous Functions
Returns the number of ticks (sixtieths of a second) since system last started.

TileWindows / Windows Menu
Repositions and resizes all open image windows so they don't overlap.

trunc(n) / Math Functions
Converts a real value to an integer with truncation.

Undo / Edit Menu
Reverses the effect of the last undoable operation.

UpdateLUT / Miscellaneous Macro Commands
Redisplays the LUT window.

UpdateResults / Miscellaneous Macro Commands
Redisplays the last measurement in Info and Results windows.

UserCode('name',p1,p2,p3) / Miscellaneous Macro Commands
Calls a user written Pascal routine, where 'name' is the name of the routine and p1 , p2 and p3 are real input parameters. See "Inside NIH Image" and the User.p source file for more information.

Wait(seconds) / Miscellaneous Macro Commands
Delays for seconds seconds. Fractions of a second are allowed, e.g., wait(1.5).

WaitForTrigger / Miscellaneous Macro Commands
Waits for an external trigger. Requires a QuickCapture or Scion frame grabber card. Use "repeat until button" to wait for a mouse down event.

WandAutoMeasure(b) / Analyze Menu
Sets the "Wand Auto-Measure" flag in Measurement/Options. b =true or false.

WindowTitle / Miscellaneous Functions
Returns a string containing the title of the active window.

WindowTitle: str:=WindowTitle /String Functions
Returns the title of the currently active window.

Write(e1,e2,...) / Miscellaneous Macro Commands
Draws text, variables, or constants in the current image at the current location. Like the Writeln procedure in Pascal, expressions may have optional field width specifications in the form e:f1:f2 (e.g., write('M=',mean:8:3), where f1 is the field width, and f2 specifies the number of digits to the right of the decimal point.

Writeln(e1,e2,...) / Miscellaneous Macro Commands
Similar to Write, but does the equivalent of a line feed and carriage return after displaying the specified values.