I have an image that I want to apply a custom databar to via a script in DigitalMicrograph 3.21.1374.0. I would also like to apply a custom layout (separate question here: Apply Custom Layout to Image in DigitalMicrograph GMS3).
The procedure that I currently do by hand is:
- Right click on the image
- Hover on layout (in context menu)
- Left click "Add Databar"
- Select the custom databar in dialog that pops up (the one I want is called "CheckDataBar")
- Click OK
This works flawlessly - except that I would like to run a script to do it (so I can loop all the open images and apply the databar).
Here is the code that I have so far to do just one image:
//main - get front image and apply custom databar
image Img := GetFrontImage()
imageDisplay imgDisplay = Img.ImageGetImageDisplay(0)
ApplyDataBar(imgDisplay)//this only adds the scale bar not the custom databar that i would like
I have tried ApplyDataBar(imgDisplay, CheckDataBar)
but that does not work.
Any ideas?
ApplyDatabar()
is an old command from earlier GMS versions and will only add the scalemarker.
However, this answer to your other question ( applying layouts ) can also be used to apply the databar, provided the databar is part of the layout.
So, you have to create a layout which contains the custom databar first. Then you apply the layout to the imageDocument not the imageDisplay.
来源:https://stackoverflow.com/questions/50819924/add-apply-custom-databar-to-image-in-digitalmicrograph-gms3