Questions tagged [dm-script]
A scripting-language used within the DigitalMicrograph software.
355
questions
1
vote
1
answer
41
views
How to use a for loop to judge whether the string contains any word in the list?
I'd like to know whether a string contains the word from a list. For example, I have 3 strings, 120kV_xxxx, 200kV_abc, abcdefg. I'd like to choose the string started with voltage, and exclude the last ...
0
votes
1
answer
21
views
How to list all the information in TagGroup
I have a TagGroup file (gtg file) with multi-layers. For example:
top_layer:mid_layer1,true
top_layer:mid_layer2,'abc'
top_layer:mid_layer3,123
For dm-script, I think maybe I can list all the ...
2
votes
1
answer
20
views
What the function of TagGroupReleaseSeeds
In the manual of DM script, it said the function of TagGroupReleaseSeeds is "Releases the seeds returned by 'TagGroupGetSeeds'." But I can't catch the meaning. Could anyone give me more ...
2
votes
1
answer
28
views
How to trigger opening html file by default browser in GMS
I'd like to use LaunchExternalProcess to trigger opening html file in GMS. I have tested the command in cmd, and it works.
The cmd command is
start X:\Manual\index.html
But if I use the code below in ...
-1
votes
1
answer
29
views
How to get the center of FFT spot
I'd like to the exact position of FFT spot. I can firstly give a rough position to the script, and then the script will extract a box with defined size. Then I'd like to automatically get the exact ...
0
votes
1
answer
27
views
Is there a DM script command controlling the STEM image raster rotation during continuous image acquisitions?
I want to write a DM script for acquiring STEM images continuously with DigiScan, accompanied with the changing of raster rotation angles of individual STEM images by, for example, 10 degrees for each ...
2
votes
1
answer
25
views
Set threshold for realfield input widget
Hi, all:
I'd like to set threshold for the input value in the realfield widget. The code below will create a realfield widget, and the threshold of input value is between 0 to 0.05.
If you input 0.06 ...
0
votes
1
answer
29
views
Adjust STEM detectors gain
In GMS3 is it possible to write a script that displays the manual gain settings instead of right click on the detector and select « manual gain adjust »?
On the previous versions, the gain adjustment ...
0
votes
1
answer
35
views
A button with changable label
all
I'd like to create a button, whose function is to enable and disable other widgets. At first, the label of this button is Enable. When I click the Enable button, the label of this button will ...
2
votes
2
answers
68
views
Is that possible to generate gtk via command
Hi, all
Previously, I added my script to GMS menu by using GMS GUI. And it will generate a gtk file which can be shared to other users. But now I'd like to use command line to achieve this, so that I ...
1
vote
1
answer
37
views
How to change the file type in the dialog opened by OpenDialog
Hi, all:
I'd like to choose a tif file in the dialog opened by OpenDialog command. But the default file type is dm files and so on. I need to change the file type to All files, then I can choose tif ...
0
votes
1
answer
43
views
How to automatically identify the edge or the FFT points
Hi, all:
I'd like to develop a script to automatically calibrate the pixel size of different mag. Basically, I will face two issues:
Identify the edge of stripes (Mag*I*CAL sample), and calculate the ...
0
votes
1
answer
19
views
Captions are great - if only I could keep just the x- caption and dump the Intensity caption in line plots
The command
ImageDisplaySetCaptionOn( ImageDisplay imgDisp, Boolean on )
is great, but it turns all the captions on/off for line plots.
Is there any way to keep the abscissa caption and dump the ...
2
votes
2
answers
30
views
How to add an image over an existing image?
With two images, I can do a copy and paste of one image onto the other.
How can I do this in scripting? I tried the following script:
image front := c // e.g., raster image; may need to adjust ...
1
vote
2
answers
46
views
How to make the width of all the boxes the same
Hi, all:
I'd like to make the UI more organized. One problem is that we can't define the box width. One possible solution is to add an empty label with fixed width to define the width of box. But it ...
2
votes
1
answer
32
views
How to use the top right corner of an annotation as the positioning anchor
Hi, all:
I'd like to add one annotation in the image and use the top right corner as the positioning anchor. Currently, I know how to use the top left corner. But I tried different commands and failed ...
2
votes
1
answer
29
views
What does CountImages() actually do?
The command CountImages() has unexpected behaviors. I found it can return a number > 0 even if there is no image in sight anywhere. I have also noticed that it can count all displayed images twice....
2
votes
1
answer
20
views
What's the difference between DLGTableLayOut(2, 1, 0) and DLGLayout(DLGCreateTableLayout(2, 1, 0))
all:
In the DM manual, I saw there are two ways to define layout, DLGTableLayOut(2, 1, 0) and DLGLayout(DLGCreateTableLayout(2, 1, 0)). I tried them, and seems the same. Is there any difference?
...
1
vote
1
answer
32
views
Is that possible to use one class to define one tab in UI?
all:
I tried to build a GUI which has several tabs. If I put all the functions in one class, the class will be very long and there may be some widget functions with the same name. Thus, I'd like to ...
2
votes
1
answer
35
views
What's the difference between DLGAnchor and DLGSide
all:
I found that there are two method to align the widgets, DLGAnchor and DLGAlign. It seems the function of these two are the same. Could anyone give an example about the usage difference?
Regards
...
2
votes
1
answer
21
views
The user mode of DM is not updated after changing the global tag group
Hi, all:
I'd like to change the user mode at Help->User Mode from Regular to Power user by using script (see below). After running the script, the global tag group has changed, but the tick at Help-...
2
votes
2
answers
28
views
Dual type of return value
all:
I'd like to construct a function. The type of return value may have two possibilities: number or string. At first, I thought I can use the overloading function (see the code). But this function ...
1
vote
1
answer
24
views
Get information from tagGroup
all:
I tried to use tagGroup to save flags and parameters. When I tried to read them by using TagGroupGetTagAsBoolean(tag_path, value), it will return nothing if the tag_path doesn't exist. Then the ...
1
vote
1
answer
29
views
Is that possible to use script to change the preference inside global info
all:
I'd like to use script to change the preference of Save Image inside Global Info. I'd like to change it to "Ignore the annotation(s)" before saving image. But I didn't find any useful ...
0
votes
1
answer
27
views
How to hide some sub-menu items
all:
I have create a menu with 5 sub-menus. But in some case, I only would like to display 3 of these sub-meunus. Besides generating a new menu, is that possible to use some flag to display the needed ...
1
vote
1
answer
41
views
Changing scale bar unit of length
I'm using the example script found from the F1 Help menu, "Set all scale-bars to same style" to insert a scale bar onto my ImageDisplay. The issue is that the scale bar's label defaults to ...
1
vote
1
answer
30
views
Executing EELS Analysis Script Commands
I'm trying to use the EELSSubtractPowerLawBackground or EELSComputePowerLawBackground functions in DM-script, but I continue getting the error "Function not found." Could this be due to ...
2
votes
1
answer
59
views
Opening ImageDocument from Files
In my script, I saved an ImageDocument to my local drive as a Gatan file. I've used the command ImageDocumentGetCurrentFile() to get that file's path. Now I'm trying to load that file back into my DM ...
2
votes
2
answers
61
views
Separating and combining ImageDisplay layers
Is it possible in DM-script to take an ImageDisplay containing multiple layers and separate those layers into different image windows? And conversely, is it possible to overlay separate displays to ...
1
vote
1
answer
41
views
Digital Micrograph - Callback to return a custom image on CameraAcquire() method
I'm doing some automation tests with Digital Micrograph and I would like to return a custom image from a specific folder when acquiring an image. I couldn't find a clear event in the documentation. Is ...
1
vote
2
answers
89
views
Is it possible to load .png files into DigitalMicrograph directly
Has anyone been successful in loading .png files directly into DM? I used the menu item 'Import Data..." and know the image size in pixels and tried all combinations but did not succeed. Any ...
2
votes
1
answer
29
views
which slice of a multi-slice lineplot is selected?
Given a multi-slice lineplot, one of the slices can be selected by clicking it in the legend with the mouse. From the scripting side, there is a command to imgdsp.ImageDisplaySetSliceSelected(). But ...
2
votes
1
answer
25
views
Predefined event message for 3D images: change slice
Is there a predefined event message for 3D images when a user changes the slice?
The ROI_changed event does not trigger on a slice change.
The data_changed event does not trigger on a slice change ...
2
votes
1
answer
52
views
Any better way to convert float image to integer image?
all:
I'm using the following code to convert the rotated image (float image) to integer image. I'm not sure whether it's the best way. If there is any better way, please let me know.
Image img := ...
2
votes
1
answer
42
views
Do we need to delete the image variable to recycle memory space
all:
If we use GMS's Python script, we need to manually delete the global image variable. Otherwise, it will always be in the memory. For DM script, do we need to do something similar?
2
votes
1
answer
39
views
How to read a config file such as json or ini in gatan script
all:
I'd like to use the config file to flexibly set the strings and checkbox status in the UI. For example, the content in ini config file is like below:
[basic]
display_mag = False
display_scalebar =...
1
vote
1
answer
36
views
How to switch the function of menu or UI by pressing Shift key
all:
I found the content of menu can be changed by pressing Shift key before clicking it. For example, if I don't press Shift key, the content of menu is for 2D imaging processing. But if I press ...
1
vote
1
answer
37
views
DM script to trigger "Capture" button
Is there a function to trigger the camera acquisition button in DM?
I am looking for this for K3 camera. For K camera, the built-in "Capture" button acquires many fast cycles within the ...
0
votes
1
answer
41
views
How to use predefined functions for catching a ROI changed event?
Under scripting/Predefined Events/ImageDisplay Listener/
there is a nice example 'class CListen': a mouse click within an image returns the coordinates of the point of click.
I tried to use the event ...
2
votes
1
answer
59
views
How to protect the source code of dm script
all:
I'd like to protect my source code of dm script. Now I converted it to gtk file. I'd like to know whether it's possible to decompile it. Thanks.
If someone could give me more idea about ...
2
votes
1
answer
44
views
Type conversion in DM script
all:
I'd like to read a config file in DM script, then use the information in the config file as flags. For example, in the function TagGroup DLGCreateChoice( TagGroup &items, number value ), the ...
2
votes
1
answer
36
views
Alignment of radio buttons in different radio lists
all
I'd like to create two radio lists. Each list has two radio items. But the radio buttons of the second items are not aligned. Here is the code and screen shot. The radio button of dm4 and No are ...
1
vote
1
answer
58
views
Is there a TextMate grammar for DM Script development with Visual Studio?
Over the years, I have been using various versions of Visual Studio as the IDE for my multi-file DM script projects. The code editor in GMS3 makes this less necessary, but VS provides very nice ...
-2
votes
2
answers
73
views
DM shows calibration is invalid when loading EDX line scan CSV by dm scripting
I used one DM script to load line scan profiles to DM, it was useful well with line scan csv profiles from Esprit. But when I tried it with a python based line scan CSV file, it always shows some ...
1
vote
1
answer
52
views
tab sequence of DM script UI
I built a UI in DM. The "Tab" key can go through the fields in sequence. The tab sequence is reversed when the same program runs in GMS 1.x and GMS 3.x. Example code is like this,
Class UI:...
1
vote
1
answer
43
views
DM-script fast 3D offset
Trying to implement offset function for 3D data. This is a test code,
image ThreeDOffSet(image img3D, number shiftx, number shiftY) {
image img3DTmp, rst
img3DTmp:=img3D.ImageClone()
...
2
votes
2
answers
74
views
dm-script adjust image display content
Drag a corner of an image in DM triggers the image content refreshed to the new window size. What is the DM script command to trigger that refreshing?
Specifically, I want to add a text below the ...
1
vote
1
answer
54
views
dm-script commands of dark field tilt
On FEI machine, dark field tilts are done by changing "beam LX", "beam LY", "beam UX", "beam UY" defelectors. Are there commands to access this tilt?
I tested ...
1
vote
1
answer
37
views
How to interpret value returned by ComponentGetFontAttributes?
The title is the whole question. It seems the value returned is always an 8-bit integer. What does each bit represent?
0
votes
1
answer
46
views
Calculate total counts/intensity of different ROIs by DM
Try to calculate the total counts/intensity of different ROIs by DM, but, weirdly, it keeps giving the counts of the left 1st ROI., and I tracked the second ROI by the result. It looks like it gave ...