Beruflich Dokumente
Kultur Dokumente
2.1.1
Copyright 2012 Gatan Inc. All Rights Reserved.
DigitalMicrograph 2.1.1
Copyright 2012 Gatan Inc. All Rights Reserved.
All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or
mechanical, including photocopying, recording, taping, or information storage and retrieval systems - without the
written permission of the publisher.
Products that are referred to in this document may be either trademarks and/or registered trademarks of the
respective owners. The publisher and the author make no claim to these trademarks.
While every precaution has been taken in the preparation of this document, the publisher and the author assume no
responsibility for errors or omissions, or for damages resulting from the use of information contained in this
document or from the use of programs and source code that may accompany it. In no event shall the publisher and
the author be liable for any loss of profit or any other commercial damage caused or alleged to have been caused
directly or indirectly by this document.
Publisher
Gatan Inc.
Technical Editors
Gatan Software Team
http:www.gatan.com
Gatan Inc.
5794 W. Las Positas Blvd.
Pleasanton, California USA
925-463-0200
Contents
Table of Contents
Foreword
1 Overview
................................................................................................................................... 1
The DigitalMicrograph
..........................................................................................................................................................
Process
2
Basic Concepts.......................................................................................................................................................... 3
2 Basic Procedures
................................................................................................................................... 3
DigitalMicrograph
..........................................................................................................................................................
Environm ent
4
Creating Im age..........................................................................................................................................................
Docum ents
6
Using Im age Window
..........................................................................................................................................................
s
8
Saving Im age Docum
..........................................................................................................................................................
ents
9
Printing Im age..........................................................................................................................................................
Docum ents
15
Closing Im age..........................................................................................................................................................
Docum ents
16
Using Text Window
..........................................................................................................................................................
s
16
Using Floating..........................................................................................................................................................
Palettes
17
Setting Preferences
.......................................................................................................................................................... 19
Session Inform
..........................................................................................................................................................
ation
22
Im porting Im ages
.......................................................................................................................................................... 27
Databar
.......................................................................................................................................................... 29
3 Image...................................................................................................................................
Display
31
About Im age Displays
.......................................................................................................................................................... 32
About Contrast
.........................................................................................................................................................
Limits
34
About Contrast
.........................................................................................................................................................
Transformations
39
About Lookup
.........................................................................................................................................................
Tables
42
Using Raster Im
..........................................................................................................................................................
age Displays
43
Using Surface..........................................................................................................................................................
Plot Im age Displays
44
Using RGB Im age
..........................................................................................................................................................
Displays
45
Using Line Plot
..........................................................................................................................................................
Im age Displays
45
Using Line Plot
..........................................................................................................................................................
Legends
52
Using Speadsheet
..........................................................................................................................................................
Im age Displays
55
Using Im age Displays
..........................................................................................................................................................
w ith Com plex Data
55
4 Image...................................................................................................................................
Documents
56
Manipulating Annotations
.......................................................................................................................................................... 57
Editing Annotations
.......................................................................................................................................................... 61
About Targets.......................................................................................................................................................... 62
Setting Object..........................................................................................................................................................
Inform ation
63
Annotations .......................................................................................................................................................... 64
5 Image...................................................................................................................................
Processing and Analysis
68
Using Regions..........................................................................................................................................................
of Interest
68
Using Line Profiles
.......................................................................................................................................................... 73
Using Calibrations
.......................................................................................................................................................... 74
Using the Slice
..........................................................................................................................................................
Tool
76
Im age Processing
.......................................................................................................................................................... 77
Changing Data
.........................................................................................................................................................
Types
77
Using Image
.........................................................................................................................................................
Transformations
80
Using Filtering
......................................................................................................................................................... 82
Using Convolutions
......................................................................................................................................................... 86
Using Simple
.........................................................................................................................................................
Math
88
Copyright 2012 Gatan Inc. All Rights Reserved.
II
DigitalMicrograph
Fourier Processing
.......................................................................................................................................................... 89
Using Fourier
.........................................................................................................................................................
Transforms
90
Auto-Correlations
......................................................................................................................................................... 91
Cross-Correlations
......................................................................................................................................................... 92
Using Fourier
.........................................................................................................................................................
Masking
93
Im age Analysis
.......................................................................................................................................................... 97
Calculating.........................................................................................................................................................
Image Statistics
97
Using Histograms
......................................................................................................................................................... 97
Particle Analysis
......................................................................................................................................................... 98
Image Preparation......................................................................................................................................... 98
Thresholding
......................................................................................................................................... 99
Finding Particles......................................................................................................................................... 100
Analyzing Particles
......................................................................................................................................... 102
6 Images
................................................................................................................................... 103
Setting Im age
..........................................................................................................................................................
Inform ation
107
7 Reference
................................................................................................................................... 109
Toolbars
.......................................................................................................................................................... 109
File Tools ......................................................................................................................................................... 109
Standard .........................................................................................................................................................
Tools
110
Line Plot Tools
......................................................................................................................................................... 111
ROI Tools......................................................................................................................................................... 112
Masking Tools
......................................................................................................................................................... 112
Floating Palettes
.......................................................................................................................................................... 113
Histogram......................................................................................................................................................... 113
Display Control
......................................................................................................................................................... 113
Image Status
......................................................................................................................................................... 114
Target ......................................................................................................................................................... 115
Control ......................................................................................................................................................... 115
Slice
......................................................................................................................................................... 116
Progress ......................................................................................................................................................... 116
Acquisition
.........................................................................................................................................................
Status
116
Shortcuts .......................................................................................................................................................... 117
8 Scripting
................................................................................................................................... 118
Types and Variables
.......................................................................................................................................................... 127
Expressions.......................................................................................................................................................... 129
Statem ents .......................................................................................................................................................... 136
Functions .......................................................................................................................................................... 142
Objects
.......................................................................................................................................................... 146
Threading......................................................................................................................................................... 157
Event Handling
......................................................................................................................................................... 168
TagGroup.........................................................................................................................................................
Object
171
Menus ......................................................................................................................................................... 192
String Object
......................................................................................................................................................... 200
Document.........................................................................................................................................................
Object Model
203
Window Object ......................................................................................................................................... 203
Dialogs
......................................................................................................................................... 207
ImageDocument.........................................................................................................................................
Object
231
Image Object ......................................................................................................................................... 240
Component Object
......................................................................................................................................... 253
ImageDisplay Object
......................................................................................................................................... 261
RasterImageDisplay
.........................................................................................................................................
Object
269
SurfacePlotImageDisplay
.........................................................................................................................................
Object
271
LinePlotImageDisplay
.........................................................................................................................................
Object
273
Copyright 2012 Gatan Inc. All Rights Reserved.
Contents
III
ROI Object
......................................................................................................................................... 277
Im age Operations
.......................................................................................................................................................... 284
Packages .......................................................................................................................................................... 291
File Input and..........................................................................................................................................................
Output
291
Utility Functions
.......................................................................................................................................................... 299
Exam ple Scripts
.......................................................................................................................................................... 302
Tag Types......................................................................................................................................................... 302
Reference .......................................................................................................................................................... 305
Script Functions
.........................................................................................................................................................
By Category
305
Index
321
III
DigitalMicrograph
Digital Micrograph
by Gatan, Inc.
1.1
Overview
DigitalMicrograph
DigitalMicrograph is an application used for acquiring, visualizing, analyzing, and
processing digital image data, primarily within the context of electron microscopy. It can be
thought of as an environment that can be enhanced with different attachments (plug-ins) to
perform a variety of analytical tasks.
How does the DigitalMicrograph process work? With DigitalMicrograph and one of the
acquisition units, such as a CCD camera, you can acquire a digital image of a sample,
manipulate its display, analyze, process, print, and archive it for long-term storage.
Digital Micrograph
1.1.1
DigitalMicrograph
1.1.2
Basic Concepts
Basic Concepts
DigitalMicrograph presents all of its information through the use of windows. Each window
contains a set of related information.
Image document windows contain a visible representation of a page of paper. Images can be
placed on this page. Other objects such as lines, boxes, and text can also be placed on this
page. You can open, save, and print image document windows.
Many aspects of images and objects placed on pages can be controlled through the use of
palettes. Palettes "float" above image document and text document windows. You cannot
open, save, or print palettes. Palettes can be recognized by their small title bar.
Text document windows contain text. Text document windows do not hold any other
graphical objects. You can open, save, and print text document windows.
DigitalMicrograph can be extended to support acquisition devices through the use of plug-ins.
Plug-ins are placed in a folder named "PlugIns".
DigitalMicrograph can also run simple programs (called scripts) which carry out automated
tasks.
1.2
Basic Procedures
Basic Procedures
DigitalMicrograph lets you acquire, process, analyze, and present your images through its
easy-to-use commands and tools. Once you master the basics of using DigitalMicrograph,
you will want to learn more about the application and add more skills to your arsenal. This
chapter assumes you are familiar with the basic ideas of the mouse, manipulating windows
and menus, and launching applications on your computer. If you are not, please refer to the
manual that came with your computer.
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
1.2.1
DigitalMicrograph Environment
To start DigitalMicrograph
You launch DigitalMicrograph as you would any other application.
DigitalMicrograph
This screenshot shows DigitalMicrograph with only its basic plug-ins displayed. Actual
installation will have more plug-ins installed, which means that more menu items may
appear. Also the number of other windows can be different.
Key areas
Digital Micrograph
Menu bar
At the top is the menu bar containing the File, Edit, Display, Process, Analysis,
Window, Microscope and Help menus. In these menus are all the controls for
operating the application.
Tool bar
Under the menu bar is a toolbar. In this screenshot the File Tools, Standard
Tools and ROI tools are displayed. Other toolbars are available.
Floating Windows
On the left hand side several Floating Windows are displayed. In this
screenshot the basic set is shown: Histogram, Image Status, Target and
Display Control. Floating Windows can also appear on the right hand side of
the screen.
Result Window
At the bottom is the Results Window. This window is used to report results
and updates of operations performed by DigitalMicrograph.
Image Windows
All images are displayed in Image Windows. They can be displayed anywhere
in the application, and many images can be open at the same time.
To exit DigitalMicrograph
You can exit DigitalMicrograph when you're finished with it.
Choose Exit from the File menu, or
Hold down the Alt key and hit F4 to exit.
If any modified documents are open and haven't been saved, DigitalMicrograph asks
whether you want to save the documents.
You can exit without saving any of the files.
Hold down Control and Alt keys and hit F4 to exit.
1.2.2
DigitalMicrograph
Digital Micrograph
3. Click Open.
The image will open immediately.
DigitalMicrograph will alert you if it does not recognize the file type.
In order to open images that are not in the Gatan DigitalMicrograph file format, the
"Import/Export Plug-in" (which is shipped with DigitalMicrograph) should be in the
Plugins folder.
1.2.3
DigitalMicrograph
To resize around either the image or the page, click in the maximize box.
Re-sizing around an image or page will size the window so that the image or
page fits exactly within the window at its current resolution.
The Zoom tool will display a "+" inside the magnifying glass to indicate you will
be magnifying around the point at which you click.
Hold down the Alt key to demagnify. The Magnify Page tool will display a "-"
inside the magnifying glass to indicate you will be demagnifying.
You can also you the mouse wheel to zoom in and out around the location of
the image where the mouse is located.
To move the image around within the window (page mode only)
You can move the image within the window.
Click and drag the image within the image document with the Pointer tool.
1.2.4
Digital Micrograph
10
and Save Display As... With the Save and the Save As items you can save the image data;
with the Save Display As item you can save the screen rendering of your image document,
and with Save Numbered you can do either depending on the preferences you have supplied.
The same functions can also be accessed from the FileTools toolbar:
Note that the saving behavior has changed considerably from that in GMS 1.2 and all
earlier versions of GMS and DM.
The different image formats supported in DigitalMicrograph have different capabilities.
This means that at some times you may be presented with more format choices than
at other times. And sometimes the system has to ask for clarification on how to deal
with limitations of a particular format.
The Gatan file format is the only format that can save all information properly at all
times, and is the only choice when you are saving an image document that is
displayed in page mode.
If this is the first time you've saved the file, DigitalMicrograph displays the Save
As dialog box. Type in name for the file, choose the desired directory, choose
"Gatan Format (*.dm3)", and click Save.
If the image document has already been saved once or was loaded from a file,
DigitalMicrograph saves it to the same file, overwriting the previous version.
Choose Save As from the File menu to save to a new file.
DigitalMicrograph displays the Save As dialog box. Type a name for the file,
choose the desired directory, and click Save.
11
DigitalMicrograph
has certain limitations, and other applications implement different levels of TIFF
format. For example Adobe PhotoShop does not cope well with negative values
stored in images stored as signed 2-byte integer format - it assumes that they are
large and positive. This is the format generated by Gatan's MSC cameras. When
trying to save an MSC image with scale marker to TIFF the following will happen:
Choose Save from the File menu to save current image or click the Save button (
in the File Tools.
This dialog appears because your image contains an annotation (the scale
marker) and TIFF can not handle annotations as separate objects. So you are
given a choice to burn the annotation into the image data, or to ignore the
annotation. (Contrast limits and Survey limits can be slightly different and are
discussed elsewhere. Most of the time it doesn't matter very much which one
you choose.)
Hit the OK button.
Now the following warning dialog appears:
Digital Micrograph
12
13
DigitalMicrograph
Here you choose whether to save the image in the size displayed on the
screen, or in its full resolution. And you can choose to include the annotations.
Once again you can lock in on your choices so that you do not have to see this
dialog each time you save an image.
3. Hit the OK button.
The image will now be saved.
When you open this image in Adobe PhotoShop, you will see exactly the same
thing as in DigitalMicrograph.
You can set the directory in which to save the image documents, the name of
the series, and the number in the series that you want to begin with (see "
Setting Preferences").
For example, the first time you do this the image document will be saved with the
name "Image Series.1." The next time you do it, the image will be saved with the
name "Image Series.2."
Batch Convert
Using the Batch Convert... menu item images saved in Gatan Format can be
converted to different data formats. This procedure will always save the data or
Digital Micrograph
14
display at the resolution of the source data, and it will include the annotations in the
result. If the Gatan file contained an image document with more than one image, only
one of the images is exported and a message to this effect is printed to the results
window.
1. Choose Batch Convert from the File menu
The following dialog will appear
In this dialog you can enter the folder name by either typing it (make sure to
use back slashes as in the screen shot) or using the Browse... button. If you
want to convert all files in sub-folders of the selected folder as well, then check
the Convert sub-folders button.
2. Next choose to either save the image data in "Data Only" or MRC format, or save
the image display in BMP, JPEG or TIFF format. MRC format does not support all
data formats and if an image is encountered that can not be converted to MRC a
message will be printed to the results window.
3. Hit the OK button.
The procedure will now start converting all files in the selected folder and the
following progress window is shown.
15
DigitalMicrograph
1.2.5
Digital Micrograph
16
1.2.6
1.2.7
17
DigitalMicrograph
The Results window stores results from processing, analysis, and other aspects of
DigitalMicrograph.
Choose Open Results from the Window menu.
1.2.8
Digital Micrograph
18
The "Save Layout As" item allows you to save your current layout and give it a name.
Copyright 2012 Gatan Inc. All Rights Reserved.
19
DigitalMicrograph
When choosing "Manage Layouts" a dialog is displayed that allows you to rename and
delete existing layouts.
The items under the separator are the actual layouts you have saved. Choosing one of those
items forces all floating windows to be redrawn as defined by that layout.
1.2.9
Setting Preferences
) in the
Digital Micrograph
20
) in the
21
DigitalMicrograph
The Save Numbered panel will appear in the right side of the dialog box.
) in the
Digital Micrograph
22
4. Click OK.
Switching to a different panel will automatically save your choices.
To edit tags
DigitalMicrograph keeps an internal database of assorted information such as user
preferences, algorithm options, and other data vital to the operation of
DigitalMicrograph. You can directly edit this information.
Editing tags is an advanced use of DigitalMicrograph and should, in general, not be
performed unless you have explicit instructions on how to do so. It is possible to make
DigitalMicrograph unlaunchable by editing tags.
1. Choose Global Info from the File menu or click the Preferences button (
File Tools.
) in the
4. Click OK.
Switching to a different panel will automatically save your choices.
Session Information
When you acquire an image with a Camera or the DigiScan, DigitalMicrograph automatically
adds meta-data to the image. This meta-data can later be viewed to give information about
the image.
23
DigitalMicrograph
The meta-data is separated in 2 groups: microscope data and session data. They can be
viewed in the Global Info dialog under Session:Microscope Info and Session:Session Info.
(This dialog can look slightly different depending on the capabilities of the actual
microscope you are connected to.)
Here you can view and change information about the state of the microscope; some
fields are filled in automatically by DigitalMicrograph if the software can
communication with a microscope.
Digital Micrograph
24
With a clean install of DigitalMicrograph there will just be the three entries in the
General area, and the Custom area will be blank. To change the entries in the custom
area hit the
25
DigitalMicrograph
This dialog shows all the fields currently defined for the Session Info.
Image Info
Digital Micrograph
26
When acquiring an image, the previously defined microscope and session info will be
copied to the image, and it can be viewed using the Image Display Info dialog.
Opening the Image Display Info dialog will include the following 2 pages:
27
DigitalMicrograph
Note that all the information from the Global Info is copied over into the image. Also
note that the Session page for Image Display Info does not have a
button. Here
you can only view and edit the Session data, but you can not change what fields are
displayed in the Session page.
Importing Images
DigitalMicrograph can import some images stored in text or binary files with unrecognized file
formats. You will need to know certain information about the image stored in the file in order
to use this technique.
To import images
You need to know the data type and the width, height and depth of the image to import
a binary image. To import a text image, the pixels in the image need to be separated
by tabs. DigitalMicrograph can determine the width and height of text images if each
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
28
29
DigitalMicrograph
1.2.12 Databar
Databar
DigitalMicrograph contains a feature called the databar. This corresponds to displaying extra
information with the image, either in image mode or page mode. (For more info on image and
page mode see "About Targets").
Digital Micrograph
30
Custom items
Custom items can be defined using the Session Info page.
To view these items, hit the Custom Data... button. You will see the following dialog
(the contents depends on what you set-up under the Session Info):
31
DigitalMicrograph
button or the
button.
After creating the databar, you can change the location of each of the items. The new
locations can be made the new default setting by choosing the menu item Edit::Data
Bar:: Use as global default.
1.3
Image Display
Image Display
DigitalMicrograph provides several methods of displaying the data in an image. Some of the
methods are appropriate for only certain types of image data, while others work with any type
of image data.
The method that DigitalMicrograph uses to display an image is called the image display type.
DigitalMicrograph provides several image display types.
Raster image display.
Surface Plot image display.
RGB image display.
Line Plot image display.
Spreadsheet image display.
Each of these image display types has many options associated with it. Furthermore, some
of the image display types (such as RGB) are only appropriate for certain types of data (RGB
data only).
Digital Micrograph
32
1.3.1
About Transformations
DigitalMicrograph maps an image's original data values to a color or gray-scale value
Copyright 2012 Gatan Inc. All Rights Reserved.
33
DigitalMicrograph
2. Transform each mapped data value into a color index (see "About Contrast
Transformations").
The mapped image values are then transformed into a color index that
indicates which color in the color table to use for displaying a particular pixel.
The Contrast Transform lines in the Histogram depict how this transformation
is performed. DigitalMicrograph supplies a number of standard contrast
transform methods (see "To change the contrast transformation method") and
allows you to build a custom one if you desire (see "To edit the custom
Contrast Transformation line" ).
3. Display the pixel using the color table of the image (see "About Lookup Tables").
DigitalMicrograph uses the color index to correlate each color in the color table
with pixels with specific intensities in the image. DigitalMicrograph supplies a
number of standard color tables, such as the gray-scale table, for use in
images and allows you to build a custom one if you desire (see "To change
the color table" and "To adjust colors via Histogram palette" ).
About Histograms
DigitalMicrograph will automatically calculate the histogram of an image displayed
using Raster or Surface Plot display types, and display it in the Histogram palette. The
Histogram palette also displays the Contrast Transform lines and the color table in the
Color Bar on the left of the palette.
Digital Micrograph
34
The horizontal axis of the histogram represents data values with the left-most side
corresponding to the low contrast limit and the right-most side corresponding to the
high contrast limit. The vertical axis of the histogram represents the number of pixels
with a particular data value.
The histogram can be used to change the low- and high-contrast limits, to edit a
custom Contrast Transformation, and to change the color table.
1.3.1.1
Cross-wire
Checks the values only on a cross going through the center of the image. This
method is quite fast and immune to extreme values except under the cross. It will not
optimize the contrast if the desired features do not fall under the cross.
Sparse
Checks the values only on a distributed set of positions throughout the image. This
method is quite fast and immune to extreme values except under the distribution. It is
quite good at optimizing the contrast of the entire image.
Whole image
35
DigitalMicrograph
Checks the values at every single pixel. This method is much slower and not immune
to extreme values within the image. It is quite good at optimizing the contrast of the
entire image.
Reduction
Checks the values by dividing the image into 16 equal squares. This method is much
slower and not immune to extreme values within the image. It is quite good at
optimizing the contrast of the entire image.
None
Does not check the values. Relies on the user entering proper contrast limit values in
the Object InfoDisplay-Contrast dialog.
Digital Micrograph
36
4. Select the desired survey method from the Survey pop-up menu.
When choosing the sparse method you can specify how many samples
should be used in the total image for the survey.
5. Click OK
37
DigitalMicrograph
6. Click OK.
To ignore Outliers
Images can contain extreme outliers that can affect the contrast limits if the pixels
containing the outlier values are used for the survey. To prevent this from happening
you can choose to ignore a certain percentage of outliers.
Digital Micrograph
38
1. If you are viewing the image document in page mode, select the image for which
you want to set a minimum contrast limit value.
2. Choose Image Display under the Display menu, or hit Ctrl-D, or right click on the
display and select ImageDisplay... from the menu.
The Image Display Info dialog will appear.
3. Select Display->Contrast on the left side of the dialog.
The Contrast panel will appear in the right side of the dialog box.
4. Enter the desired percentage for low and high outliers to be ignored.
A very small percentage, such as 0.2 generally does the trick, unless you have
an extreme number of bad pixels.
5. Click OK.
To set up hysteresis
When acquiring images from hardware, noise in the images can cause different
contrast limits being calculated for each frame. This will cause some annoying flicker
in the overall image. To reduce this effect you can set a level of hysteresis, which
means that the contrast limits of an image will not be updated unless the survey finds
values outside a specified range.
1. If you are viewing the image document in page mode, select the image for which
you want to set a minimum contrast limit value.
2. Choose Image Display under the Display menu, or hit Ctrl-D, or right click on the
display and select ImageDisplay... from the menu.
The Image Display Info dialog will appear.
3. Select Display->Contrast on the left side of the dialog.
The Contrast panel will appear in the right side of the dialog box.
4. Enter the desired percentage for Min and Max after: "Update if min or max change
by".
5. Click OK.
39
DigitalMicrograph
1. If you are viewing the image document in page mode, select the image for which
you want to change the survey method.
2. Choose Image Display under the Display menu, or hit Ctrl-D, or right click on the
display and select ImageDisplay... from the menu.
The Image Display Info dialog will appear.
3. Select Display->Contrast on the left side of the dialog box.
The Contrast panel will appear in the right side of the dialog box.
4. Select your desired contrast settings.
5. Click on the Save Defaults button.
6. Click OK.
1.3.1.2
Linear
The Linear method maps data linearly from the contrast limits to the color index. It can
also apply a gamma transformation. Brightness, Contrast, and Gamma control the
offset, slope, and shape of the line used in the mapping. See "To change Brightness/
Contrast/Gamma graphically".
Equalized
The Equalized method maps data so as to optimize color usage based on the
histogram. Each color will have approximately the same number of pixels mapped to
it, so more colors will be used in intensity ranges with more pixels.
Pseudo-Contour
The Pseudo-Contour method maps data repeatedly in a linear fashion from the
contrast limits to the color index. The contrast and contours control the slope of each
contour line and the number of contours used in mapping. See "To change Contrast/
Contours".
Custom
The Custom method maps data according to a custom mapping. You change the
mapping in the Histogram palette. See "To edit the custom Contrast Transformation
line".
Digital Micrograph
40
41
DigitalMicrograph
2. Adjust the brightness, contrast, and gamma values in the Display Control palette.
To reset the values to 0.50 click the text below the slider.
To change Contrast/Contours
You can change the contrast and number of contours of an image using a Pseudo
Contrast contrast mode.
1. If you are viewing the image document in page mode, select the image for which you
want to adjust the number of contours and the contrast of the contours.
2. Choose Image Display under the Display menu, or hit Ctrl-D, or right click on the
display and select ImageDisplay... from the menu.
Digital Micrograph
42
43
DigitalMicrograph
5. Edit a color in the color table manually by double clicking on the color.
A dialog box asking you to select the new color will appear.
6. Edit a range of colors manually by dragging over the range of colors.
Two dialog boxes asking you for the color at the start of the range and the
color at the end of the range will appear.
7. Save the color table by clicking on the Save button.
A dialog asking for a filename to save it under will appear.
You do not need to save the color table, but if you don't save it, it will only be
available on this particular image.
8. Click OK.
1.3.2
To add/remove captions
DigitalMicrograph can display captions indicating the calibration of the image.
Captions are off by default.
1. If you are viewing the image document in page mode, select the image to which
you want to add or from which you want to remove captions.
2. Choose Image Display under the Display menu, or hit Ctrl-D, or right click on the
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
44
1.3.3
45
DigitalMicrograph
1.3.4
1.3.5
Digital Micrograph
46
You can control many aspects of how the image is displayed from the Line Plot panel
in the Image Display Info dialog.
1. If you are viewing the image document in page mode, select the image for which
you want to adjust the line plot data view.
2. Choose Display Type::Line Plot under the Display menu.
3. Choose Image Info... under the Display menu, or hit Ctrl-D, or right click on the
display and select Image Info... from the menu.
The Image Display Info dialog will appear.
4. Select Display::Line Plot on the left side of the dialog box.
The Line Plot panel will appear in the right side of the dialog box.
Change the desired low and high limits of image data to display in the Line Plot.
Editing these values automatically turns off automatic survey.
You do not need to enter values here if you want DigitalMicrograph to calculate
the value automatically.
47
DigitalMicrograph
All of the tools for changing the display range of the line plot work in log mode
just as they did in linear mode. You can change the display mode in 2 ways:
right click on the line plot display and choose "Linear Scale" or "Log
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
48
Scale", or
open the Image Info dialog, select the "Display:Line Plot" page, and
choose linear or log from the Scale group box.
Technical note:
It is impossible to take the logarithm of values 0 and smaller, and the logarithm
of values between 0 and 1 are negative. Therefore we want to avoid data
values less than 1. To accomplish this we first take the modulus of the data,
and then add 1 to all data before taking the logarithm. After applying the
logarithm, the sign of the original data is restored. The main result of this is
that if you have original data with values close to zero, then the linear plot and
the logarithmic plot will look very similar. For data much larger than 1 the
difference between this approach and the simple log of the data is negligible.
This is almost always the case for EELS data and makes this tool very useful.
Change the Auto Survey option
Auto Survey for the Low and High values can be set independently by checking
the appropriate check boxes.
Reset Auto Survey
When manually changing the survey, for example by dragging the axis,
DigitalMicrograph automatically turns off Auto Survey. To quickly turn Auto
Survey back on, you can double click the vertical axis.
Auto Survey Displayed Region
When checking "Displayed Region" then DigitalMicrograph will only use the
actual data displayed to calculate the display limits. So if you have an EELS
spectrum with a zero loss peak, and you zoom in on an area not containing
that peak, then DigitalMicrograph will automatically scale to optimize the view
of the displayed data. Here is the same spectrum as above, but with the zeroloss peak moved off the display:
49
DigitalMicrograph
Digital Micrograph
50
The Options panel will appear in the right side of the dialog box.
4. Check or uncheck the desired options.
5. Click OK.
Instead of using the Image Display Info dialog, you can also toggle display of the
legends by right clicking on the line plot, and then selecting Hide Legend or Show
Legend from the pop-up menu.
51
DigitalMicrograph
Digital Micrograph
52
1.3.6
53
DigitalMicrograph
To hide/show slices
Slices can be shown and hidden. The colored outline around the word "SliceX"
indicates that the slice is shown.
To show just one slice:
Double click on the legend and all other slices will be hidden, or
Right click on the legend, and choose Hide Others from the pop-up menu.
To hide a particular slice:
Right click on the legend, and choose Hide SliceX from the pop-up menu.
To show all slices:
Right click on the legend, and choose Show All from the pop-up menu.
To order slices
The order in which the legends are drawn indicates the order in which the slices are
drawn. Slices that are higher up in the order will be drawn behind slices that are
farther down.
You can change the order of the slices:
1. Right click on the legend of the slice you want to move in the order.
2. Select Send Behind or Bring to Front on the pop-up menu.
Note that if you have a slice in the foreground with its fill drawn, it can obscure
many slices behind it. This is why the default configuration has the background
slice drawn as Fill, and all other slices drawn as Lines.
To align slices
Slices can be aligned with respect to one another in different ways. If slices are
calibrated, the different slices will originally be aligned with respect to their calibration.
This means that the labels on the axes apply to all different slices. For any but the
back most slice, the alignment can be changed in the horizontal direction, vertical
direction or both.
Digital Micrograph
54
Choices for alignment in the horizontal direction are "Calibrated" and "Uncalibrated".
"Uncalibrated" means that the alignment is done based on pixels.
Choices for vertical alignment are "Calibrated", "Uncalibrated", "Integral", "Maximum"
and "Baseline". "Calibrated" and "Uncalibrated" alignment is similar to that for
horizontal alignment, except that here the intensity calibration of the data is used.
"Integral" alignment makes the area on both curves the same. "Maximum" alignment
sets the maxima the same, and "Baseline" alignment aligns the zero's of the
uncalibrated data, leaving the scale unchanged.
Vertical alignments can also be performed on a sub-set of the data by first creating a
selection on the Line Plot.
To attach/detach slices
When aligning slices as described above, you can only change the relative size and
position of the different slices in certain predefined ways. This is because the slices
are "attached". To give the user more freedom in positioning slices with respect to
one another, slices can be detached.
To detach a slice:
1. Right click on the legend of the slice you want to detach.
2. Select Horizontal Constraints from the pop-up menu.
3. From the sub-menu select "Detach", "Baseline Fixed" or "Scale Fixed".
When choosing "Detach" the slice is fully detached in the horizontal directly
and both the offset and scale can be changed. When choosing "Baseline
Fixed" only the scale can be changed and when choosing "Scale Fixed" only
the offset can be changed.
After fully or partially detaching a slice, the horizontal offset and/or scale of the slice
can be changed:
1. Click on the line plot.
A vertical line will be drawn.
2. Click near the vertical line and drag the mouse.
The whole slice will move wit the cursor.
3. Click near the vertical line, hold down the Control key, and drag the mouse.
The scale of the slice will change.
The slice can also be detached and moved vertically in the same way.
55
DigitalMicrograph
Recalibrate
After a slice has been detached and moved around it can acquire a new calibration.
Right click on the legend, and choose Recalibrate Slice from the pop-up menu.
1.3.7
1.3.8
Digital Micrograph
1.4
56
Image Documents
Image Documents
DigitalMicrograph stores images in image documents that contain a representation of a
printed page upon which you can lay out images, objects, and other annotations.
Image documents are displayed in image windows and contain a graphical representation of
a page upon which images, objects, and annotations can be placed.
About pages
When you want to print your page to a laser, dye-sublimation, or other type of printer,
you will need to lay out your images, objects, and annotations upon the page.
DigitalMicrograph can represent this page graphically within an image window. The
image document may also contain images, objects, and annotations that lay outside
the boundaries of the page. DigitalMicrograph keeps track of objects both on and off
the page.
The page is represented by the white area in the image window. The rectangular
dotted outline indicates the printable area of the page. Any objects or portions of
objects outside this rectangle will not be printed.
About objects
Objects in DigitalMicrograph are any item within an image document that can be
manipulated directly. Objects include images, boxes, arrows, lines, ovals, masks,
particles, scale markers, etc.
Objects are attached to a parent. The default parent is called a target. The parent can
either be the page itself or an image on the page. Objects will move and scale with
their parent. For example, an object attached to an image will move when the image is
moved and become larger or smaller when the image is made larger or smaller.
About modes
An image document has two modes by which you can view it. In page mode, a
representation of the page is displayed and you can lay out multiple images on the
page. In image mode, a single image is displayed. Its position on the page is set by
switching to page mode, adjusting its position, and then switching back to image
mode.
About targets
In page mode, when you add a simple object such as a text annotation, a line, or a
box to an image document, it is attached to a target. The target can either be the page
or an image contained in the image document. Objects attached to the page will move
and scale when the page is moved or scaled. Objects attached to an image will move
57
DigitalMicrograph
About images
Images are special objects within DigitalMicrograph. Since one of the primary
purposes of DigitalMicrograph is to deal with images, many operations will act upon
an image object within an image document. For example, there may be four images
contained within an image document. In order to rotate one of them you will have to
select one of the images if you are in page mode and then perform the rotate
command from the menu. If you are in image mode, the image choice will already be
obvious since there will be only one image displayed.
1.4.1
Manipulating Annotations
Manipulating Annotations
You will need to manipulate objects, such as images and annotations, in order to print or
otherwise present your data.
To select objects
When you have multiple objects within an image window and you want to manipulate
one of them (for example delete it), you will need to select the desired objects.
You select objects in two different ways.
To select a single object, click on the object with the Pointer tool.
To select multiple objects, drag around the objects with the Pointer tool.
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
58
You can extend the current set of selected items by holding down the Shift key while
selecting a new item.
You can reduce the current set of selected items by holding down the Shift key while
selecting an already selected item.
To move objects
Many objects can be directly moved. Other objects are intrinsically associated with an
image (such as a Fourier or particle mask) and cannot be directly moved. Be careful
not to drag any of the green handles on an object since that will change the object
instead of moving it (it may change the size of a box, for instance).
To move objects, click and drag the object with the Pointer tool.
To move multiple objects, first select and then drag the objects with the
Pointer tool.
Objects can also be moved to other image documents or to another application.
When you drag an object outside of its image document window, it will change to an
outline and you can drag this outline to other applications and other image document
windows (see "To drag and drop objects").
59
DigitalMicrograph
What happens when you drag one of the handles on an object depends on the object.
Dragging on any of the four handles of a box annotation will change the size of the
box. Dragging on any of the four handles of a text annotation will only move the text
annotation. The size of a text annotation is determined by the size of the font and this
is set through a menu.
To group objects
You can group objects together.
1. Select the objects you want to group together.
Grouped objects must all belong to the same parent. The resulting group will
belong to the same parent.
Digital Micrograph
60
To ungroup objects
You can ungroup objects that have been previously grouped.
1. Select the groups you want to ungroup.
2. Choose Ungroup from the Display menu.
The resulting individual objects will belong to the parent that the group
belonged to. For instance, ungrouping a group attached to an image will result
in the individual objects being attached to the image.
To detach an object
You can detach an object attached to an image and re-attach it to its page.
1. Select the objects attached to an image.
If multiple objects are selected, they must all be attached to the same image.
2. Choose Detach from the Display menu.
61
DigitalMicrograph
To align objects
You can align multiple objects to one another.
1. Select the objects you wish to align.
The objects must be attached to the same parent.
2. Choose the desired alignment from the Align submenu under the Display menu.
3. You can align horizontal centers, vertical centers, or both.
1.4.2
Editing Annotations
Editing Annotations
DigitalMicrograph provides many standard methods for moving objects between image
documents and to other applications.
Digital Micrograph
62
window. If you drop it back in the same window, it will move the object to the
new location.
An image displayed in image mode (as opposed to Page mode) or an image as the
default target in Page mode, can be dragged by holding down the right mouse button.
1.4.3
About Targets
About Targets
Objects are always attached to a parent. The default parent is called a target. The target can
be either the page or an image on the page. If you are in image mode, the target is always the
image. If you are in page mode, you can select either the page or the image as the target.
Objects attached to the page are independent from the images and move and scale with the
page.
Objects attached to images move and scale with that image, but are independent from the
other images on the page.
Click on the radio button to the left of "Page" to switch to page mode.
Click on the radio button to the left of the image that you want to switch to
Copyright 2012 Gatan Inc. All Rights Reserved.
63
DigitalMicrograph
image mode.
1.4.4
Digital Micrograph
Add
Remove
64
5. Click OK.
Switching to a different panel will automatically save your choices.
1.4.5
Annotations
Annotations
You can add annotations such as rectangles, ovals, lines, arrows, and text to an image
document. Annotations will be attached to the selected target by default. You can detach or
attach them as desired.
To add an annotation
You can use the tools in the Standard Tools palette to add annotations.
1. Select the desired tool from the Standard Tools toolbar.
You can choose the Text, Line, Rectangle, or Oval tool.
65
DigitalMicrograph
Digital Micrograph
66
You can view and edit the x and y positions, the length, and the rotation of the line
using the Control palette.
The X and Y controls display the calibrated coordinates of the anchor point of the line.
The calibrated coordinates are in terms of the parent of the line object.
The L control changes the length of the line while holding the anchor point constant.
The R control changes the rotation of the line while holding the anchor point constant.
You can change the anchor point by clicking on different control points on the line
annotation.
67
DigitalMicrograph
Digital Micrograph
68
In this dialog select the Font, the Font style and the Size.
5. Set the text alignment by choosing the desired alignment from the Text Alignment
submenu under the Display menu.
Text alignment refers to how the text is aligned within the annotation. It will only
apply to text annotations spanning multiple lines.
1.5
1.5.1
69
DigitalMicrograph
The ROI Tools provides a set of tools for indicating regions of interest.
Digital Micrograph
70
71
DigitalMicrograph
Regions of interest are just additional objects attached to images. You can move
them around as desired. You can also select, deselect, copy, drag, and delete them.
You can edit rectangular and line regions of interest.
Edit rectangle and line regions of interest by dragging their handles.
Hold down the Shift key while changing a rectangular region of interest to
restrict it to be a square.
Hold down the Alt key while changing a rectangular region of interest to restrict
it to be a rectangle with a side that is a power of two (useful when performing
FFTs).
Hold down the Shift key while changing a line of interest to restrict it to 45 or
90.
Digital Micrograph
72
73
1.5.2
DigitalMicrograph
Digital Micrograph
1.5.3
74
Using Calibrations
Using Calibrations
DigitalMicrograph allows you to calibrate an image so that the row, column, and intensity
correspond to physical values. Calibrations can be performed using the Image Display Info
dialog or using a line of interest.
The calibration uses two numbers, offset and scale, to translate each dimension to a
corresponding physical value. For instance, an image that is 1000 pixels wide could be
calibrated so that each pixel corresponded to 3 nm (scale) and the left-most pixel could
represent 42 nm (negative offset). The right-most pixel would then represent 3042 nm.
In addition to the two numbers, offset and scale, you need to enter the units.
75
DigitalMicrograph
Digital Micrograph
76
To calibrate automatically
Some acquisition plug-ins will automatically calibrate the image when you acquire an
image. Follow the instructions for the particular acquisition plug-in in order to calibrate
automatically.
1.5.4
77
DigitalMicrograph
2. Select the three-dimensional image for which you want to change the slice.
The Slice window will be disabled if the data is not three dimensional.
3. Drag the top slider to adjust the slices displayed.
4. Drag the bottom slider to adjust the number of slices to be integrated and displayed
simultaneously.
5. Check the Display Center check box to show all coordinates with respect to the
center.
1.5.5
Image Processing
Digital Micrograph
78
79
DigitalMicrograph
Digital Micrograph
80
A dialog asking you for the RGB conversion method will appear after you click
OK.
3. Select the desired conversion method.
4. Click OK.
The data type will be changed as specified.
To flip an image
You can flip an image horizontally or vertically.
1. If you are viewing the image document in page mode, select the image you want to
flip.
81
DigitalMicrograph
To rotate an image by 90
You can rotate an image by 90 in either direction (right or left).
1. If you are viewing the image document in page mode, select the image you want to
rotate by 90.
2. Choose Rotate Right or Rotate Left from the Edit menu.
The image will be rotated in the direction you specified.
To scale an image
You can scale an image to a different size. Scaling involves resampling the data. You
can resample the data in different ways.
1. If you are viewing the image document in page mode, select the image you want to
scale.
2. Choose Scale under the Process menu.
A dialog will appear asking for the new image size and resampling method.
The bottom of the dialog will display the memory requirements for the new
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
82
image.
3. Choose whether you want to constrain the proportions.
If you constrain proportions, the new image will have the same proportions as
the source image.
4. Choose whether to specify each dimension by pixels or by percentage of source
image dimension.
5. Enter the new dimensions.
If the proportions are constrained, you only need to enter one of the
dimensions (the other will be calculated for you).
6. Select the resampling method, either Bilinear or Nearest Neighbor.
You can choose Bilinear so that pixels in the new image that map in between
pixels in the source image will be found by bilinear interpolation of the fourpixels units around the pixel in the source image. You can choose Nearest
Neighbor so that pixels in the new image that map in between pixels in the
source image will be found by taking the nearest pixel to a pixel in the source
image.
7. Click OK.
A new image will be created as specified.
Using Filtering
Using Filtering
83
DigitalMicrograph
DigitalMicrograph supplies several types of image filters. Image filters are divided into two
major categories: spatial and non-linear.
1. If you are viewing the image document in page mode, select the image you want to
sharpen.
2. Choose Sharpen from the Spatial Filter submenu under the Process menu.
A new image will be created that is the sharpen-filtered image of the original.
1. If you are viewing the image document in page mode, select the image you want to
smooth.
Digital Micrograph
84
2. Choose Smooth from the Spatial Filter submenu under the Process menu.
A new image will be created that is the smooth-filtered image of the original.
1. If you are viewing the image document in page mode, select the image for which
you want to enhance the edges.
2. Choose Laplacian from the Spatial Filter submenu under the Process menu.
A new image will be created that is the Laplacian-filtered image of the original.
Both kernels are applied to the source image and the resulting two images are
combined by taking the square of each, adding them together, and then taking the
square root of the result.
1. If you are viewing the image document in page mode, select the image for which
you want to enhance the edges.
2. Choose Sobel from the Spatial Filter submenu under the Process menu.
A new image will be created that is the Sobel-filtered image of the original.
85
DigitalMicrograph
Median
The median of the values in the neighborhood is used in the destination image.
This filter is a type of smoothing filter.
Minimum
The minimum of the values in the neighborhood is used in the destination
image. This filter is used to eliminate bright objects.
Maximum
The maximum of the values in the neighborhood is used in the destination
image. This filter is used to eliminate dark object.
Range
The difference between the minimum and the maximum of the values in the
neighborhood is used in the destination image. This filter can be used to find
edges of features, or to distinguish textures.
Midpoint
The average of the minimum and the maximum of the values in the
neighborhood is used in the destination image. This filter is a type of
smoothing filter.
You can specify the size and shape of the neighborhood used in the calculations.
1. If you are viewing the image document in page mode, select the image on which
you want to perform median filtering.
2. Choose a filter from the Non-Linear Filter submenu under the Process menu.
A dialog will appear asking for the size and shape of the filtering window.
3. Select the desired neighborhood window shape.
The shape can be either a horizontal line, vertical line, cross, or entire
neighborhood.
4. Select the desired neighborhood size.
The larger the size, the slower the operation.
5. Click OK.
A filtered image will appear.
Digital Micrograph
1.5.5.4
86
Using Convolutions
Using Convolutions
Spatial convolution is an operation in which each pixel in an image is replaced with a
weighted sum of its surrounding pixels. The array of weights for each of the surrounding
pixels is called a kernel. The square root of the number of surrounding pixels used is called
the size of the kernel.
In "Using Filtering" some pre-built convolutions were shown, such as Sharpen, Smooth,
Laplacian and Sobel. In that section the kernels used in the convolution could not be
modified.
DigitalMicrograph provides a number of built-in kernels that you can use when processing
images. You can also add your own kernels.
87
DigitalMicrograph
To import a kernel
You can import a kernel in a text file into DigitalMicrograph. The kernel in the text file
must have integer numbers arranged into rows of numbers. Each row should be
separated by a Return and each number should be separated by a comma or a
Space.
1. Select an image.
2. Choose Convolution from the Spatial Filters submenu under the Process menu.
3. Click the Import button.
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
88
89
DigitalMicrograph
1.5.6
Fourier Processing
Fourier Processing
Fourier transforms reveal the periodic contents of images. They are useful for image analysis
and filtering. DigitalMicrograph supports a number of different operations involving Fourier
transforms.
A fast Fourier transform is a special algorithm for quickly calculating a Fourier transform on a
source image having dimensions that are powers of two (i.e. 2, 4, 8, 16, 32, 64, etc.) Armed
with this size requirement, Fast Fourier Transforms (FFTs) are significantly faster than
straightforward calculation of the discrete Fourier transform (DFT).
Using DigitalMicrograph, you can calculate a Fourier transform based on any image (except
RGB images) with the appropriate dimensions. Fourier transforms will also work on
(appropriately sized) regions of interest placed on an image.
The result of a Fourier transform on a real-valued image is a complex image that is Hermitian
in nature. This means that the image is symmetrical around the center (with symmetric
points being complex conjugates of one another). The resulting transform represents the
source image in frequency space.
The result of a Fourier transform on a complex-valued image is another complex image that
is not Hermitian in nature. The resulting transform represents the source image in frequency
space.
You can also perform inverse Fourier transforms, which transform from frequency space to
real space. If the source for the inverse Fourier transform is Hermitian, the result will be a
real-valued image. If the source image is regular complex, the result will be another complexvalued image.
Digital Micrograph
90
Packed complex image data takes up less space in memory because it is "packed" in
a special way so only half of the data is stored. However, packed data is not as easily
managed in memory because special algorithms are needed to unpack the data.
You can change an image stored as packed complex data to full complex data (and
release some of the restrictions placed on the image) by converting its data type to
complex.
1.5.6.1
91
DigitalMicrograph
Auto-Correlations
Auto-Correlations
Auto-correlation is useful for quantifying the resolution attained in an image and for
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
92
To auto-correlate an image
You can calculate an auto-correlation of an image.
1. Click on your image.
The source image must have dimensions that are powers of two.
2. Select Auto Correlation from the Process menu.
The auto-correlated image will appear.
1.5.6.3
Cross-Correlations
Cross-Correlations
Cross-correlation is useful for determining how similar two images are and for determining
how much an image has shifted with respect to another image (in the case of a time
sequence, for instance). DigitalMicrograph performs cross-correlation in the following way:
1. It performs a Fourier transform on each of the two source images.
2. It multiplies the Fourier transform of the first image by the complex conjugate of Fourier
transform of the second.
3. It calculates the inverse Fourier of the resulting image.
A cross-correlation with the same input images is equivalent to an auto-correlation.
93
DigitalMicrograph
Digital Micrograph
94
95
DigitalMicrograph
the rings is the mask. The two rings are always centered about the center of the
Fourier transform, but the radius of each of the rings can be changed by dragging
their selection handles.
1. If you are viewing the image document in page mode, select the image to which
you want to add a Band Pass mask.
2. Click on the image with the Band Pass mask tool.
A Band Pass mask will appear at the center of the image.
3. Adjust the position of the two band-pass frequencies.
Digital Micrograph
96
97
DigitalMicrograph
1.5.7
Image Analysis
1.5.7.1
Using Histograms
Using Histograms
DigitalMicrograph can automatically calculate the histograms of images with Raster or
Surface Plot displays.
A histogram based on the displayed image is shown in the Histogram palette. A more detailed
histogram can be generated and displayed in a line plot image display. The histogram will
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
98
Particle Analysis
Particle Analysis
DigitalMicrograph provides many features for particle analysis. The basic steps for analyzing
particles are to prepare the source image for particle analysis, threshold the source image,
find the particles, and finally analyze the particles.
1.5.7.3.1 Image Preparation
Image Preparation
Image preparation attempts to distinguish the particles from non-particle portions of the
image (such as the background of the image). This step is the precursor to thresholding the
image.
99
DigitalMicrograph
Minimum or Maximum filters. Then subtract the resulting background from the original
image.
1. If you are viewing the image document in page mode, select the image of which
you want to flatten the background.
2. Apply an appropriate filter to generate a background image.
The Minimum filter can be used when the background is darker than the
particles.
The Maximum filter can be used when the background is lighter than the
particles.
3. Use simple math to subtract the background from the original image.
You will now have an image with the background flattened.
1.5.7.3.2 Thresholding
Thresholding
The process of separating the particles from the rest of the image is called thresholding. In
order for thresholding to be effective, you must start with an image in which the particles are
easily distinguishable in the histogram. Ideally, a histogram of an image containing particles
will contain two major peaks: one for the background, and one for the particles. In practice,
the peaks may not be clearly distinguished.
To threshold an image
You can threshold an image using a histogram.
1. If you are viewing the image document in page mode, select the image you want to
threshold.
2. Choose Start Threshold under the Particles menu.
A line plot with the histogram will appear.
You can stop thresholding by choosing Stop Threshold under the Particles
menu. Do not do this until you are completely done with the particle analysis.
3. Use the Pointer tool to make a selection on the histogram.
The area on the source image corresponding to the selected area on the histogram
will be highlighted in green.
4. Change the selection on the histogram as desired.
Digital Micrograph
100
The source image mask will change when you change the selection on the histogram.
Finding Particles
Once you have a threshold defined for the image, you can have DigitalMicrograph find the
individual particles for you.
Once you find the particles, you can analyze all of them or certain particles individually. Each
particle mask can be selected or deselected. Analysis works on the selected particles. You
can delete, cut, copy, and paste selected particles.
To find particles according to threshold
You can find particles once an image has been thresholded.
1. Threshold the image on which you want to find particles.
See "To threshold an image".
2. Choose Find Particles under the Particles menu.
The individual particles will be shown in red. They will be all selected as well,
which is indicated by the yellow outline.
You can change what particles are selected by clicking on individual particles. Hold
down the Shift key to toggle the particle's selected status. Or use the Pointer tool to
select an area within which all particle will be selected.
101
DigitalMicrograph
To do particle outlining
You can outline particles.
1. Select the particles you want to outline.
2. Choose Outline from the Particles menu.
The selected particles will be outlined.
To do particle skeletonization
You can skeletonize particles.
Digital Micrograph
102
Analyzing Particles
Once the particles are defined and found, you can analyze the particles. Analyzing the
particles consists of measuring certain parameters such as area, perimeter, dimensions,
etc. for each particle.
103
DigitalMicrograph
To analyze particles
Once you have found the particles and selected the measurements to make, you can
analyze the particles.
Choose Analyze Particles under the Particles menu.
This may take some time. The progress of the analysis is shown in the Progress
Palette.
When the analysis is complete, each analyzed particle will be labeled with a number
and a spreadsheet with the measurements will appear.
1.6
Images
Images
Manipulating, acquiring, displaying, and storing images is the primary purpose of
DigitalMicrograph. This section gives a quick introduction to the basic concepts associated
with images.
DigitalMicrograph deals primarily with images. Each image is represented by a set of
numbers called pixels. For instance, an image that is 200 pixels wide and 300 pixels tall is
represented by 200 x 300 = 60,000 numbers. These numbers are arranged to match the
dimensions of the image, i.e. into 300 rows of 200 numbers each (an array).
Since images are represented by so many numbers, they take up large amounts of memory.
Each image will take up enough memory to store its numbers plus enough memory to display
the image.
DigitalMicrograph also displays images. Images can be displayed in a number of ways, e.g.
similar to a photograph, in a spreadsheet, etc. Images can also be calibrated so that each
pixel's value and location has a physical meaning.
Binary
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
104
Pixels represented by 1s and 0s. Each pixel takes one byte of memory.
Integer
Pixels represented by whole, integer numbers. Numbers can be signed
(positive and negative) or unsigned (positive only). Each pixel can take one,
two, or four bytes of memory.
Real
Pixels represented by real numbers. Each pixel can take four or eight bytes of
memory.
Complex
Pixels represented by two real numbers, the real and imaginary components.
Each real number can be represented by either four or eight bytes of memory.
Thus, each complex pixel can be represented by either eight or sixteen bytes
of memory for each pixel.
RGB
Pixels represented by four unsigned one-byte integers, the red, green, blue,
and alpha channels.
105
DigitalMicrograph
Real Component.
Takes the real portion of the complex number.
Imaginary Component.
Takes the imaginary portion of the complex number.
Modulus.
Takes the modulus or magnitude of the complex number.
Log of modulus.
Takes the natural logarithm of the modulus of the complex number.
Phase.
Takes the phase of the complex number.
Digital Micrograph
106
About Calibrations
An image is simply a set of numbers arranged into rows and columns.
DigitalMicrograph allows you to calibrate an image so that the row and column
correspond to a physical distance.
For example, if you have an image that is 200 x 300 pixels, it may represent a physical
sample that is 25 x 37.5 nm. DigitalMicrograph could treat each pixel as if it were 25
nm /200 pixels = 0.125 nm wide. Then, whenever DigitalMicrograph reported
measurements, or positions of pixels, it would report them in nanometers instead of
pixels.
Furthermore, in applications such as Atomic Force Microscopy, the intensity of a
particular pixel can be calibrated to represent a physical value.
For example, if you have an image with intensity values in the range of 200 to 1400,
these values may actually represent the physical height of the sample ranging from 30
nm to 210 nm. DigitalMicrograph could treat each pixel value to represent 30 nm/200
= 0.15 nm per intensity unit. Then, whenever DigitalMicrograph reported the value of a
pixel, it would report it in nanometers instead of a raw number.
107
1.6.1
DigitalMicrograph
5. Click OK.
Switching to a different panel will automatically save your choices.
Digital Micrograph
108
109
DigitalMicrograph
The Tags panel will appear in the right side of the dialog box.
4. Enter the information in the right portion of the dialog box.
A list of tags is displayed. You can use the twist-down controls to open up
groups and lists of tags.
Edit
Add
Remove
5. Click OK.
1.7
Reference
Reference
1.7.1
Toolbars
Toolbars
1.7.1.1
File Tools
File Tools
The File Tools toolbar contains the most used commands from the File and Edit menus.
If this toolbar is not open, then double click on the toolbar to get the Customize Toolbar dialog.
Select File Tools and hit Close. If no toolbar exist, select Customize Tools from the Window
menu to open the same dialog.
Explanation
Open, New Script, Save, Save Numbered, Save Display and Print perform the same
action as the matching items in the File menu. Preferences opens the Global Info
dialog.
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
110
Add Databar performs the same action as the Add Databar item in the Edit::Data Bar
sub menu. Delete Databar does not have an equivalent menu item. See Databar for
more info on the databar functionality.
Print Preview puts the image document in Page mode and applies the Databar.
1.7.1.2
Standard Tools
Standard Tools
DigitalMicrograph initially includes a Standard Tools palette with 10 tools. Plug-ins to
DigitalMicrograph can add more tools to this palette so yours may look different.
If this toolbar is not open, then double click on the toolbar to get the Customize Toolbar dialog.
Select Standard Tools and hit Close. If no toolbar exist, select Customize Tools from the
Window menu to open the same dialog.
You can click on a tool to make it the active one. Some tools can only be used once, after
which the palette will reset to the Pointer Tool. If you want to repeatedly use one of those
tools, you can right click on it to make it the default tool.
Pointer Tool
This is the standard tool for selecting and moving objects, such as windows, ROI's
and annotations .
Hand Tool
The Hand tool is used for moving the image display within the window.
Magnifying Glass
The Magnifying Glass is used for zooming in on the image. Hold down the Alt key to
zoom out.
111
DigitalMicrograph
Digital Micrograph
1.7.1.4
112
ROI Tools
ROI Tools
Regions of Interest (ROI's) are used to select certain parts of an image. For example, the
Rectangle ROI tool can be used to select a section of an image that can then be copied and
pasted elsewhere.
If this toolbar is not open, then double click on the toolbar to get the Customize Toolbar dialog.
Select ROI Tools and hit Close. If no toolbar exist, select Customize Tools from the Window
menu to open the same dialog.
More information about ROI tools can be found in "Using Regions of Interest".
1.7.1.5
Masking Tools
Masking Tools
The Masking Tools are most often used for Fourier Filtering. For detailed information about its
usage, see "Using Fourier Masking".
If this toolbar is not open, then double click on the toolbar to get the Customize Toolbar dialog.
Select Masking Tools and hit Close. If no toolbar exist, select Customize Tools from the
Window menu to open the same dialog.
113
1.7.2
DigitalMicrograph
Floating Palettes
Floating Palettes
1.7.2.1
Histogram
Histogram
The Histogram palette displays the histogram of the currently selected image, if the image is
displayed in Raster or Surface Plot mode. It also shows the Color table, and the Contrast
Transform curves used for calculating the index in the Color Table from the image data.
Display Control
Display Control
The Display Control palette is used to change the contrast, brightness and gamma of image
displayed in raster or surface plot mode, and using a linear color transformation.
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
114
Image Status
Image Status
The Image Status palette shows information about the currently selected image at the current
location of the cursor.
The first three lines display which image the data refers to (here Image B), the data type (here
Integer 4 Byte Signed), and the size of the image (here 256 by 256 pixels).
Next are the X and the Y location. These are here displayed in calibrated units with respect to
the origin. And finally the intensity value, also displayed in calibrated units.
The values for X, Y and Value can also be displayed in non-calibrated units by disabling the
calibration.
See "Using Calibrations" for information on how to set the image and intensity calibrations,
Copyright 2012 Gatan Inc. All Rights Reserved.
115
DigitalMicrograph
Target
Target
The Target palette is used to set the view mode, select the target when in Page mode, and to
enable/disable calibrations.
Target selection is useful when applying annotations since annotations are always attached
to a target (see "About Targets").
The Target palette displays a small ruler before each image that is calibrated. Clicking on this
ruler will enable/disable display of the calibrations (see "Using Calibrations").
1.7.2.5
Control
Control
The Control palette is used to view and edit annotation location. See "Annotations".
The Control Palette shown here is used for Rectangle and Oval annotations. It displays X and
Y position, plus Width and Height.
A different version used for Line annotations displays X, Y, Length and Rotation.
A version used for image display annotations is similar to the one displayed here, plus it has
an entry labelled Zm for Zoom.
Digital Micrograph
1.7.2.6
116
Slice
Slice
The Slice palette is used to select a slice in a three dimensional image.
Progress
Progress
The Progress Window can contain 3 lines of text to inform the user about the progress of a
lengthy operation. It is also easy to use it from the scripting language through the function:
1.7.2.8
Acquisition Status
Acquisition Status
The Acquisition Status window is used by a couple of DigitalMicrograph plug-ins to inform the
user of the status of a long process. This is similar to the usage of the Progress window.
117
1.7.3
DigitalMicrograph
Shortcuts
Shortcuts
DigitalMicrograph provides many keyboard shortcuts. Most of those shortcuts are equivalent
to menu items and the shortcut can be read on the menu item. For example in the File menu,
the Open... item has "Ctrl+O" listed on it. This means that pressing the "O" key, while holding
down the Control key will be equivalent to choosing Open... from the File menu.
Some other shortcuts in DigitalMicrograph are not displayed on menu items:
Shift-Ctrl-W
Close all windows, but ask the user whether to save them, if needed.
Alt-Shift-Ctrl-W
Close all windows, including the Results window, and do not ask the user if data
needs to be saved.
If you want to just close all the image windows, you can hold down the Alt, Ctrl and
Shift keys and then click in the close box of one of the image windows. In a similar
way can you close all script windows.
Alt-Ctrl-W
Close the foremost window without asking the user if the related data needs to be
saved.
You can also hold down the Alt key, and then click in the close box of the image
window you want to close.
Alt-Ctrl-F4
Close DigitalMicrograph without asking the user to save any data.
Alt-Ctrl-V
Paste image data in the paste buffer in a new image document window.
Alt-Ctrl-X
Cut the ROI from the image.
With the normal Cut command on the File menu, or with Ctrl-X, you cut the data in the
ROI. When you hold down the Alt key as well, you actually cut the ROI itself, which
you can then paste into another document.
Alt-Ctrl-C
Copy the ROI from the image.
With the normal Copy command on the File menu, or with Ctrl-C, you copy the data in
the ROI. When you hold down the Alt key as well, you actually copy the ROI itself,
which you can then paste into another document.
Digital Micrograph
118
Alt-Ctrl-H
Show the options dialog for setting the number of channels in the Histogram and then
display the histogram. See "Using Histograms".
Alt-Ctrl-T
Show the options dialog for setting the number of channels in the Histogram and then
display the histogram for Thresholding. See "Thresholding".
1.8
Scripting
Scripting
The DigitalMicrograph script language allows the customization of DigitalMicrograph's image
acquisition and processing capabilities to accommodate user specific applications.
A brief overview of some of the simplest features is given in this chapter.
Getting Started
Scripts are lists of instructions to DigitalMicrograph.
A typical procedure for performing some calculation upon an image is as follows:
119
DigitalMicrograph
Within a script, you can refer to different images with their letters. Each image
within DigitalMicrograph will have a unique letter.
c = a + b
This script will create a new image "c" which would contain the sum of "a" and "b".
So the whole procedure for using this script is as follows:
Digital Micrograph
120
This insures that the two images we are going to create end up labeled "a" and
"b".
4. Open a script editor window by choosing New Script under the File
menu.
5. Type in the script "c=a+b" into the window.
6. Press Ctrl-Enter to run the script.
Notice that a new image has been created which is the sum of the other two
images.
You can also store the images back into themselves. For instance, instead of
creating a new image "c", you could just type:
a = a + b
This way, the new image "a" would contain the sum of the old image "a" and
the image "b".
Note: Any images appearing in expressions in this chapter must be the same
size. If the images are of different sizes, the examples in this chapter will not
work.
121
DigitalMicrograph
a = a[] + b[]
would be illegal since the area of "a[]" and "a" is different.
Mathematical Functions
The are many predefined mathematical functions available for use in scripts. A partial
list is given below:
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
a + b
a - b
a * b
a / b
-a
a ** 4
abs(a)
acos(a)
asin(a)
atan(a)
atan2(a,b)
atanh(a)
cos(a)
cosh(a)
exp(a)
exp1(a)
exp2(a)
exp10(a)
log(a)
log1(a)
log2(a)
log10(a)
max(a)
min(a)
mod(a)
rem(a)
round(a)
sin(a)
sinh(a)
sqrt(a)
tan(a)
tanh(a)
trunc(a
!a
a && b
a || b
a != b
// addition
// subtraction
// multiplication
// division
// negation
// power
// absolute value
// arc-cosine
// arc-sine
// arc-tangent
// arc-tangent of a/b
// arc-hyperbolic tangent
// cosine
// hyperbolic cosine
// exponential
// exponential - 1
// 2 raised to the power of a
// 10 raised to the power of a
// logarithm
// logarithm of a + 1
// log base 2
// log base 10
// maximum value of a
// minimum value of a
// modulo
// remainder
// rounded
// sine
// hyperbolic sine
// square root
// tangent
// hyperbolic tangent
// truncated
// logical NOT
// logical AND
// logical OR
// not equals (result 1 or 0)
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
b
b
b
b
=
=
=
=
a == b
a < b
a > b
a <= b
or 0)
b = a >= b
1 or 0)
//
//
//
//
122
equals (result 1 or 0)
less than (result 1 or 0)
greater than (result 1 or 0)
less than or equal (result 1
All of the functions act upon each pixel of an image in turn. For instance, saying
a = a < b
will assign a value of 1 to every pixel in "a" where that pixel is less than the
corresponding pixel in "b" and a value of 0 to every pixel in "a" where the pixel is not
less than the corresponding pixel in "b".
You can create more complicated expressions by grouping together functions using
parenthesis. For example:
a = (b + c) * sin(d)
Opening Scripts
You can open scripts by choosing the Open item under the File menu. When you do
so, you will be prompted with the standard file opening dialog box.
DigitalMicrograph can open files of many different types such as images and scripts,
see the figure below.
123
DigitalMicrograph
Executing Scripts
As mentioned before, the way to run or execute a script is to press Ctrl-Enter with the
desired script's window in front. This is the most important action to remember when
working with scripts in DigitalMicrograph.
Saving Scripts
When you have made changes to a script an you wish to save it to disk, you can just
choose Save under the File menu and the script will be saved to wherever you loaded
it from.
When the script has not been previously saved to disk or when you want to save a
script to a new file by choosing Save As... under the File menu, you will be presented
with a save dialog box (see figure below).
Printing Scripts
To print a script:
1. Click on the desired script's title bar to bring it to the front of the other
windows.
2. Choose Print under the File menu.
Digital Micrograph
124
You will be presented with a Print dialog box (see figure below). The actual
dialog box you get will depend on the printer you are using and the version of
system software; however, it will look similar to the figure below).
4. Click OK.
1. Click on the desired script's title bar to bring it to the front of the other
windows.
2. Choose Install Script... under the File menu.
This will produce the following dialog box:
125
DigitalMicrograph
Here you can choose whether to install as library or as a menu item, and in the
case of a menu item, you can specify the location in the menu structure.
Digital Micrograph
126
/*
This is a multiline
comment.
*/
The "/*" and "*/" can also be on the same line. For example,
number value = 1 + 2 + 3 + 4 + 5 \
+ 6 + 7 + 8 + 9 + 10
result( value + "\n" )
Here value will equal 55 because the first statement continues to the second
line. If the backslash were omitted you would get an error when trying to run
this script.
Copyright 2012 Gatan Inc. All Rights Reserved.
127
1.8.1
DigitalMicrograph
Types
The basic script language types are:
realnumber
complexnumber
rgbnumber
realimage
compleximage
rgbimage
realsubarea
complexsubarea
rgbsubarea
string
In addition, 'number' is shorthand for 'realnumber', 'image' is shorthand for 'realimage',
'subarea' is shorthand for 'realsubarea'.
Variables
A variable has a name and a type. Variables must be declared before being used, with
the exception of image letters and intrinsic variables. The type of a variable
is specified in its declaration.
Variable names must start with a letter an be made up from the letters a-z, A-Z, the
numbers 0-9, and the underline character ("_"). Examples of valid variable names are
count, B123, r2d2, macStyle, and unix_style.
Variable Declaration
A declaration specifies a type and is followed by a list of one or more variables of that
type. Some examples of simple definition are:
number count
number xyz
complexnumber abc
string title
image img
Digital Micrograph
128
Image Variables
Image variables are said to refer to images. More than one image variable can refer to
the same image. An image will be deleted when it is no longer referenced by any
image variable unless it is displayed or KeepImage() has been called for it.
Image Letters
Image letters are predefined variables which can be used as shorthand to reference
images.
The image letters for any particular image are the letters followed by a colon in the title
of an image window. The possibilities are a to z and aa, ab, ... to zz. If a variable
name is used that has not been declared first and it is a valid image letter, the script
language will assume that it refers to the corresponding image.
Throughout this text the convention is used that when a statement is made that image
variable xyz is set to the result of some operation, what is normally meant is that the
image referred to by xyz has been set the result of the operation.
For example, given three images of the same size and data type that correspond to
the image letters a, b, and c respectively,
a=b+c
This single line script will add each pixel of b to c and store the result in a.
If a variable is declared with a name that is an image letter, the declaration overrides
the use of that name as an image letter within that script. Any usage of the over-ridden
name will refer to the declared variable and not to the predefined image letter. For
example,
number a = 2
number b = 3
Copyright 2012 Gatan Inc. All Rights Reserved.
129
DigitalMicrograph
number c = a + b
result( c + "\n" )
This is perfectly legal even if there are images in existence that correspond to the
image letters a, b, and c.
Intrinsic Variables
Intrinsic variables are predefined variables that have context dependent values.
Following is a list of all intrinsic variables:
icol
icolumn
iheight
ipoints
iradius
irow
itheta
iwidth
iplane
All of these variables pertain specifically to image expressions which will be covered
in the section Pixel By Pixel Operations in the Image Operations chapter.
1.8.2
Expressions
Expressions
An expression may be a constant, variable, function call, or be composed of one or more
operations. Operations are represented by operators. For example, "==" is the equality
operator. The parameters of the operation are the operands.
Operators that work on one operand are called unary operators. Operators that work on two
operands are called binary operators.
An expression composed of two or more operations is called a compound expression. The
order of evaluation is determined by precedence and associativity. Order of evaluation will be
covered later after operators are discussed.
Constants
The simplest kind of expression is a constant. A constant is a value that can't be
changed. There are three different types of constants: Number, Character, and String.
Number Constants
Some examples of number constants are:
-2.34
.456
Digital Micrograph
130
5.78383e-7
-2e10
.34E+5
'?'
'a'
'2'
A single quote character constant is specified by '\''. A new line character constant is
specified by '\n'. A character constant's type is realnumber.
String Constants
A string constant is zero or more characters surrounded by double quotes, as in:
"1"
Arithmetic Operators
The arithmetic operators are:
Operator
+
*
/
**
-
Meaning
Addition
Subtraction
Multiplication
Division
Exponentiation
Negation
Use
expr + expr
expr - expr
expr * expr
expr / expr
expr ** expr
- expr
The predefined arithmetic operators are defined for real, complex, and RGB number
expressions; with the one exception: the operator ** is not defined for RGB number
expressions. In addition the + operator is defined for string expressions.
Copyright 2012 Gatan Inc. All Rights Reserved.
131
DigitalMicrograph
Meaning
Equality
Inequality
Use
expr == expr
expr != expr
The equality operators are defined for real, complex, and RGB number expressions
as well as string expressions.
The relational operators are:
Operator
<
<=
>
>=
Meaning
Less Than
Less Than or Equal
Greater Than
Greater Than or Equal
Use
expr < expr
expr <= expr
expr > expr
expr >= expr
The relational operators are only defined for real number expressions.
The logical operators are:
Operator
!
||
&&
Meaning
Logical NOT
Logical OR
Logical AND
Use
! expr
expr || expr
expr && expr
The logical operators are only defined for real number expressions.
Assignment Operators
The assignment operators are:
Operator
=
:=
+=
-=
*=
/=
Meaning
Assign by Value
Assign by Reference
(see text)
(see text)
(see text)
(see text)
Use
expr = expr
expr := expr
expr += expr
expr -= expr
expr *= expr
expr /= expr
The operator = is used for assignment by value. This is the operator that is used to
change the value of a number or string variable. For example, given the number
variable value and the string variable str as already defined variables,
value = 2
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
132
str = "xyz"
When the = operator is used with image variables it will change the value of the pixels
in the image that the variable references. For example, given image a,
a = 0
This sets all pixels in the image a to 0.
Use the := operator to change the image an image variable references. For example:
133
DigitalMicrograph
Expr1 += Expr2
Increment and Decrement Operators
The increment and decrement operators are
Operator
++
--
Meaning
Increment
Decrement
Use
expr ++ ++ expr
expr -- -- expr
The operator ++ adds 1 to its operand and the operator -- subtracts 1 from its
operand. For example, you could write:
number i
for ( i = 0; i < 5; i = i + 1 )
result( i + "\n" )
or equivalently you could write:
number i
for ( i = 0; i < 5; i++ )
result( i + "\n" )
Digital Micrograph
134
Precedence
The order of evaluation in a compound expression is called precedence. The order in
which the operations in an expressions are evaluated can greatly change it's value.
Parenthesis can be used to change the order of evaluation. A sub-expression
enclosed in parenthesis will be evaluated first before it's value is used.
For example,
4+3*5
(4+3)*5
-4+3
-(4+3)
gives 19
gives 35
gives -1
gives -7
Associativity determines which side of the operator will be evaluated first. For
example, whereas + and * associate left to right (or have left associativity), the
exponentiation operator ( "**" ) has right associativity. Specifically:
3**2**3
gives 6561
(3**2)**3 gives 729
The precedence and associativity of all operators is summarized in the following
table. The table is organized in order of highest precedence to lowest precedence.
Operators on the same line have the same precedence.
Operator
[
!
**
*
/
+
<
>
!=
==
&&
||
?
=
:=
=
++
--
<=
>=
+=
-=
*=
Associativity
left
right
right
left
left
left
left
left
left
/ right
Type Conversion
To understand type conversion we will use an example.
There are three predefined functions for the operator / (divide). One that takes two
real numbers, one that takes two complex numbers, and one that takes two RGB
numbers. Given:
number abc = 4
number def = 2
Copyright 2012 Gatan Inc. All Rights Reserved.
135
DigitalMicrograph
Inline Images
An inline image is a way of specifying an image of a constant size with defined values
for every element inline. For example,
image a := [3,2]:
{
{ 1, 0, 1 },
{ 0, 1, 1 }
}
MatrixPrint(a)
Digital Micrograph
136
This creates a 3 x 2 floating point image. The dimensions ( "[3,2]" ) are specified as
width, height and must be constant positive integers. An example which multiplies two
matrices is:
image a := [3,2] : {{3,4,2},{2,3,-1}}
image b := [3,3] : {{1,-2,-4},{0,-1,2},{6,-3,9}}
image c := MatrixMultiply(a,b)
MatrixPrint(c)
Inline images don't need to be assigned to variables. The following example is
equivalent to the previous example.
MatrixPrint( \
MatrixMultiply( \
[3,2]:{{3,4,2},{2,3,-1}}, \
[3,3]:{{1,-2,-4},{0,-1,2},{6,-3,9}} \
)\
)
The values of the elements can be the result of number expressions, as in:
number theta = pi()/4
image a := [2,2]:
{
{ cos(theta), -sin(theta) },
{ sin(theta), cos(theta) }
}
MatrixPrint(a)
Complex and RGB images can be specified inline also. The type of the elements
determines the type of the inline image. If one of the elements is complex, then the
whole inline image is complex. As an example,
compleximage a := [2,3]:
{
{ complex(2,3), complex(-1,1) },
{ 1, -1 },
{ complex(0,3.8), 0 }
}
MatrixPrint(a)
1.8.3
Statements
Statements
Statements are the fundamental unit of execution in a script. The default order of evaluation of
Copyright 2012 Gatan Inc. All Rights Reserved.
137
DigitalMicrograph
statements within a script is sequential. However, if all you could write where lists of
instructions that where passed through once you wouldn't be able to do much. Control flow
statements like if, while, and for allow you to change the order of execution.
This chapter covers expressions as statements, the block statement, and all of the control
flow statements in the script language.
Expressions as Statements
Expressions are one kind of statement. For example, the expression:
x = 0
is also a statement.
The if Statement
The if statement is used to make decisions in a program. It has the form:
if ( Expression )
Statement
The Expression is evaluated; if it is "true" (not equal to 0), Statement is evaluated.
if ( Expression )
Statement1
else
Statement2
Digital Micrograph
138
while ( Expression )
Statement
The Expression is evaluated; if it is true Statement is evaluated. Then Expression is
re-evaluated and the cycle is repeated. This continues until Expression evaluates to
0.
An example which counts from one to ten and prints the results using a while loop is
given by:
number count = 1
while (count<=10)
{
Result( count + "\n" )
count++
}
The function Result() takes its argument and prints it in the results window.
Note: If you ever get stuck in an infinite loop, hold down the Control and Break keys to
exit a script at any time
Statement1
while ( Expression )
{
Statement3
Statement2
}
Semicolons (';') must be used to separate Statement1, Expression, and Statement2
from each other. An example which counts from one to ten and prints the results
using a for loop is given by:
Copyright 2012 Gatan Inc. All Rights Reserved.
139
DigitalMicrograph
number count
for (count=1; count<=10; count++)
Result( count + "\n" )
Note: The for statement should not be used for looping over image pixels, instead an
image expression should be used. The for statement is interpreted and is prohibitively
slow for reasonably sized images, while image expressions are compiled and
execute at close to optimal (for the microprocessor instruction set) speeds. This is
covered in the section Pixel by Pixel Operations contained in the chapter Image
Operations.
number low = 0
number high = 1
while ( 1 )
{
if ( !GetNumber( "Low Number", low, low )
)
exit( 0 )
if ( !GetNumber( "High Number", high,
high ) )
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
140
exit( 0 )
if ( low <= high )
break
OkDialog( "Your low was greater than your
high!" )
}
Result( "Low: "+low+"\n" )
Result( "High: "+high+"\n" )
When the low number is less than or equal to the high number the loop is terminated
by the break statement. GetNumber() is a predefined function available for your use.
(The exit() function is invoked if GetNumber() returns 0, which indicates the user
pressed the cancel button.)
number n = 1
while ( 1 )
{
if ( !GetNumber( "Enter a number from 1
to 10", n, n ) )
exit( 0 )
if ( n < 1 || n > 10 )
{
OkDialog( "Out of range" )
continue
}
result( n + "\n" )
}
This script gets a number from the user and if it is in the range of 1 to 10 prints it in
the results window. If it is "Out of range" it puts up a OkDialog telling the user so, and
then skips printing the result by using a continue statement.
141
DigitalMicrograph
an exception is thrown. Exceptions go outside of the normal flow of control. The only way to
regain control is by use of an exception handling statement, either try-catch or try-recover.
Once an exception is thrown normal evaluation is interrupted. DigitalMicrograph then traces
its steps back through the chain of exception handlers from the point at which the error
occurred until it reaches the top exception handler, which puts up an error dialog.
Throwing Exceptions
An exception may be thrown by use of the Throw() function. For example,
number value
image img := GetFrontImage()
if ( !GetNumberNote( img, "dose", value ) )
Throw( "Missing dose note." )
If the front image does not have a number note with the label "dose" this will throw an
exception with the message "Missing dose note." which will be displayed in an error
dialog.
try
Statement1
catch
Statement2
First Statement1 is evaluated. If an exception occurs within Statement1,
Statement2 will be evaluated, after which control will pass to the next higher
exception handling block (any following statements after the t r y -cat ch block
will not be evaluated). If no exception occurs in Statement1, then Statement2 is
ignored.
To avoid re-throwing of the exception place a break statement in the catch block as
follows:
try
Statement1
catch
{
Statement2
break
}
Statement3
Now if an exception is thrown by Statement1, Statement2 gets executed and then
program flow continues after the catch block with execution of Statement3.
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
142
try
Statement1
recover
Statement2
First Statement1 is evaluated. If an exception occurs within Statement1, Statement2
will be evaluated, after which control will pass to the next higher exception handling
block (any following statements after the try-catch block will not be evaluated). If no
exception occurs in Statement1, then Statement2 is evaluated and control passes to
the next statement. In any case Statement2 is evaluated.
tryguard( Statement )
Statement is evaluated and if an exception occurs a dialog is posted and exception is
lowered.
1.8.4
Functions
Functions
A function is a user defined operation. A function has a name, an argument list, a return type,
and a body.
The list of operands for a function is called the argument list; an individual operand, an
argument . The argument list determines how many and what type of parameters a function
requires. The argument list is enclosed in parenthesis and the arguments are separated by
commas. If a function has no arguments then the keyword void is used between the
parenthesis.
The type of the result of a function is its return type. If a function does not return any value its
return type is void. The result of a function, if any, is returned by using the return statement.
The body of a function is a statement, which usually is a block statement.
An example of a function declaration is:
143
DigitalMicrograph
return a + b
}
For a function to be used it must be called. Most calls have the syntax of the function's name
followed by the actual arguments inside parenthesis. For example,
Returning a Value
The way a function returns its result is by using a return statement. It has two forms:
return Expression
or
return
The r et ur n statement halts execution at the point at which it occurs in a
function and resumes execution where the function was called.
The type of Expr essi on must be compatible with the type specified as the
function's return type. If the function has a void return type, the return
statement is optional and must not be followed by Expr essi on . Otherwise,
if the function does return a value, the r et ur n Expr essi on form is
required.
An example of the return statement follows:
Digital Micrograph
144
Argument Passing
Function arguments may be passed by value or by reference. For example,
x is 1
x is 2
After calling myfunc() a is 1
As you can see, calling myfunc() in the above example does not modify a. The
argument x was passed by value and did not refer to the original variable. To pass by
reference an "&" character is placed before the variable name in the parameter list in
the function definition. Using the above example again with the single addition of the
"&",
145
DigitalMicrograph
x is 1
x is 2
After calling myfunc() a is 2
The variable a was modified by the call to myfunc(). This is because x referred to a.
Overloading Functions
An overloaded function is really two or more distinct functions with the same name but
different argument lists. The argument lists must differ either in number of arguments
or in type. For example,
3
6
6 + 3 i
Operators are functions and may also be overloaded. For example, the + operator is
overloaded to work with real numbers, complex numbers, RGB numbers, and strings.
Digital Micrograph
1.8.5
146
Objects
Objects
In addition to the simple types described in the previous chapter, DigitalMicrograph also
supports objects. In DigitalMicrograph scripting you can create your own objects and you can
use objects already defined within DM. The pre-defined objects include items such as image
windows, image documents, images, image displays, tag groups, and regions of interest.
In this section we will first explain how to define and create your own objects. In later sections
all the pre-defined objects will be discussed.
Define an Object
To define an object you have to declare a class. Here is an example of a shape class.
147
DigitalMicrograph
variables of type 'object'. So to create an instantiation of the shape class, with name
set to "shape", and then execute its print function you would run the following script:
ScriptObject class
In the above example the shape class was derived from the ScriptObject class. (Even
if the class wasn't explicitly declared as being derived from object , it still would have
been.) The ScriptObject class is defined as follows
class ScriptObject {
string ClassName( ScriptObject self )
// return name of the object's class
string ParentClassName( ScriptObject self )
// return name of the object's parents class
ScriptObject ScriptObjectClone( ScriptObject self )
// returns a copy/clone of itself
void ScriptObjectCopyFrom( ScriptObject self, object
sourceObject )
// makes itself a copy of the sourceObject
bool ScriptObjectEquals( ScriptObject self, object
compObject )
// returns true if self equals the compObject
bool ScriptObjectIsSameAs( ScriptObject self, object
compObject )
// return true if self is the same object as
compObject
Digital Micrograph
148
So one could add to the previous example the following code which would print out the
name of the shape class and the name of its parent class, i.e. object.
149
DigitalMicrograph
a custom implementation as in
Digital Micrograph
150
151
DigitalMicrograph
Digital Micrograph
152
153
DigitalMicrograph
interface shapeprinter{
void print( object self );
void printtwice( object self );
}
obj.printtwice()
Weak References
All objects in DigitalMicrograph are reference counted. This means that script
programmers do not need to worry about destructing and/or releasing memory
occupied by any of the objects available in the script language.
Sometime, however, you will need to set up circular references of objects. For
instance, a list may contain an object and that object may contain a reference to the
list. Due to the manner in which reference counting works, this will lead to a situation
where neither object is completely deleted when all references to it are released. This
is because the objects themselves will still contain references to one another.
One solution to this problem is to explicitly release one of the references by setting the
field to a NULL object at some point. This is difficult, however, because the script
language does not support any form of destructor currently.
Another solution involves "weak references." Weak references work the same as
containing the object except that the object may be set to NULL if all other references
to it are released.
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
154
To use weak references, you store the "reference" to the target object in a number.
You can use that number to retrieve the actual object.
For instance, if you have an object called obj, you can use the following code:
if ( obj.ScriptObjectIsValid() ){
// do something with object here
}
Resources
Object Lists
DigitalMicrograph includes a class for managing lists of other objects. Currently the
objects contained can only be ScriptObjects (not Image, ImageDocument, etc.). But
you can always place an Image or other class into a simple object and then place the
simple object in the list.
155
DigitalMicrograph
Digital Micrograph
156
157
DigitalMicrograph
}
You can create an image id object via an image.
Threading
Threading
The DigitalMicrograph scripting language supports multiple threads.
You can start a thread by running the statement
}
You should override the RunThread() method to implement the code you wish to run
in another thread.
Digital Micrograph
158
{
number i
for ( i=0; i<myvalue; i++ )
{
result( myvalue+"\n" )
yield()
}
}
}
alloc(mythread).init(50).StartThread()
This script will start a thread that will print out the number "50" 50 times in the
background.
Message Queues
Message queues are used to send messages between threads. A message handler
thread will typically wait for a message to appear in the queue at which point it will
perform an action based on the message. Other threads will post messages to the
queue. The messages are represented as script objects.
To Create a Message Queue
To create a message queue, call the function NewMessageQueue.
object NewMessageQueue()
To Use a Message Queue
The message queue class defines several methods.
class MessageQueue
{
void PostMessage( object self, object message )
Causes any threads blocking on the message queue (via
WaitOnMessage) to unblock and return the message passed into
PostMessage.
159
DigitalMicrograph
}
Following is an example script that starts two threads that communicate with
each other through messages:
object mq = NewMessageQueue()
class myMessage : object
{
number myValue
object init( object self, number value )
{
myvalue = value
return self
}
number getValue( object self )
{
return myValue
}
number setValue( object self, number
value )
{
myvalue = value
}
}
class mythread : thread
{
number myValue
object messageTemplate
object init( object self, number value,
object message )
{
myvalue = value
messageTemplate = message
return self
}
void RunThread( object self )
{
number i
for ( i=0; i< myvalue; i++ )
{
result( i +"\n" )
object message = messageTemplate.
ScriptObjectClone()
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
160
message.SetValue( i )
mq.PostMessage( message )
sleep( 1 )
}
}
}
class mythread2 : thread
{
void RunThread( object self )
{
while( 1 ) {
object message = mq.WaitOnMessage( 2, null )
if ( message.ScriptObjectIsValid() ){
result( "received " +
message.getValue() +"\n" )
}
else{
result( "time out 2\n" )
return
}
}
}
}
object message = alloc( myMessage )
alloc(mythread).init(10, message ).StartThread()
alloc(mythread2).StartThread()
Note that in the above example all messages are saved in a queue. So if you
place a Sleep(5) statement between the starts of the two threads, then all the
messages will still be available for the second thread.
We can also add a second thread that waits on the same message. Each of
the waiting threads will pick up messages when they are available and
process them accordingly.
Synchronization
Signals
Signals can be used to interact between threads. A signal is either in an
unsignaled state or a signaled state. A thread can block on a signal in an
unsignaled state until it becomes signaled. The thread will use up no
processing time until the signal becomes signaled, is canceled, or times out.
161
DigitalMicrograph
To Create a Signal
To create a signal, call the function NewSignal or the NewCancelSignal
function which is the same as NewSignal(false).
class Signal
{
void SetSignal( ScriptObject self )
Causes any threads blocking on the signal to become unblocked. If
multiple threads are blocking on the signal they will become
unblocked in no particular order.
}
In the following example script, which is very similar to the example for
messageQueue, one thread sets a signal and two threads are waiting on the
signal and reset it when they finished processing. Note that in this example a
cancelSignal was used, unlike for the MessageQueue example, because there
is no way to otherwise have the threads finish. When the cancelSignal is set
by myThread1, an exception is thrown in the other two threads from the
WaitOnSignal() method. If this happens those threads are finished. Also the
two listening threads are started first, because otherwise they miss the first
time the signal is set. In the messageQueue example this was not necessary,
because the messages remained in the queue.
Digital Micrograph
162
163
DigitalMicrograph
}
result( "thread2 cancelled\n" )
}
}
class mythread3 : thread
{
void RunThread( object self )
{
number do_break = false
while( true ) {
try
{
startSignal.waitonsignal
( infinity() , cancelSignal )
}
catch
{
do_break = true
break
}
if ( do_break )
break
startSignal.resetSignal()
result( "thread3 running\n" )
}
result( "thread3 cancelled\n" )
}
}
alloc(mythread2).StartThread( )
alloc(mythread3).StartThread( )
alloc(mythread).init( 10 ).StartThread()
Digital Micrograph
164
with a count and is signaled whenever its count is greater than zero. A semaphore
becomes unsignaled when its count goes to zero. It becomes signaled when any
thread that acquired it releases it and causes its count to be greater than zero.
Critical sections can be used to ensure that only one thread is executing a particular
section of code. They are identical to mutexes except that critical sections do not
timeout. They may have slightly better performance than mutexes also.
To Create a Blocking Object
To create a blocking object, call one of the functions NewMutex,
NewSemaphore, or NewCriticalSection.
object NewMutex()
object NewSemaphore( number initial_count )
object NewCriticalSection()
To Use a Blocking Object
The blocking_objects class defines a few methods.
class blocking_objects
{
void acquire( ScriptObject self )
Causes the current thread to block until the blocking object
becomes signaled.
}
The following example expands on the example used for Signals. In this
example two threads are using the same object, and accessing the same
method in that object. To prevent the two threads from interfering with one
an other, the function uses a critical section. As currently written, the script
will print the squares from 1 to 20. If the critical section were not present,
both threads would print the same results, and only the odd squares would
be printed, each two times.
165
DigitalMicrograph
Digital Micrograph
166
}
}
class mythread2 : thread
{
object mySquare
object init( object self, object sq )
{
mySquare = sq
return self
}
void RunThread( object self )
{
number do_break = false
while( true ) {
try
{
startSignal.waitonsignal( infinity() ,
cancelSignal )
result( "thread2: " + mySquare.
GetSquare() + "\n" )
}
catch
{
do_break = true
break
}
if ( do_break )
break
startSignal.resetSignal()
}
result( "thread2 cancelled\n" )
}
}
class mythread3 : thread
{
object mySquare
object init( object self, object sq )
{
mySquare = sq
return self
}
Copyright 2012 Gatan Inc. All Rights Reserved.
167
DigitalMicrograph
Tasks
Tasks can be set up with DigitalMicrograph to execute periodically or once. They are
guaranteed to be executed from the main thread.
To Register a Single Task
To register a single shot task (that may be delayed) call
AddMainThreadSingleTask.
Digital Micrograph
168
meth_name to be invoked on the task object after the delay given by delay_s
(in seconds). The resulting task ID is returned.
To Register a Periodic Task
To register a periodic task call AddMainThreadPeriodicTask.
Event Handling
Event Handling
There are two classes for dealing with high-performance events: EventMap and
EventSource. An eventmap provides a mapping from between event names, event id's, and
methods. It serves as a list of possible events from a particular event source. An eventsource
is something to which to attach listeners. Events are fired out of the event source via the fire
event method which dispatches them to the methods in the event map.
class EventMap
{
boolean ConstructEventFlags( string
event_flags_description, number &event_flags );
boolean DesconstructEventFlags( number event_flags,
string &event_flags_description );
void AddEvent( number event_id, string event_name,
string method_signature );
}
class EventSource
{
number AddEventListener( ScriptObject listener,
string event_handler_description );
void RemoveEventListener( number attachment_id );
void ClearEventListeners();
Copyright 2012 Gatan Inc. All Rights Reserved.
169
DigitalMicrograph
}
ScriptObject NewEventSource( ScriptObject event_map,
string fire_event_method_name );
ScriptObject NewEventMap( string event_source_name );
Using Events
Here we will show the general way of using EventMap and EventSource. The example
below follows the procedure outlined here.
1. Create an eventmap that describes the mapping between event id's and events.
Construct an event map with the NewEventMap function. The
event_source_name is currently unused .
2. Add events to the event map with the AddEvent method.
event_id must be represented by a unique bit within a 32-bit word for each
event. event_name is a convenience name for the event. method_signature
represents the signature of the method that will be invoked on the listener.
3. Create an event source with the NewEventSource function.
Pass the newly created event_map and a string naming the firing method.
4. Declare an interface and substitute the firing method for each of the method
prototypes added via the AddEvent method.
This allows the script language to call your method.
5. Declare a listener class that implements functions with the same signature as used
in the AddEvent function of the EventMap.
6. Instantiate an object of the listener class.
7. Attach the listener to the EventSource with the function AddEventListener().
The event_handler_description consists of a list (separated by semicolons) of
event name/method name pairs (separated by colons). Note that the event
name has to match the event_name parameter used when adding events to
the EventMap.
8. Fire a method from the event source
By invoking the firing function on the event source, passing the event_id for the
desired event, a NULL, and the arguments to pass to the method associated
with the event id in the event map. The NULL is used as a placeholder for the
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
170
171
DigitalMicrograph
TagGroup Object
TagGroup Object
Tags and TagGroups are used throughout DigitalMicrograph to store data. For example, you
can view all the globally stored tags by opening the Global Info dialog and selecting General:
Tags in the left survey pane.
TagGroups can either contain name - value pairs, where the value can be virtually anything,
including other TagGroups, or they can contain indexed tags. In the latter case the TagGroup
is referred to as a TagList.
An easy way to visialize a TagGroup is to use the function
TagGroup tg = NewTagGroup()
number index
index = tg.TagGroupCreateNewLabeledTag( "Street
Number" )
tg.TagGroupSetIndexedTagAsLong( index, 5933 )
index = tg.TagGroupCreateNewLabeledTag( "Street Name"
)
tg.TagGroupSetIndexedTagAsString( index, "Coronado
Lane" )
Digital Micrograph
172
tg.TagGroupOpenBrowserWindow( 0 )
Note that when the tags are displayed they do not appear in the order specified, but
are ordered alphabetically.
If the order of tags is important, then one should use a TagList, as in this example:
TagGroup tg = NewTagList()
tg.TagGroupInsertTagAsLong( infinity(), 5933 )
tg.TagGroupInsertTagAsString( infinity(), "Coronado
Lane" )
tg.TagGroupOpenBrowserWindow( 0 )
Accessing existing TagGroups
The main TagGroups that already exist are the ones displayed in Global Info, and
TagGroups attached to images and imageDisplays. To access the global TagGroup
use the function
TagGroup GetPersistentTagGroup( )
as in the folowing example:
TagGroup tg = GetPersistentTagGroup( )
tg.TagGroupOpenBrowserWindow( 0 )
When running the above script you can view the same information as is presented in
the Global Info dialog.
Each Image and ImageDisplay also contain a TagGoup. You can access the
TagGroup associated with an image as in the following script:
173
DigitalMicrograph
Microscope menu, and then enter a value under Beam Energy.) To access this tag
from script, use the following script:
TagGroup tg = GetPersistentTagGroup( )
number voltage
tg.TagGroupGetTagAsNumber( "Microscope Info:Voltage",
voltage )
Result("The Beam Energy = " + voltage + " V.\n" )
Note the string "Microscope Info:Voltage" which specifies the path to the tag.
You can also do the traversing in steps as follows:
TagGroup tg = GetPersistentTagGroup( )
number voltage
TagGroup infoTG
tg.TagGroupGetTagAsTagGroup( "Microscope Info",
infoTG )
infoTG.TagGroupGetTagAsNumber( "Voltage", voltage )
Result("The Beam Energy = " + voltage + " V.\n" )
If you do not know in advance what the tag labels are or their types, you are still able
to find tags. In the following example all tags contained in the "Microscope Info"
TagGroup are written to the results window:
Digital Micrograph
174
}
if( type == 6 ) {
// tag is a float
number value
infoTG.TagGroupGetTagAsFloat( label, value )
Result(label + " = " + value + "\n" )
}
if( type == 7 ) {
// tag is a double
number value
infoTG.TagGroupGetTagAsDouble( label, value )
Result(label + " = " + value + "\n" )
}
if( type == 8 ) {
// tag is a boolean
number value
infoTG.TagGroupGetTagAsBoolean( label,
value )
Result(label + " = " + value + "\n" )
}
if( type == 20 ) {
// tag is a string
string value
infoTG.TagGroupGetTagAsString( label, value )
Result(label + " = " + value + "\n" )
}
}
Note that in the above script we had to determine what the tag type was by using the
function
TagGroup Methods
TagGroup TagGroupAddLabeledTagGroup( TagGroup
tagGroup, String label, TagGroup newGroup )
Copyright 2012 Gatan Inc. All Rights Reserved.
175
DigitalMicrograph
Digital Micrograph
176
177
DigitalMicrograph
Boolean TagGroupGetIndexedTagAsDoubleComplex
( TagGroup tagGroup, Number index,
ComplexNumberVariable c )
Gets the data at 'index' in 'tagGroup' as a double complex.
Boolean TagGroupGetIndexedTagAsEightBitColor
( TagGroup tagGroup, Number index,
RGBNumberVariable c )
Gets the data at 'index' in 'tagGroup' as an eight bit color.
Digital Micrograph
178
179
DigitalMicrograph
Digital Micrograph
180
181
DigitalMicrograph
Digital Micrograph
182
183
DigitalMicrograph
Digital Micrograph
184
185
DigitalMicrograph
Digital Micrograph
186
Reads data from the stream into the indicated tag. The tag type determines
how the data is read, and 'stream_endianness' specifies the endianness of the
stream, 1 == bigendian, 2 == littleendian.
187
DigitalMicrograph
Digital Micrograph
188
189
DigitalMicrograph
Digital Micrograph
190
191
DigitalMicrograph
Writes data from the indicated tag into the stream. The tag type determines
how the data is written, and 'stream_endianness' specifies the endianness of
the stream, 1 == bigendian, 2 == littleendian.
Related Functions
TagGroup =( TagGroup tagGroup1, ! )
TagGroup =( TagGroup tagGroup1, TagGroup tagGroup2 )
void AddTagsToPackage( TagGroup tags, String
packageName, Number packageLevel, String
identifier )
Install the tags into the package. The identifier is used to identify the tags in the
packages. Clients should take care to use unique identifiers. See the Java
model of naming classes.
TagGroup GetPersistentTagGroup( )
Gets the persistent tag group.
TagGroup NewTagGroup( )
Creates an empty tag group.
TagGroup NewTagList( )
Creates an empty tag list.
TagGroup TagGroupNullify( ! )
Digital Micrograph
192
Menus
Menus
The menu system of DigitalMicrograph can be completely controlled through scripts.
The menu system is comprised of a set of classes which allow you to manipulate the menu
system. The classes are:
MenuBar
Menu
MenuItem
Action
Keystroke
MenuAccelerator
DigitalMicrograph contains a single menu bar. The menu bar contains menus. Menus contain
other menus or menu items. Menu items can be selectable menu items or separators. Menu
items have various attributes that can be set. Selectable menu items also have an action
associated with them. Accelerators can be attached to specific menu items or to the menu
bar itself. Accelerators can be specified by a single character or by a keystroke.
The function GetMenuBar() returns DigitalMicrograph's menu bar.
Menu Bar
The menu bar object has the following interface:
Display menuBar
{
void AddAccelerator( Display menu_bar, object
accelerator )
Add the given accelerator to the menu bar's list of accelerators.
Accelerators associated with the menu bar are not associated with a specific
menu item. Use RemoveAccelerator to remove the accelerator from the menu
bar's list of accelerators.
193
DigitalMicrograph
Digital Micrograph
194
GetMenuBar().
Menu
Menus are derived from the MenuItem class and can be used wherever menu items
are used.
You can create menus using the following methods:
195
DigitalMicrograph
}
Menu Item
You can create menu items using the following methods:
Display menuItem
{
object GetAccelerator( Display menu_item )
Return the accelerator (if any) associated with this menu item.
Digital Micrograph
196
}
Action
The action object will be implemented by the user. It should have the following
interface:
interface Action
{
void DoAction( object action )
}
Then use the following function to create the actual action:
197
DigitalMicrograph
Keystroke
Keystrokes should be created using the following function:
object Keystroke
{
string DeconstructKeystroke( object keystroke )
Returns the string associated with the keystroke.
}
Accelerator
Accelerators should be created using the following function:
object Accelerator
{
object GetAcceleratorKeystroke( object
accelerator )
Returns the keystroke object associated with this
accelerator.
object GetAcceleratorAction( object accelerator )
Returns the action associated with this accelerator.
Digital Micrograph
198
Key Descriptors
The following keys are defined:
control-f4
alt-a
shift-esc
Examples:
Add and remove a global accelerator
When adding a accelerator, or keyboard-short-cut, you should make sure that the
keystroke combo is not used yet elsewhere.
class Custom_Action
{
void DoAction( Object self )
{
Beep()
}
};
// create an object that implements the Action
interface
object handler = alloc( Custom_Action )
// create the action
object action = NewMenuAction( handler, "DoAction" )
// create the accelerator, use the F7 key as the
short-cut
object accelerator = NewMenuAccelerator
( MakeKeyStroke( "f7" ), action )
// get the menuBar and add the accelerator
Display menuBar = GetMenuBar()
Copyright 2012 Gatan Inc. All Rights Reserved.
199
DigitalMicrograph
menuBar.AddAccelerator( accelerator )
After running this script you should here a beep each time you hit the F7 key. To
remove the accelerator run the following script:
class Custom_Action
{
void CreateSmallImage( Object self )
{
image img = RealImage("small", 4, 256, 256 )
img = icol
ShowImage( img )
}
void CreateLargeImage( Object self )
{
image img = RealImage("small", 4, 1024,
1024 )
img = irow
ShowImage( img )
}
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
200
};
object handler = alloc( Custom_Action )
object customMenu = newMenu( "Custom" )
object item1 = newMenuItem( "Create small image" )
item1.SetAction( handler, "CreateSmallImage" )
item1.SetMnemonic( 's' ) // make sure to use single
quotes and lower case
item1.SetAccelerator( MakeKeyStroke( "control-3" ) )
item1.SetIsEnabled( 1 )
object item2 = newMenuItem( "Create large image" )
item2.SetAction( handler, "CreateLargeImage" )
item2.SetMnemonic( 'l' ) // make sure to use single
quotes and lower case
item2.SetAccelerator( MakeKeyStroke( "control-4" ) )
item2.SetIsEnabled( 1 )
// get the menuBar
Display menuBar = GetMenuBar()
// add all items together
menuBar.AddMenu( customMenu )
customMenu.AddMenuItem( item1 )
customMenu.AddMenuItem( NewMenuSeparator() )
customMenu.AddMenuItem( item2 )
To remove the menu just added run the following script:
String Object
String Object
String objects can be easily manipulated in the scripting language. For example the following
script creates a string and prints it to the results window:
201
DigitalMicrograph
Comparing Strings
String can be compared using the == operator, the != operator, or using the function
StringCompare(). The == operator returns true if the two string are equal characterby-character, and the != operator returns true if the two strings are not equal
character-by-character.
Parsing Strings
Strings can be parsed using the functions left(), mid() and right(), as in the following
example:
String
number
number
String
String
String
message = "abcdefghi"
indexD = message.find( "d" )
indexG = message.find( "g" )
abc = message.left( indexD )
def = message.mid( indexD, indexG - indexD )
ghi = message.right( message.len() - indexG )
Digital Micrograph
202
The scripting language also provides a means for automatically parsing a string that
contains a number value, as in the following example
23.4510
33.45
because in the first statement strValue is a String and therefore the 10 gets
interpreted as a string and appended. In the second statement numberValue is
a Number, so 10 gets added to it, and the result of the sum is printed.
Methods
String StringAppend( String s1, String s2 )
Appends string s2 to s1, converting its encoding to that of s1 if necessary.
203
1.8.5.6
DigitalMicrograph
Window Object
DigitalMicrograph displays everything in windows. There are dialog windows, floating
windows, script windows, image windows and the result window. Through the scripting
language you can get information about most of the windows, and control the windows.
First it is important to be able to distinguish between different windows based on their type.
The following types exist:
Description
Application Window
Results Window
Modeless Dialog
Script Window
Image Window
Type
9977
12504
12505
5
4
With the following script you can find all windows that are open within DigitalMicrograph and
check their type:
number i = 0
DocumentWindow window = GetDocumentWindow( i )
while( window.WindowIsValid( ) )
{
Result( i + " : " + window.WindowGetType() + "\n" )
i ++
window = GetDocumentWindow( i )
}
Note that this script does not list the floating windows or the main application window.
Methods
void WindowClose( DocumentWindow window, Boolean
verify )
Closes the wiWindowClosendow, prompting the user if 'verify' is true.
Digital Micrograph
204
205
DigitalMicrograph
Related Functions
DocumentWindow =( DocumentWindow, ! )
DocumentWindow =( DocumentWindow, DocumentWindow )
Digital Micrograph
206
DocumentWindow GetApplicationWindow( )
Gets the application window.
207
DigitalMicrograph
ImageDocument ImageWindowGetImageDocument
( DocumentWindow window )
Gets the image document displayed in the window.
DocumentWindow WindowNullify( ! )
1.8.5.6.2 Dialogs
Dialogs
DigitalMicrograph has several simple dialogs built-in, such as warning and alert dialogs. See
the table in the reference sections for a list of those. This section describes how to generate
custom dialogs.
Dialog Basics
Creating a custom dialog requires you to describe the dialog using tags. Then you can
use the uiframe class to display the dialog to the user. In the following example a
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
208
simple dialog with one text field is displayed. If the user hits the ok button, the text is
printed to the results window
TagGroup dialog_items
TagGroup dialog_tags = DLGCreateDialog( "Test
Dialog", dialog_items )
TagGroup val_tag = DLGCreateStringField( "" )
dialog_items.DLGAddElement( val_tag )
Object dialog = alloc(uiframe).init(dialog_tags)
if ( dialog.Pose() )
{
Result( val_tag.DLGGetStringValue() + "\n" )
}
209
DigitalMicrograph
Handling messages
If you want to handle messages from, e.g. buttons or pop-up lists, you have to create
your own class that extends uiframe. The following simple example adds a button to
the dialog in the first example, and prints the text in the text field when the user
presses the button.
Digital Micrograph
210
Layouts
In the above example the print button appears under the text field. If we want to display
the print button to the right of the text field, we have to explicitly state our layout
requirements when creating the dialog items. To do this you can use the function
TagGroup dialog_items
Copyright 2012 Gatan Inc. All Rights Reserved.
211
DigitalMicrograph
Digital Micrograph
212
dialog_items.TagGroupOpenBrowserWindow( 0 )
at the end of the previous example.
Floating Windows
In addition to creating modal and modeless dialogs, Floating Windows that can be
docked on the left or right side of the screen can be generated. The procedure is very
similar to creating a standard dialog. The only difference lies in the fact that instead of
calling Pose() or Display() on the uiframe derived object , you use the function
TagGroup
DLGBuildPositionFromApplication()
213
DigitalMicrograph
Methods
Index to methods:
Digital Micrograph
214
215
DigitalMicrograph
Digital Micrograph
216
217
DigitalMicrograph
Digital Micrograph
218
219
DigitalMicrograph
Sets the label of the element at the given index; returns the element
Digital Micrograph
220
TagGroup DLGBuildAutoSize()
Creates an auto-size position descriptor; returns the descriptor.
TagGroup DLGBuildMatchSize()
Creates a match-size position descriptor; returns the descriptor.
LABEL FUNCTIONS
TagGroup DLGCreateLabel( String label_string )
Creates a label with the given text.
221
DigitalMicrograph
BUTTON FUNCTIONS
TagGroup DLGCreatePushButton( String title, String
action_method )
Creates a single-state text button with the given display title and action
method.
Digital Micrograph
222
GROUP FUNCTIONS
TagGroup DLGCreateGroup()
Creates a group container
FIELD FUNCTIONS
TagGroup DLGCreateRealField( number value )
Creates a real-valued field with the given initial value, field width, and format.
223
DigitalMicrograph
CHECKBOX FUNCTIONS
TagGroup DLGCreateCheckBox( string title )
Creates a checkbox with the given text.
Digital Micrograph
224
Creates a checkbox with the given text, initial checked/unchecked state, and
changed method.
BOX FUNCTIONS
TagGroup DLGCreateBox()
Creates a box container
225
DigitalMicrograph
LIST FUNCTIONS
TagGroup DLGCreateList( number width, number height )
Creates a list container with the given width and height
Digital Micrograph
226
227
DigitalMicrograph
Digital Micrograph
228
value; passes back the choice item and an empty choice items list; returns the
box element.
PANEL FUNCTIONS
TagGroup DLGCreatePanelList( )
Creates a panel list container
TagGroup DLGCreatePanel( )
Creates a panel element
TAB FUNCTIONS
TagGroup DLGCreateTabList( )
Copyright 2012 Gatan Inc. All Rights Reserved.
229
DigitalMicrograph
Digital Micrograph
230
GRAPHIC FUNCTIONS
TagGroup DLGCreateGraphic( number width, number
height )
Creates a graphic element with the given width and height
231
DigitalMicrograph
ImageDocument Object
Overview
Image documents are the base containers for image displays and other components.
A simple example that shows how to create an ImageDocument and then add images
follows
Digital Micrograph
232
233
DigitalMicrograph
imageDoc.ImageDocumentEnsurePlacedOnPage()
number top, left, bottom, right
imageDoc.ImageDocumentGetPageBounds( top, left,
bottom, right )
number pageHeight = bottom - top
Component comp = imageDoc.
ImageDocumentGetRootComponent()
Component textAnnot = NewTextAnnotation( 0,
pageHeight/2, "Text Annotation", 12 )
comp.ComponentAddChildAtEnd( textAnnot )
imageDoc.ImageDocumentSwitchToPageMode()
imageDoc.ImageDocumentShow()
Coordinate Systems
An image document may be viewed in its entirety in page mode, or one of its top-level
image displays may be viewed in image mode.
The coordinate system used to express the portion of the document currently viewed
in the window is view coordinates. In page mode this is equivalent to page
coordinates, as in the above script examples; in image mode it has no equivalent, but
methods like ComponentGetBoundingRectInView can be used to interpret the
coordinates in terms of the visible components. View coordinates can be related to
window coordinates by finding the currently visible area in view coordinates using
ImageDocumentGetVisibleViewRect, and then by finding the visible area in screen
coordinates using ImageDocumentGetWindow to get the document's window and
WindowGetContentBounds to get the size of the interior of the window. See the
following script for an example:
Digital Micrograph
234
"
235
DigitalMicrograph
" +
" +
Reference Points
Each image document mode has a reference point size, which is the height of one
text point, and a minimum resolution, which is the size of a pixel in the appropriate
drawing surface. The reference point size in view coordinates is given by
ImageDocumentGetReferencePointSize, and the minimum point size in view
coordinates by ImageDocumentGetMinimumPointSize. In image mode, both the
reference point and the minimum point are one screen pixel. In page mode, the
reference point size is the size of a dot at 72dpi ( before any scaling specified in the
print dialog ), and the minimum point size is the dot size of the selected printer.
Methods
void ImageDocumentAddImage( ImageDocument imgDoc,
ImageReference image )
Adds the given image to the list maintained in the image document.
ImageDisplay ImageDocumentAddImageDisplay
( ImageDocument imgDoc, ImageReference image,
Number displayType )
Adds the given image and an image display for it of the given type.
Digital Micrograph
236
ImageReference
ImageDocumentCreateRGBImageFromDocument
( ImageDocument imgDoc, Number width, Number
height, Number extract_style, Number constraints
)
Creates an image by scaling the image document into ( width, height ).
Boolean ImageDocumentDoesImageWithIDExist
( ImageDocument imgDoc, Number id )
Determines whether the image with the given id exists within this image
document.
Component ImageDocumentGetComponentByID
( ImageDocument imgDoc, Number id )
Returns an annotation contained in this image document by id.
ImageReference ImageDocumentGetImageByID
( ImageDocument imgDoc, Number id )
Returns an image contained in this image document by id.
ImageDisplay ImageDocumentGetImageModeDisplay
( ImageDocument imgDoc )
Gets the image display targeted by the current image mode.
237
DigitalMicrograph
void ImageDocumentGetPageResolution_72dpi
( ImageDocument imgDoc, NumberVariable horz,
NumberVariable vert )
Returns the resolution of page coordinates in 72 dots per inch ( returns page
units per dot ).
void ImageDocumentGetPageResolution_Printer
( ImageDocument imgDoc, NumberVariable horz,
NumberVariable vert )
Returns the resolution of page coordinates in printer pixels ( returns page units
per printer pixel ).
void ImageDocumentGetReferencePointSize
( ImageDocument imgDoc, NumberVariable x,
NumberVariable y )
Gets the size of the reference point in view coordinates.
Component ImageDocumentGetRootComponent
( ImageDocument imgDoc )
Gets the root annotation of the image document.
Digital Micrograph
238
void ImageDocumentGetViewToWindowTransform
( ImageDocument imgDoc, NumberVariable off_x,
NumberVariable off_y, NumberVariable scale_x,
NumberVariable scale_y )
Returns the transformation from view to screen coordinates.
Boolean ImageDocumentHasBeenPlacedOnPage
( ImageDocument imgDoc )
Returns 'true' if the document has been layed out within the physical page.
239
DigitalMicrograph
void ImageDocumentRemoveFromUserInterface
( ImageDocument imgDoc )
Removes the image document from the list of user interface documents.
void ImageDocumentSetCurrentViewAsUnzoomed
( ImageDocument imgDoc )
Makes the current view the unzoomed view.
DocumentWindow ImageDocumentShowAtPosition
( ImageDocument imgDoc, Number x, Number y )
Shows the given image document at the application position (x,y).
Digital Micrograph
240
Related Functions
ImageDocument =( ImageDocument, ! )
ImageDocument =( ImageDocument, ImageDocument )
ImageDocument CreateImageDocument( String title )
Creates an empty image document.
ImageDocument GetFrontImageDocument( )
Returns the front image document.
ImageDocument ImageDocumentNullify( ! )
ImageDocument ImageWindowGetImageDocument
( DocumentWindow window )
Gets the image document displayed in the window.
Image Object
This chapter explains how to deal with images in the scripting language.
241
DigitalMicrograph
Real
Complex
RGB
Size
1
1
1
2
Signed
2
4
Unsigned
Signed
Unsigned
Signed
Unsigned
Signed
4
8
8
16
4
Range
Smallest Value
0 or 1
1
-128 to 127
1
0 to 255
1
-32,768 to
1
32,767
0 to 65,535
1
-2,147,483,648 1
to
2,147,483,647
0 to
1
4,294,967,295
3.4E+38
1.5E-45
1.7E+308
5.0E-324
3.4E+38
1.5E-45
1.7E+308
5.0E-324
R/G/B/A 0 to 1
255
Where size is the size in bytes per pixel, range is the minimum to maximum value,
and smallest value is the smallest representable value closest to 0.
In addition to this list there is one more special case image data type, Packed
Complex, which is used to represent Hermitian complex data. It has 8 bytes per pixel,
but only stores one half of the pixels in an image. It is used to perform efficient Fast
Fourier Transforms (FFTs). However, this data type can't be used with image
expressions.
All number and image expressions are evaluated with floating point precision.
However, when assigning the value of an expression to an image, the value is
converted to the destination image's type before it is stored. For example, given an
unsigned 1 byte integer image a,
a = a + 1
This adds 1 to the value of every pixel in the image. If a pixel has a value of 1 it gets
set to 2. However, a pixel that has a value of 255 gets set to 255. The value is
clipped to fit in the integer range.
Digital Micrograph
242
There are three different variable types in the script language which may be used to
refer to an image. Which is used depends on the image data type of the image
involved. The creation function used to create an image also depends on the desired
image data type. The following table illustrates the relationship between variable type,
creation function, and image data type.
Variable Type Creation
Kind
Function
realimage
BinaryImage() Binary
realimage
IntegerImage() Integer
realimage
RealImage()
Real
RGBImage()
RGB
Size
1
1
1
2
2
4
4
4
8
8
Signed
Signed
Unsigned
Signed
Unsigned
Signed
Unsigned
16
4
Explicit Creation
The image data types in DigitalMicrograph can be divided into five kinds. They are:
Binary Images
Integer Images
Real Images
Complex Images
RGB Images
There are five corresponding functions that are the principal ways of explicitly creating
images.
BinaryImages
The function used to create an binary image is:
243
DigitalMicrograph
Integer Images
The function used to create an integer image is:
Real Images
The function used to create a real image is:
Digital Micrograph
244
Complex Images
The function used to create a complex image is:
RGB Images
The function used to create a RGB image is:
245
DigitalMicrograph
Implicit Creation
To increase the ease of use and eliminate the repetition of the step of creating an
image to store the result of an image expression, images may also be created
implicitly. Implicitly created images are always created by the script language in
response to the need to assign the value of an image expression to an actual image.
There are three ways that images are implicitly created.
Assignment By Value To An Image Letter
Assignment By Value To An Uninitialized Image Variable
Temporary Images
The image data type of the image created is context dependent on the image
expression that is to be assigned to it. A table listing the default image data types
follows.
Image Expression Type
realimage
compleximage
rgbimage
In any specific scripting situation if an image data type other than the default image
data type that would be implicitly created is desired it can be explicitly created by
using a creation function or by using the New command.
Digital Micrograph
246
b = a * 3
This will create an image of the same size as a. The image data type of
the created image depends on the image data type of a.
Assignment By Value To An Uninitialized Image Variable
When an image expression is assigned by value to an uninitialized image
variable an image of the correct size will be automatically created.
An uninitialized image variable is an image variable which does not reference
an image. All newly created image variables are uninitialized until an image is
assigned by reference or they are initialized by an implicit image creation.
For example,
image xyz
xyz = abc + 2
An image of the same size as abc will be created, xyz will be initialized to
reference it, and the result of the image expression abc + 2 will be assigned to
the new image.
Temporary Images
Temporary images are created when a pixel by pixel operation is used as an
argument to a whole image operation. A temporary image is created as
storage for the result of the pixel by pixel operation, which is then passed to
the whole image operation. After the whole image operation the temporary
image is deleted if it is no longer is used.Before we discuss image operations
it is important to understand the different representations of image data types
that DigitalMicrograph supports.
Image Calibrations
Images can be calibrated both in the spatial direction and its intensity. The following
example shows calibration of an image:
247
DigitalMicrograph
myImage.ImageSetDimensionUnitString(0, "nm" )
myImage.ImageSetDimensionOrigin(1, 0 )
myImage.ImageSetDimensionScale( 1, 0.1 )
myImage.ImageSetDimensionUnitString(1, "nm" )
// for intensity: subtract 100 from value, then
multiply by 10
// that gives the number of A.
myImage.ImageSetIntensityOrigin( 100 )
myImage.ImageSetIntensityScale( 10 )
myImage.ImageSetIntensityUnitString( "A" )
ShowImage( myImage )
Saving Images
Images can be saved using the following functions:
Digital Micrograph
248
Methods
void ImageCalculateHistogram( ImageReference image,
ImageReference hist_image, Number complexMode,
Number min, Number max )
Calculates the histogram of 'image', mapping [min,max] into 'hist_image'.
Number ImageCountImageDisplaysInImageDocument
( ImageReference, ImageDocument imgDoc )
Returns the number of image displays in the image document in which this
image is displayed.
249
DigitalMicrograph
Digital Micrograph
250
ImageDisplay ImageGetImageDisplayInImageDocument
( ImageReference, ImageDocument imgDoc, Number
index )
Returns the given image display in the image document in which this image is
displayed.
ImageDocument ImageGetOrCreateImageDocument
( ImageReference im )
Returns an image document containing the image, creating one if necessary.
251
DigitalMicrograph
Boolean ImageIsDataTypeUnsignedInteger
( ImageReference img )
Returns true if the data in the image is integral and unsigned.
Boolean ImageIsDimensionCalibrationDisplayed
( ImageReference im, Number dim )
Returns 'true' if the calibration of the 'dim'th dimension is displayed.
Boolean ImageIsIntensityCalibrationDisplayed
( ImageReference im )
Returns 'true' if the calibration of the intensity is displayed.
Digital Micrograph
252
void ImageSetDimensionCalibrationDisplayed
( ImageReference im, Number dim, Boolean
do_display )
Sets whether or not to display the 'dim'th dimension in calibrated units to
'do_display'.
void ImageSetIntensityCalibrationDisplayed
( ImageReference im, Boolean do_display )
Sets whether or not to display the intensity in calibrated units to 'do_display'.
253
DigitalMicrograph
Component Object
Overview
Objects of type 'Component' are image document components, which include
annotations ( text, box, line, etc. ), image displays, masks, and regions of interest.
Components may be placed on a page, in an image display, or in a group, each of
which is represented by a type of component. The containing component is referred
to as the parent component, and it determines the coordinate system in which child
locations and sizes are specified ( the coordinate system of a container is its child
coordinate system, and the child's local coordinate system ). See "ImageDocument
Object" for a description of coordinate systems.
If a method requires or returns coordinates, they are usually specified in the
component's local coordinate system. However, if the method ends in 'InView' the
coordinates are in view coordinates. Note that none of the methods that set
coordinates use view coordinates. Thus, to manipulate the view of a component, use
the methods ending in 'InView' to get coordinates, and ImageDocument methods
such as ImageDocumentSetRectInView to position the component.
The annotation type, used by the function NewAnnotation and the method
ComponentGetType, are listed in the following table:
Annotation Type
2
3
4
5
6
Description
line annotation
arrow annotation
double arrow annotation
box annotation
oval annotation
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
8
9
13
15
17
19
254
The control points referred to in several of the methods are listed in the following table
Annotation Type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Description
start point of line
end point of line
position, used to move annotation ( the
position may be any point in the
annotation, so it is only good for
moving )
top-left of rectangular annotations, one
of the bandpass ovals
top-right of rectangular annotations,
one of the bandpass ovals
bottom-left of rectangular annotations,
one of the bandpass ovals
bottom-right of rectangular
annotations, one of the bandpass
ovals
other spot of spot mask
one vector of wedge and array masks
other vector of wedge and array
masks
top-left of other bandpass oval
top-right of other bandpass oval
bottom-left of other bandpass oval
bottom-right of other bandpass oval
one spot of spot mask
Methods
void ComponentAddChildAfter( Component parent,
Component child, Component annot_pos )
Adds 'child' to 'parent's list of sub-annotations after 'annot_pos'.
255
DigitalMicrograph
Digital Micrograph
256
257
DigitalMicrograph
ImageDisplay ComponentGetParentImageDisplay
( Component comp )
Gets the parent image display of the 'comp', if any.
Digital Micrograph
258
259
DigitalMicrograph
Related Functions
Component =( Component, ! )
Digital Micrograph
260
Component ImageDocumentGetComponentByID
( ImageDocument imgDoc, Number id )
Returns an annotation contained in this image document by id.
Component ImageDocumentGetRootComponent
( ImageDocument imgDoc )
Gets the root annotation of the image document.
Component NewGroupAnnotation( )
Creates a new group annotation.
261
DigitalMicrograph
ImageDisplay Object
Overview
Image displays are components used to display the contents of images. Component
methods may be used to position these on the page, but specialized methods such
as ImageDisplaySetImageRect are supplied to allow the position and size of the
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
262
Description
Best image display*
Raster image display
Surface plot image display
Line plot image display
RGB image display
Spreadsheet image display
*This is only used when setting a display type, and it produces line plots for 1d images, and raster or rgb displays for 2-d data.
ImageDisplay properties
ImageDisplays show the data that is contained in the image to the user. To represent
the data on the screen the data values stored in the image need to be translated to
gray scale or RGB values. The whole mechanism used by DigitalMicrograph to
accomplish this is discussed in "About Image Displays". All the same operations that
were described in that section can also be performed by script. So you can get and
set the DisplayType, survey mode, contrast limits, contrast and brightness etc. See
the following script for a simple example:
// open image
image myImage := GetFrontImage()
ImageDisplay imageDisp = myImage.
ImageGetImageDisplay( 0 )
// get display info
number low, high, bright, contrast
imageDisp.ImageDisplayGetContrastLimits( low, high
)
imageDisp.ImageDisplayGetContrastParameters
( bright, contrast )
// get color table
Image colorTable := imageDisp.
ImageDisplayGetInputColorTable(
263
DigitalMicrograph
// modify it
colorTable = rgb( icol + 16 * irow, 255 - icol 16 * irow, 128 )
// apply color table
imageDisp.ImageDisplaySetInputColorTable
( colorTable )
// open image
image myImage := GetFrontImage()
ImageDisplay imageDisp = myImage.
ImageGetImageDisplay( 0 )
// add listener
imageDisp.ImageDisplayAddKeyListener( "Test",
"HandleKey( key )" )
4. Now select the front image and hit any key. The key number will appear in the
results window and you will here a beep. This happens because on hitting a key the
listener executes the following script (when hitting the 'a' key)
Digital Micrograph
264
key) that function will now be called, resulting in the print-out and beep.
5. Remove the listener using the following script
// open image
image myImage := GetFrontImage()
ImageDisplay imageDisp = myImage.
ImageGetImageDisplay( 0 )
// add listener
imageDisp.ImageDisplayRemoveKeyListener( "Test" )
Methods
void ImageDisplayAccumulateROIsToMask( ImageDisplay
imgDisp, ImageReference mask, Number top, Number
left, Number bottom, Number right, Number
mask_val )
Sets mask to mask_val at points in imageDisplay's rois
265
DigitalMicrograph
Exports the display to the file 'file_name' using the format 'format'.
ImageReference ImageDisplayGetBufferedImage
( ImageDisplay imgDisp )
Gets the image resulting from the contrast transformation.
ImageReference ImageDisplayGetDisplayedImage
( ImageDisplay imgDisp )
Gets the image that is actually displayed in the image display.
ImageReference ImageDisplayGetExportImage
( ImageDisplay imgDisp, Number mode,
ImageDisplay clut_display )
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
266
Gets the image representation of the image as it appears on the screen at full
resolution.
void ImageDisplayGetImageAdjustRectInView
( ImageDisplay imgDisp, NumberVariable top,
NumberVariable left, NumberVariable bottom,
NumberVariable right )
Returns the image display outside the image rect in view coordinates
ImageReference ImageDisplayGetInputColorTable
( ImageDisplay imgDisp )
Gets the input color table for the display.
ImageReference ImageDisplayGetIntensityTransformation
( ImageDisplay imgDisp )
Gets the ITT of the display.
ImageReference ImageDisplayGetOutputColorTable
( ImageDisplay imgDisp )
Gets the output color table for the display.
267
DigitalMicrograph
Digital Micrograph
268
void ImageDisplaySetIntensityTransformation
( ImageDisplay imgDisp, ImageReference itt )
Sets the ITT of the display.
269
DigitalMicrograph
Related Functions
ImageDisplay =( ImageDisplay, Component )
ImageDisplay =( ImageDisplay, ! )
ImageDisplay =( ImageDisplay, ImageDisplay )
void ApplyDataBar( ImageDisplay imgDisp )
Applies a data bar to the image.
ImageDisplay ImageDisplayNullify( ! )
ImageDisplay ImageDocumentAddImageDisplay
( ImageDocument imgDoc, ImageReference image,
Number displayType )
Adds the given image and an image display for it of the given type.
ImageDisplay ImageDocumentGetImageModeDisplay
( ImageDocument imgDoc )
Gets the image display targeted by the current image mode.
RasterImageDisplay Object
Overview
A RasterImageDisplay is the display type most often used to view an image. The
RasterImageDisplay class extends ImageDisplay and adds a few functions. All
examples in the ImageDisplay section actually use RasterImageDisplays.
Digital Micrograph
270
The functionality added to this sub-class relates to thresholds. See the chapter on
Thresholding in the Particle Analysis section.
See the following example on how to use the new functions:
// open image
image myImage := GetFrontImage()
ImageDisplay imageDisp = myImage.ImageGetImageDisplay
( 0 )
number low, high
imageDisp.ImageDisplayGetContrastLimits( low, high )
number width = myImage.ImageGetDimensionSize( 0 )
number height = myImage.ImageGetDimensionSize( 1 )
// trun thresholding on
imageDisp.RasterImageDisplaySetThresholdOn( 1 )
// set limits
imageDisp.RasterImageDisplaySetThresholdLimits( low,
(low + high)/2 )
// create mask image, should be binary or 8 bit
signed or unsigned
image mask := IntegerImage("Mask", 1, 0, width,
height )
imageDisp.RasterImageDisplayAddThresholdToMask( mask,
0, 0, height, width )
// turn thresholding off
imageDisp.RasterImageDisplaySetThresholdOn( 0 )
// display the mask
ShowImage( mask )
Methods
void RasterImageDisplayAddThresholdToMask
( RasterImageDisplay rid, ImageReference mask,
Number top, Number left, Number bottom, Number
right )
Sets the points in mask to 1 if they lie within the threshold.
271
DigitalMicrograph
void RasterImageDisplayGetThresholdLimits
( RasterImageDisplay rid, NumberVariable low,
NumberVariable high )
Gets the threshold limits of the display.
Boolean RasterImageDisplayIsThresholdOn
( RasterImageDisplay rid )
Determines whether the thresholding overlay is on or off.
void RasterImageDisplaySetThresholdLimits
( RasterImageDisplay rid, Number low, Number
high )
Sets the threshold limits of the display.
void RasterImageDisplaySetThresholdOn
( RasterImageDisplay rid, Boolean on )
Sets whether the thresholding overlay is on or off.
Related Functions
RasterImageDisplay =( RasterImageDisplay dst, ! )
RasterImageDisplay =( RasterImageDisplay dst,
RasterImageDisplay rid )
RasterImageDisplay =( RasterImageDisplay dst,
ImageDisplay id )
ImageReference CreateMaskFromAnnotations
( RasterImageDisplay rid, Number filter_length,
Boolean is_opaque, NumberVariable has_mask )
RasterImageDisplay RasterImageDisplayNullify( ! )
1.8.5.6.8 SurfacePlotImageDisplay Object
SurfacePlotImageDisplay Object
Overview
The SurfacePlotImageDisplay shows a 3D representation of intensities in a 2D image.
You can control all the setings as explained in "Using Surface Plot Image Displays"
from the script functions supplied in this class.
The shape of a surface plot image display is given by the x,y offset of the x-axis, the x,
y offset of the y-axis, and the y-offset of the z-axis, denoted '(x_axis_x,x_axis_y)',
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
272
'(y_axis_x,y_axis_y)', and 'z_axis' in the script methods. In all of these offsets, positive
x points to the left and positive y points down. Only the relative sizes of these values
matter, for the coordinates are scaled to fit in the display bounds.
Methods
void SurfacePlotImageDisplayGetCubeAxes
( SurfacePlotImageDisplay spid, NumberVariable
x_axis_x, NumberVariable x_axis_y,
NumberVariable y_axis_x, NumberVariable
y_axis_y, NumberVariable z_axis )
Gets the points describing the surface plot cube.
void SurfacePlotImageDisplayGetCubePoint
( SurfacePlotImageDisplay spid, Number
which_point, NumberVariable x, NumberVariable
y )
Gets the child coordinates of the cube point indicated by 'which_point'
Boolean SurfacePlotImageDisplayIsShadingOn
( SurfacePlotImageDisplay spid )
Determines whether shading is on or off.
void SurfacePlotImageDisplaySetCubeAxes
( SurfacePlotImageDisplay spid, Number x_axis_x,
Number x_axis_y, Number y_axis_x, Number
y_axis_y, Number z_axis )
Sets the points describing the surface plot cube.
void SurfacePlotImageDisplaySetShadingOn
( SurfacePlotImageDisplay spid, Boolean on )
Sets whether shading is on or off.
Related Functions
SurfacePlotImageDisplay =( SurfacePlotImageDisplay
dst, ImageDisplay id )
SurfacePlotImageDisplay =( SurfacePlotImageDisplay
dst, ! )
SurfacePlotImageDisplay =( SurfacePlotImageDisplay
dst, SurfacePlotImageDisplay spid )
SurfacePlotImageDisplay
SurfacePlotImageDisplayNullify( ! )
Copyright 2012 Gatan Inc. All Rights Reserved.
273
DigitalMicrograph
LinePlotImageDisplay Object
Overview
For LinePlotImageDisplay you can control from script all of the parameters that have
been explained under "Using Line Plot Image Displays" and "Using Line Plot Legends
".
Here we give a simple example that creates an image and displays it in a
LinePlotImageDisplay, with some properties set:
Digital Micrograph
274
Number LinePlotImageDisplayGetBaseIntensity
( LinePlotImageDisplay lpid )
Returns the base intensity of the line plot.
void LinePlotImageDisplayGetContrastLimits
( LinePlotImageDisplay lpid, NumberVariable
lowLimit, NumberVariable highLimit )
Gets the lowest and higest intensities displayed.
void LinePlotImageDisplayGetDisplayedChannels
( LinePlotImageDisplay lpid, NumberVariable
leftChannel, NumberVariable rightChannel )
Gets the leftmost and rightmost displayed channels.
void LinePlotImageDisplayGetDoAutoSurvey
( LinePlotImageDisplay lpid, NumberVariable
doAutoSurveyLow, NumberVariable doAutoSurveyHigh
)
Gets whether to auto-survey is done on the high and low intensity limits.
Number LinePlotImageDisplayGetSlice
( LinePlotImageDisplay lpid )
Returns slice currently displayed at the bottom.
void LinePlotImageDisplayGetSliceComponentColor
( LinePlotImageDisplay lpid, Number slice_index,
Number comp_index, NumberVariable r,
NumberVariable g, NumberVariable b )
Returns the color of the 'comp_index'th component of the 'slice_index'th slice.
275
DigitalMicrograph
Number LinePlotImageDisplayGetSliceDrawingStyle
( LinePlotImageDisplay lpid, Number
slice_index )
Returns the drawing style of the 'slice_index'th slice.
void LinePlotImageDisplayGetTrackingStyle
( LinePlotImageDisplay lpid, NumberVariable
track_style_x, NumberVariable track_style_y )
Gets the tracking style of the line plot.
Boolean LinePlotImageDisplayIsBackgroundOn
( LinePlotImageDisplay lpid )
Returns true if the background is erased.
Boolean LinePlotImageDisplayIsFilled
( LinePlotImageDisplay lpid )
Returns true if the line plot is filled.
Boolean LinePlotImageDisplayIsFrameOn
( LinePlotImageDisplay lpid )
Returns true if the frame is drawn.
Boolean LinePlotImageDisplayIsGridOn
( LinePlotImageDisplay lpid )
Returns true if the grid is displayed on.
void LinePlotImageDisplaySetBackgroundOn
( LinePlotImageDisplay lpid, Boolean on )
Sets whether to erase the background.
void LinePlotImageDisplaySetBaseIntensity
( LinePlotImageDisplay lpid, Number
base_intensity )
Sets the base intensity of the line plot.
void LinePlotImageDisplaySetContrastLimits
( LinePlotImageDisplay lpid, Number lowLimit,
Number highLimit )
Sets the lowest and highest intensities displayed.
void LinePlotImageDisplaySetDisplayedChannels
( LinePlotImageDisplay lpid, Number leftChannel,
Number rightChannel )
Sets the leftmost and rightmost displayed channels.
Digital Micrograph
276
void LinePlotImageDisplaySetDoAutoSurvey
( LinePlotImageDisplay lpid, Boolean
doAutoSurveyLow, Boolean doAutoSurveyHigh )
Sets whether to do auto-survey on the high and low intensity limits.
void LinePlotImageDisplaySetFilled
( LinePlotImageDisplay lpid, Boolean on )
Sets whether to fill the lineplot.
void LinePlotImageDisplaySetFrameOn
( LinePlotImageDisplay lpid, Boolean on )
Sets whether to draw the frame.
void LinePlotImageDisplaySetGridOn
( LinePlotImageDisplay lpid, Boolean on )
Sets whether to draw the grid.
void LinePlotImageDisplaySetSlice
( LinePlotImageDisplay lpid, Number slice )
Sets the slice currently displayed at the bottom.
void LinePlotImageDisplaySetSliceComponentColor
( LinePlotImageDisplay lpid, Number slice_index,
Number comp_index, Number r, Number g, Number
b )
Sets the color of the 'comp_index'th component of the 'slice_index'th slice.
void LinePlotImageDisplaySetSliceDrawingStyle
( LinePlotImageDisplay lpid, Number slice_index,
Number style )
Sets the drawing style of the 'slice_index'th slice.
void LinePlotImageDisplaySetTrackingStyle
( LinePlotImageDisplay lpid, Number
track_style_x, Number track_style_y )
Sets the tracking style of the line plot.
Related Functions
LinePlotImageDisplay =( LinePlotImageDisplay dst,
LinePlotImageDisplay lpid )
LinePlotImageDisplay =( LinePlotImageDisplay
dst, ! )
LinePlotImageDisplay =( LinePlotImageDisplay dst,
ImageDisplay id )
Copyright 2012 Gatan Inc. All Rights Reserved.
277
DigitalMicrograph
LinePlotImageDisplay LinePlotImageDisplayNullify
( ! )
1.8.5.6.10 ROI Object
ROI Object
Overview
ROI's are described in the section "Using Regions of Interest". The scripting language
allows access to all the features available through the normal user interface.
Digital Micrograph
278
imgDisplay.ImageDisplayAddROI( myROI2 )
// create a vertex ROI
ROI myROI3 = NewROI( )
myROI3.ROISetPoint( 200, 200 )
myROI3.ROIAddVertex( 225, 225 )
myROI3.ROIAddVertex( 250, 200 )
myROI3.ROIAddVertex( 225, 175 )
myROI3.ROIAddVertex( 200, 200 )
myROI3.ROISetColor( 0, 0, 1 )
imgDisplay.ImageDisplayAddROI( myROI3 )
// show image
imageDoc.ImageDocumentShow()
Getting and Setting properties of ROI
ROI have the following properties which can be set in the scripting language:
Property
name
Default value
label
id
unique integer
color
red (1, 0 , 0)
moveable
deletable
resizable
volatile
yes
yes
yes
yes
Description
string used to identify
ROI. Allows finding ROI
with function "ROI
ImageDisplayLookupROI
( ImageDisplay imgDisp,
String name ) "
Labels are displayed near
the ROI
integer used to identify
ROI. Allows finding ROI
with function "ROI
GetROIFromID( Number
id ) " or "ROI
ImageDisplayLookupROI
ByID( ImageDisplay
imgDisp, Number id ) "
All ROIs are drawn in a
striped pattern with half of
the pixels white and the
other half set to the
specified color. If the ROI
is not volatile, it is drawn
solidly in the specified
color.
279
DigitalMicrograph
closed
The properties moveable, deletable, resizable and volatile can be used to assist the
user in interacting with the ROI. For example if you create an image and place an ROI
on it that you want the user to move somewhere, you can set the ROI to be not
deletable to prevent the user from deleting the ROI and making your procedure
useless.
Finding ROIs
Given an ImageDisplay, you can find all ROIs that are located on it using hte functions
"Number ImageDisplayCountROIs( ImageDisplay imgDisp ) " and "ROI
ImageDisplayGetROI( ImageDisplay imgDisp, Number index ) ".
The following example shows an example of using those functions:
// open image
image myImage := GetFrontImage()
ImageDisplay imageDisp = myImage.ImageGetImageDisplay
( 0 )
number count = imageDisp.ImageDisplayCountROIS()
number index
for (index = 0; index < count; ++index )
{
ROI currentROI = imageDisp.ImageDisplayGetROI
( index )
Result( "ROI named " + currentROI.ROIGetName() +
\
" has " + currentROI.ROICountVertices() + "
vertices.\n" )
}
Methods
void ROIAddToMask( ROI roi, ImageReference mask,
Number top, Number left, Number bottom, Number
right )
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
280
Add the region of interest to the image within the bounds of the specified
rectangle.
281
DigitalMicrograph
Digital Micrograph
282
283
DigitalMicrograph
Related Functions
ROI =( ROI, ! )
Assign a region of interest to a new variable.
ROI NewROI( )
Creates an empty region of interest.
ROI ROINullify( ! )
Digital Micrograph
1.8.6
284
Image Operations
Image Operations
Since the DigitalMicrograph scripting language is an interpreted language, is is very slow to
process images by using nested for-loops that access each pixel. This section shows how
you can accomplish the same things by using special image operations.
a = b + 10
This operation takes the value of every pixel in b, adds 10 to it, and stores the result
into a. Pixel by pixel operations are compiled into machine code to optimize their
speed of execution. Several operations in an image expression may be combined.
This provides a significant performance gain over interpreted expressions. Within a
script, and even on the same line, interpreted expressions may be mixed with
expressions that will be compiled. The compiling is transparent to the script writer
and user. (With the exception that a well written script that uses image expressions
will run much faster than one that uses GetPixel and SetPixel to manipulate every
pixel in an image.)
Intrinsic Variables
Intrinsic variables are predefined variables which take on context sensitive values. All
of the intrinsic variables in the script language pertain specifically to image
expressions. Below is a list:
Name
icol
icolumn
iheight
ipoints
iradius
irow
itheta
iwidth
Description
column of the image expression
equivalent to icol
height of the image expression
number of points in the image
expression
distance from the center of the image
expression
row of the image expression
angle with respect to the center of the
image expression
width of the image expression
285
DigitalMicrograph
iplane
Some, like ipoints, are constant within an expression for every point evaluated. While
others, like irow, may change at every pixel position in an image expression.
Physical Size
Every image expression must have a physical size before it is evaluated . The
physical size of an image expression is expressed as its width and height.
Usually the physical size of an image expression is the size of images in the
expression.
Intrinsic variables like i col and i r ow do not have an innate size and are context
specific.
Sometimes it is useful to create abstract image expressions that are the result of
mathematical operators applied to the intrinsic variables. However, such image
expressions do not have a physical size and will generate an error if, for example,
assigned to image letters. The function Expr Si ze( ) allows us to give an expression
a physical size. It is defined for real, complex, and RGB image expressions. The
definition for the real version is:
a = 10
would produce an error. By using ExprSize() we can change this example to make it
work:
Digital Micrograph
286
Some examples of functions that take images and result in numbers are:
Function
sum(a)
product(a)
mean(a)
rms(a)
max(a)
min(a)
Description
sums pixels in image expression
multiplies pixels in image expression
mean of pixels in image expression
root mean square of pixels in image
expression
maximum of pixels in image
expression
minimum of pixels in image expression
Some examples of functions that take images and result in images are:
Function
FFT()
IFFT()
RealFFT()
RealIFFT()
Rotate()
Description
Calculates the complex FFT of a
complex image
Calculates the complex IFFT of a
complex image
Calculates the complex FFT of a real
image
Calculates the real IFFT of a hermitian
complex image
Arbitrarily rotates an image
Whole image operations differ from pixel by pixel operations in that each whole image
operation must be completed before its result can be used. Whole image operations
that result in an image can't be compiled or parallelized with other operations. This
normally is of little concern to the script writer with the exception of possible increased
memory requirements if temporary images have to be created to complete the
specified operations.
Image Subareas
An image subarea is a rectangular sub section of a image.
The Subarea Operator
To create a subarea the subarea operator can be used. The three variations are
(defined as functions):
realsubarea operator[( realimage img, number top, number left, number
bottom, number right )
complexsubarea operator[( compleximage img, number top, number left,
number bottom, number right )
rgbsubarea operator[( rgbimage img, number top, number left, number
bottom, number right )
287
DigitalMicrograph
The argument img is the image that the subarea refers to. The arguments top, left,
bottom, and right define the rectangular sub section of that image. Note that bottom
and right are noninclusive. For example, given an image a (256 x 256) and image b
(1024 x 1024),
a = b[ 0, 0, 256, 256 ]
This copies a 256 x 256 square area of pixels from b into a.
The subarea operator may be applied to image expressions. For example, given
image a (128 x 128), images b and c (both 256 x 256),
The previous example was intended as an example and not the most efficient method
of accomplishing the end effect. It should be rewritten as:
Setting Subareas
The = (assignment by value) operator is defined for assignment of image expression
to image subareas. For example, given image a,
a[ 0, 1, 20, 30 ] = 0
This would set all of the pixels in the rectangular area of a, with the top/left corner at
(x=1,y=0) and bottom/right corner to (x=30,y=20), to the value 0.
Subarea Variables
Image subarea variables can be declared in a similar ease to image variables. For
example,
subarea center
complexsubarea xyz
rgbsubarea abc
To set a subarea variable use the := (assignment by reference) operator. For
example, given the image a,
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
288
portion = b
This sets the value of the pixels in the subarea of a, [ 20, 20, 40, 40 ], to values of the
pixels in b.
a = b[]
This sets the values of the pixels in image a to the values of the pixels in the subarea
of b equivalent to the selection. The above example is equivalent to:
a = b[0,0,128,128]
Slices
An image slice is a generalization of an image subarea. It specifies a regular grid of
points in an image, whose only restriction is that each dimension of the slice must be
parallel to a dimension of the containing image. Thus, unlike a subarea, its points may
be noncontiguous in the containing image, each dimension of the slice may be
oriented along any dimension of the containing image, and the order of traversal of a
dimension in the slice may be opposite that of the containing image.
A slice can be specified by a starting point, a slice dimensionality, and for each
dimension, a dimension in the containing image, a length, and a stride. (Implicit in the
starting point is its dimensionality, which may be different from the slice dimensionality
).
The script functions of the form
289
DigitalMicrograph
class ImageDataSlice
{
ScriptObject GetImageDataSize( ScriptObject self );
ulong
GetNumDimensions( ScriptObject self );
void
SetNumDimensions( ScriptObject self,
ulong sn );
ulong
GetDimensionStartIndex( ScriptObject
self, ulong i );
void
SetDimensionStartIndex( ScriptObject
self, ulong i, ulong start_index );
Digital Micrograph
290
void
Examples
Assume we have a 3 dimensional image src_img with dimensions x_len, y_len, and
z_len
To extract a slice at location (x,y) that extends along the z axis, one would use
291
1.8.7
DigitalMicrograph
Packages
Packages
This chapter covers the ability to group scripts together and place them into an automatically
loaded module.
module com.gatan.dm.dialogs
To declare that a script requires another module, put a line like the following into your
script:
uses com.gatan.dm.dialog_handler
Any particular script can only have a single module declaration but may have as many
uses declarations as are necessary.
The module and uses declarations are only handled on a per-package basis. This
means that the package author is responsible for making sure that the scripts within
the package load in the proper order.
When packages are loaded, all scripts within the package combine to form a list of
modules defined in that package. Other packages that require a particular module
from a given package will cause the entire package containing that module to be
loaded. Furthermore, a particular package will not be loaded unless packages
containing all modules listed in the particular package's uses list can be loaded first.
The user should be aware that circular references are not allowed. This means that if
package A requires package B, package B cannot require package A. Both packages
will fail to load in this case.
1.8.8
Digital Micrograph
292
Index
1000
preference
1004
plugin
1008
color_table
1012
core
1016
Description
The application's
directory.
The directory where the
preference file is
located.
The directory where
plug-ins are located.
The directory where the
color table images are
located.
The directory where the
core script plug-ins are
located.
293
DigitalMicrograph
reference_image
1020
auto_save
1100
current
executable
0
1
open_save
temporary
system
3
4
string PathBeginRelative()
returns a starting point for a relative path.
Digital Micrograph
294
returns the file name extension portion of the given path according to the
path_type parameter. The path_type variable should be 0.
Stream Object
The following object can be used to access a low level stream.
class Stream
{
number StreamGetSize( object self )
returns the size of the stream in bytes.
}
You can create a stream object with the following functions.
295
DigitalMicrograph
Digital Micrograph
296
parameter ulong index. The specific type of the tag determines the format with which
the data will be transferred between the tag and the stream. For example, to stream
out two 32-bit unsigned integers, followed by a 32-bit signed integer, and then two 16bit unsigned integers, use the script
default
0
0
)
0
0
)
)
)
)
"UInt32_0",
"UInt32_1",
"SInt32_0",
"UInt16_0",
"UInt16_1",
Explanation
Default byte order of the current
platform
Big-endian byte order
)
)
)
)
297
DigitalMicrograph
Digital Micrograph
298
(0xD, 0xA, 0x0). The resulting string is assumed to be encoded in the local
encoding and is returned in the parameter string. The result of the function is 1
to indicate it succeeded and 0 to indicate it failed.
299
DigitalMicrograph
Memory Buffers
The memory buffer represents a range of memory. The following function can
be used to create memory buffer objects.
Text Encoding
1.8.9
Value
0
Name
local encoding
western encoding
unicode encoding
Explanation
Local character set.
Determined by settings in
Windows.
DigitalMicrograph (US)
character set.
Unicode character set.
Utility Functions
Utility Functions
Timing
DigitalMicrograph provides access to tick-based timers at two resolutions, low and
high. Each timer is implemented on top of an internal tick count that is periodically
updated to reflect the time passed since some reference point, with each count
indicating an elapsed time of tick_unit seconds.
Number GetOSTickCount()
Returns the current tick count.
Number GetHighResTickCount()
Returns the current high resolution tick count.
Number GetOSTicksPerSecond()
Returns the number of tick units in one second, which is 1000.
Number GetHighResTicksPerSecond()
Returns the number of high res tick units in one second.
Digital Micrograph
300
Number GetOSTickResolution()
Number GetHighResTickResolution()
Even though the elapsed time is reported with a resolution of tick_unit
seconds, the timer might not actually update the tick count with that frequency.
This function returns an estimate of the minimum number of ticks between
two unequal tick counts returned by GetOSTickCount() and
GetHighResTickCOunt()
Date/Time
DigitalMicrograph provides a set of utility functions that manipulate a date represented
as a 64-bit signed integer which represents a number of time units of duration
date_time_unit seconds past a reference date reference_date. Both date_time_unit
and reference_unit are platform dependent, but routines are provided for converting
between dates with differing time units and reference dates, and more specialized
routines are provided for converting to and from the long value Java typically uses for
specifying dates and times, milliseconds since January 1, 1970, 00:00:00 GMT. Note
that these functions are only as accurate as the clock implemented by the underlying
system.
Number GetCurrentTime()
Returns the number representing the current date and time.
Number GetUnixEpochTime()
Returns the number representing the date and time January 1, 1970, 00:00:00
GMT.
301
DigitalMicrograph
convert from milliseconds since the Unix epoch to the platform time, one can
use AddTimeUnitsToTime( GetUnixEpochTime(), time, 1000.0 ).
Utility functions are provided to convert between calendar dates and time for
two calendars, Universal Coordinated Time and the proleptic Gregorian
Calendar in the system's current time zone. The date is represented as year,
month, day, hour, minute, second, and nanoseconds, and the conversion
functions come in two forms, the construct function which converts a calendar
date to a time, and a deconstruct function that converts a time to a calendar
date. These functions rely on platform functions to implement the conversion,
so any limits in the underlying implementation are exposed in these functions,
but dates in the 20th and 21st centuries are ok. The function prototypes are
listed below.
Digital Micrograph
302
Example scripts
Tag Types explores how different tag types are encoded.
1.8.10.1 Tag Types
Tag Types
Description
Tags have a type. This script adds tags of all different typtes to a TagGroup and then
printsout the contents of the TagGroup. This shows how all the tagTypes are
encoded.
Script Code
TagGroup tg = NewTagGroup()
number index
index = tg.TagGroupCreateNewLabeledTag( "Array" )
tg.TagGroupSetIndexedTagAsArray( index,
CreateFloatImage("temp", 512, 512) )
index = tg.TagGroupCreateNewLabeledTag( "Boolean" )
tg.TagGroupSetIndexedTagAsBoolean( index, 1 )
index = tg.TagGroupCreateNewLabeledTag( "Double" )
tg.TagGroupSetIndexedTagAsDouble( index, 4.5678 )
index = tg.TagGroupCreateNewLabeledTag( "Complex" )
tg.TagGroupSetIndexedTagAsDoubleComplex( index, complex
( 0.5, 0.7 ) )
index = tg.TagGroupCreateNewLabeledTag( "RGB" )
tg.TagGroupSetIndexedTagAsEightBitColor( index, rgb
( 255, 0, 0) )
index = tg.TagGroupCreateNewLabeledTag( "Float" )
Copyright 2012 Gatan Inc. All Rights Reserved.
303
DigitalMicrograph
Digital Micrograph
304
Discussion
The above script generate the following output:
20
8
15
15
7
6
6
0
0
0
0
0
262144
Array
0
Boolean
2
Complex
2
ComplexNumber
0
Double
0
Float
305
DigitalMicrograph
15
15
15
3
15
15
7
3
3
15
2
15
15
20
0
20
4
5
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
4
0
0
2
2
4
0
2
4
0
0
0
3
0
2
4
16
0
15
0
0
FloatComplex
FloatPoint
FloatRect
Long
LongPoint
LongRect
Number
RGB
RGBNumber
RGBUInt16
Short
ShortPoint
ShortRect
String
TagGroup
Text
UInt16
UInt32
From this output one can deduce the following type info:
0 TagGroup
2 Short
3 RGB or Long (both contain 4 bytes)
4 UInt16 (unsigned short)
5 UInt32 (unsigned long)
6 Float
7 Number or Double
8 Boolean
15 Any multiItem field. In this case the third column takes on
2 Complex, FloatComplex, FloatPoint, LongPoint or ShortPoint
3 RGBUInt16
4 FloatRect or ShortRect
(Showing more field from the TagType allows differentation among all the
types)
20 Array type, where second column shows datatype and third column
number of items
1.8.11 Reference
1.8.11.1 Script Functions By Category
Digital Micrograph
306
Real Numbers
Operators
Functions
Complex Numbers
Operators
Functions
RGB Numbers
Operators
Functions
Real Images
Complex Images
RGB Images
Image Data Types
Image Management
Image Processing
Image Display
Image Selections
Image Scrap
Annotations
Persistent Notes
Image Notes
Annotation Notes
Strings
Operators
Functions
Number Conversion
Input/Output
Dialogs
Miscellaneous
Real Numbers
Operators
Name
!
!=
&&
*
**
*=
+
++
Summary
Logical NOT operator for a real
number
Inequality operator for real numbers
Logical AND operator for real numbers
Multiply operator for real numbers
Exponentation operator for real
numbers
Multiply and assign operator for real
numbers
Addition operator for real numbers
Increment operator for a real number
307
DigitalMicrograph
+=
--=
/
/=
<
<=
=
==
>
>=
?
||
Functions
Name
abs
acos
AiryAi
AiryBi
asin
atan
atan2
atanh
BesselI
BesselJ
BesselK
BesselY
Beta
BinomialCoefficient
BinomialRandom
Summary
Calculates absolute value of a real
number
Calculates the arccosine of a real
number
Calculates the Airy Ai function
Calculates the Airy Bi function
Calculates the arcsine of a real
number
Calculates the arctangent of a real
number
Calculates the arctangent of y/x for
real numbers
Calculates the hyperbolic arctangent of
a real number
Calculates the general Bessel I
function
Calculates the general Bessel J
function
Calculates the general Bessel K
function
Calculates the general Bessel Y
function
Calculates the beta function
Calculates the binomial coefficient
Calculates a random number with
binomial distribution
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
clip
cos
cosh
distance
erf
erfc
exp
exp1
exp10
exp2
ExponentialRandom
Factorial
Gamma
GammaP
308
Complex Numbers
Operators
Name
!=
*
**
+
/
=
==
?
Summary
Inequality operator for complex
numbers
Multiply operator for complex numbers
Exponentation operator for complex
numbers
Addition operator for complex numbers
Negation operator for a complex
number
Subtraction operator for complex
numbers
Division operator for complex numbers
Assignment operator for complex
numbers
Equality operator for complex numbers
Arithmetic operator for complex
numbers
Functions
Name
abs
Copyright 2012 Gatan Inc. All Rights Reserved.
Summary
Calculates the absolute value of a
309
DigitalMicrograph
cis
complex
conjugate
cos
cosh
exp
imaginary
log
modulus
norm
Phase
Polar
real
Rect
sin
sinh
sqrt
tan
tanh
complex number
Calculates a unit vector in the complex
plane
Creates a complex number from two
real numbers
Calculates the conjugate of a complex
number
Calculates the cosine of a complex
number
Calculates the hyperbolic cosine of a
complex number
Calculates the exponential of a
complex number
Returns the imaginary portion of a
complex number as a real number
Calculates the logarithm of a complex
number
Calculates the modulus of a complex
number
Calculates the norm of a complex
number
Calculates the phase of a complex
number
Calculates the polar representation of
a rectangular complex number
Returns the real portion of a complex
number
Calculates the rectangular
representation of a polar complex
number
Calculates the sine of a complex
number
Calculates the hyperbolic sine of a
complex number
Calculates the square root of a
complex number
Calculates the tangent of a complex
number
Calculates the hyperbolic tangent of a
complex number
RGB Numbers
Operators
Name
!=
*
+
Summary
Inequality operator for RGB numbers
Multiply operator for RGB numbers
Addition operator for RGB numbers
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
/
=
==
?
310
Functions
Name
alpha
blue
green
red
rgb
rgba
Summary
Returns the alpha portion of an RGB
number as a real number
Returns the blue portion of an RGB
number as a real number
Returns the green portion of an RGB
number as a real number
Returns the red portion of an RGB
number as a real number
Creates an RGB number from the real
number arguments
Creates an RGB number from the real
number arguments
Real Images
Name
DotProduct
ExprSize
ExprSize
max
max
mean
MeanSquare
min
min
Polynomial
Copyright 2012 Gatan Inc. All Rights Reserved.
Summary
Calculates the dot product of two real
image expressions
Sets the physical size of a real image
expression
Sets the physical size of a real image
expression
Finds the maximum of a real image
expression
Finds the maximum value and position
for a real image expression
Calculates the mean of a real image
expression
Calculates the mean square of a real
image expression
Finds the minimum value and position
for a real image expression
Finds the minimum of a real image
expression
Calculates a polynomial expansion
311
DigitalMicrograph
product
RMS
sum
TimeBar
Warp
Complex Images
Name
DotProduct
ExprSize
ExprSize
Polynomial
product
sum
TimeBar
Warp
Summary
Calculates the dot product of two
complex image expressions
Sets the physical size of a complex
image expression
Sets the physical size of a complex
image expression
Calculates a polynomial expansion
using a complex image expression
Calculates the product of a complex
image expression
Calculates the sum of a complex
image expression
Displays a timebar while evaluating
complex image expression
Calculates bilinear interpolated value
within a complex image
RGB Images
Name
ExprSize
ExprSize
TimeBar
Warp
Summary
Sets the physical size of an RGB
image expression
Sets the physical size of an RGB
image expression
Displays a timebar while evaluating
RGB image expression
Calculates bilinear interpolated value
within a RGB image
Digital Micrograph
312
Summary
Creates a complex image
Creates an integer image
Checks if an image is a complex data
type
Checks if an image is an integer data
type
Checks if an image is a real data type
Checks if an image is an RGB data
type
Creates a real image
Creates an RGB image
Image Management
Name
ClearImage
CloseImage
CreateImageFromDisplay
DeleteImage
DoesImageExist
Get2DSize
GetFrontImage
GetFrontImage
GetImageDataSeed
GetImageFromID
GetImageFromID
GetImageID
GetLabel
GetName
GetNamedImage
GetNamedImage
GetSize
KeepImage
OpenImage
PrintImage
SaveImage
SetName
Summary
Clear an image
Close an image
Creates a display representation of an
image
Delete an image
Checks if an image exists
Get the size of an image
Gets the front image
Gets the front image
Gets an image's data seed
Gets image from an ID
Gets image from an ID, returns false if
none
Gets an image's ID
Gets the image letter of an image
Gets the name of an image
Get an image from a name
Get an image from a name, returns
false if none
Get the size of an image
Retains an image
Opens an image file
Prints an image
Saves an image
Sets the name of an image
313
DigitalMicrograph
Image Processing
Name
AnalyzeDiffractogram
AutoCorrelation
CrossCorrelation
CrossProduct
FFT
FlipHorizontal
FlipVertical
GetPixel
IFFT
MatrixDeterminant
MatrixInverse
MatrixMultiply
MatrixPrint
MatrixTranspose
MedianFilter
RealFFT
RealIFFT
Reduce
ReducedFFT
Rotate
RotateLeft
RotateRight
SetPixel
ShiftCenter
SwapByteOrder
SwapWordOrder
variance
Summary
Analyzes a diffractogram
Calculates the cross correlation of a
real image
Calculates the cross correlation of two
real images
Calculates the cross product
Calculates the complex FFT of a
complex image
Flips an image horizontally
Flips an image vertically
Gets a pixel in a real image
Calculates the complex IFFT of a
complex image
Calculates the matrix determinant of a
real image
Calculates the matrix inverse of a real
image
Calculates the matrix multiplication of
a real image
Prints an image as a matrix
Calculates the matrix transpose of a
real image
Applies a median filter to an image
Calculates the complex FFT of a real
image
Calculates the real IFFT of a hermitian
complex image
Reduces an image by a factor of two
Calculates reduced FFT
Arbitrarily rotates an image
Rotates an image to the left
Rotates an image to the right
Sets a pixel in a real image
Shifts each dimension of an image by
half
Performs a byte swap on each pixel in
an image
Performs a word swap on each pixel in
an image
Calculates the variance of an image
Image Display
Digital Micrograph
Name
DisplayAt
GetCLUT
GetOrigin
GetScale
GetWindowPosition
GetWindowSize
HideImage
SetColorMode
SetComplexMode
SetContrastMode
SetCustomCLUT
SetDisplayType
SetImagePositionWithinWindow
SetInversionMode
SetLimits
SetMinContrast
SetOrigin
SetScale
SetSurvey
SetSurveyTechnique
SetWindowPosition
SetWindowSize
SetZoom
ShowImage
UpdateImage
314
Summary
Display image at position
Gets the CLUT of an image
Gets the origin of an image
Gets the scale of an image
Returns position of an image window
Returns the size of an image window
Hides an image
Sets the color mode of an image
Sets the complex mode of an image
Sets the contrast mode of an image
Sets the CLUT of an image
Sets the display type of an image
Sets image position in window
Sets the inversion mode of an image
Sets the contrast limits of an image
Sets the minimum contrast of an
image
Sets the origin of an image
Sets the scale of an image
Sets surveying on or off for an image
Sets the survey technique of an image
Sets the position of an image window
Sets the size of an image window
Sets the zoom of an image
Shows an image
Forces an update of an image
Image Selections
Name
ClearSelection
ExpandSelection
GetSelection
SetSelection
Summary
Removes the selection from an image
Expands the selection of an image
Gets the selection rectangle of an
image
Sets the selection rectangle of an
image
Image Scrap
Name
ScrapClear
ScrapCopy
ScrapGetLocation
Summary
Removes the pasted image from an
image
Copies an image selection to the
scrap
Returns the top-left location of the
pasted image's rectangle
315
DigitalMicrograph
ScrapGetSize
ScrapMerge
ScrapPaste
ScrapPasteNew
ScrapSetLocation
Annotations
Name
AnnotationType
CountAnnotations
CreateArrowAnnotation
CreateBoxAnnotation
CreateDoubleArrowAnnotation
CreateLineAnnotation
CreateOvalAnnotation
CreateTextAnnotation
DeleteAnnotation
DeselectAnnotation
GetAnnotationRect
GetNthAnnotationID
IsAnnotationSelected
MoveAnnotation
OffsetAnnotation
SelectAnnotation
SetAnnotationBackground
SetAnnotationFace
SetAnnotationFont
SetAnnotationJustification
SetAnnotationRect
SetAnnotationSize
ValidAnnotation
Summary
Returns the type of an annotation
Returns the number of annotations in
an image
Creates an arrow annotation
Creates a box annotation
Creates a double ended arrow
annotation
Creates a line annotation
Creates an oval annotation
Creates a text annotation
Deletes an annotation
Deselects an annotation
Gets the rectangle of the annotation
Get the ID of an annotation
Checks if an annotation is selected
Moves an annotation
Offsets an annotation
Selects an annotation
Sets the background of an annotation
Sets the text face of an annotation
Sets the text font of an annotation
Sets the text justification of an
annotation
Sets the rect of an annotation
Sets the text size of an annotation
Checks if specified annotation exists
Persistent Notes
Name
DeletePersistentNote
GetPersistentComplexNumberNote
GetPersistentNoteState
Summary
Deletes persistent note
Gets the value of a persistent complex
number note
Gets persistent note state
Digital Micrograph
GetPersistentNumberNote
GetPersistentRectNote
GetPersistentRGBNumberNote
GetPersistentStringNote
GetPersistentStringNote
SetPersistentComplexNumberNote
SetPersistentKeywordNote
SetPersistentNoteState
SetPersistentNumberNote
SetPersistentRectNote
SetPersistentRGBNumberNote
SetPersistentStringNote
316
Image Notes
Name
DeleteNote
GetComplexNumberNote
GetNoteState
GetNumberNote
GetRectNote
GetRGBNumberNote
GetStringNote
GetStringNote
SetComplexNumberNote
SetKeywordNote
SetNoteState
SetNumberNote
SetRectNote
SetRGBNumberNote
SetStringNote
Annotation Notes
Copyright 2012 Gatan Inc. All Rights Reserved.
Summary
Deletes image note
Gets the value of an image complex
number note
Gets image note state
Gets the value of an image number
note
Gets the value of an image rect note
Gets the value of an image RGB
number note
Gets the value of an image string note
Gets the value of an image string note
Sets the value of an image complex
number note
Adds a keyword note to an image
Sets image note state
Sets the value of an image number
note
Sets the value of an image rect note
Sets the value of an image RGB
number note
Sets the value of an image string note
317
DigitalMicrograph
Name
DeleteAnnotationNote
GetAnnotationComplexNumberNote
GetAnnotationNoteState
GetAnnotationNumberNote
GetAnnotationRectNote
GetAnnotationRGBNumberNote
GetAnnotationStringNote
GetAnnotationStringNote
SetAnnotationComplexNumberNote
SetAnnotationKeywordNote
SetAnnotationNoteState
SetAnnotationNumberNote
SetAnnotationRectNote
SetAnnotationRGBNumberNote
SetAnnotationStringNote
Summary
Deletes annotation note
Gets the value of an annotation
complex number note
Gets annotation note state
Gets the value of an annotation
number note
Gets the value of an annotation rect
note
Gets the value of an annotation RGB
number note
Gets the value of an annoation string
note
Gets the value of an annoation string
note
Sets the value of an annotation
complex number note
Adds a keyword to an annotation
Sets annotation note state
Sets the value of an annotation
number note
Sets the value of an annotation rect
note
Sets the value of an annotation RGB
number note
Sets the value of an annotation string
note
Strings
Operators
Name
!=
+
+
+
+
+
+
Summary
Inequality operator for strings
Concatenate a string and a real
number
Concatenate an RGB number and a
string
Concatenate a string and a complex
number
Concatenate a complex number and a
string
Concatenate a string and an RGB
number
Concatenate a real number and a
string
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
+
==
318
Functions
Name
asc
chr
left
len
mid
right
val
Summary
Returns numeric value in ascii
Returns ascii equivalent of a number
as a string
Returns the leftmost portion of a string
Returns the length of a string
Returns the middle portion of a string
Returns the rightmost portion of a
string
Converts a string to a real number
Number Conversion
Name
BaseN
BaseN
Binary
Binary
Decimal
Decimal
Hex
Hex
Octal
Octal
Summary
Convert a number to an arbitrary base
string
Convert a number to an arbitrary base
string with a fixed length
Convert a number to a binary string
with a fixed length
Convert a number to a binary string
Convert a number to a decimal string
Convert a number to a decimal string
with a fixed length
Convert a number to a hex string with
a fixed length
Convert a number to a hex string
Convert a number to an octal string
with a fixed length
Convert a number to an octal string
Input/Output
Name
CommandDown
format
GetKey
OptionDown
Result
Summary
Returns command key state
Formats a number printf style
Returns key
Returns option key state
Outputs formatted number to result
window
319
DigitalMicrograph
Result
Result
Result
Result
ShiftDown
SpaceDown
Dialogs
Name
Summary
Boolean ContinueCancelDialog( String Show a dialog with a continue and a
prompt )
cancel button
RealNumber getnumber( String
Show a dialog that allows the user to
prompt, RealNumber init_val,
enter a number.
RealNumber ret_val )
RealNumber getstring( String prompt, Show a dialog that allows the user to
String init_val, String ret_val )
get a string.
Boolean GetTwoImages( String title, Show a dialog that allows the user to
BasicImage image1, BasicImage
select two open images.
image2 )
Boolean GetTwoImagesWithPrompt Show a dialog that allows the user to
( String prompt, String title,
select two open images, and displays
BasicImage image1, BasicImage
a prompt.
image2 )
Boolean OkCancelDialog( String
Show a dialog with an ok and a cancel
prompt )
button.
Boolean OkDialog( String prompt )
Show a dialog with an ok button.
Boolean OpenDialog( String pathname Show a dialog that allows the user to
)
select a file for opening.
Boolean SaveAsDialog( String prompt, Show a dialog that allows the user to
String defaultName, String
select a file for saving to.
saveName )
Boolean TwoButtonDialog( String
Show a dialog with a prompt and two
prompt, String acceptLabel, String
buttons. This dialog does not show an
rejectLabel )
icon.
Miscellaneous
Name
AddCustomFunctionFileToMenu
AddScriptFileToMenu
AddScriptToMenu
Beep
CloseProgressWindow
DateStamp
Summary
Adds a custom function to the menu
Adds a script file to the menu
Adds a script string to the menu
Sounds beep
Closes the progress window
Returns date and time
Copyright 2012 Gatan Inc. All Rights Reserved.
Digital Micrograph
Delay
ExecuteScriptFile
ExecuteScriptString
GetDate
GetExceptionString
GetScreenSize
GetTime
GetUnitString
OpenAndSetProgressWindow
OpenResultsWindow
SetUnitString
Throw
Throw
320
Delays
Executes a script file
Executes a script string
Gets date
Get exception string
Get the screen size
Gets time
Gets the units description of an image
Opens and sets the progress window
Opens the results window
Sets the units description of an image
Throws a string exception
Throws a number exception
321
DigitalMicrograph
File Tools
109
Finding Particles
100
Fourier Masking
93
Fourier Processing
89
Functions
142
Index
-AAbout Contrast Limits
34
About Contrast Transformations
About Image Displays
32
About Lookup Tables
42
Acquisition Status
116
Analyzing Particles
102
Annotations
64
Auto-Correlations
91
39
Histogram
Histograms
Image Documents
56
Image Object
240
Image Operations
284
Image Preparation
98
Image Processing and Analysis
Image Status
114
Image Transformations
80
ImageDisplay Object
261
ImageDocument Object
231
Images
103
Importing Images
27
Introduction
3
Databar
29
Dialogs
207
DigitalMicrograph Environment
Display Control
113
-EEditing Annotations
61
Event Handling
168
Example Scripts
302
Expressions
129
68
-D-
273
-M4
Manipulating Annotations
Masking Tools
112
Menus
192
57
-OObjects
146
Overview
1
Overview of Image Processing
77
-P-
113
97
-I-
-BBasic Concepts
-H-
291
Packages
291
Copyright 2012 Gatan Inc. All Rights Reserved.
Index
Particle Analysis
98
Printing Image Documents
Progress
116
15
-RR
109
RasterImageDisplay Object
Read Tag Types
302
ROI Object
277
ROI Tools
112
269
-W-
-S-
Window Object
-TTagGroup Object
171
Target
115
The DigitalMicrograph Process
Threading
157
Thresholding
99
Types and Variables
127
-UUsing Calibrations
74
Using Convolutions
86
Using Filtering
82
Using Floating Palettes
17
Using Fourier Transforms
90
Using Image Displays with Complex Data
Using Image Windows
8
Using Line Plot Image Displays
45
Copyright 2012 Gatan Inc. All Rights Reserved.
55
203
322