add / apply custom databar to image in DigitalMicr

2019-08-14 08:07发布

问题:

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:

  1. Right click on the image
  2. Hover on layout (in context menu)
  3. Left click "Add Databar"
  4. Select the custom databar in dialog that pops up (the one I want is called "CheckDataBar")
  5. 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?

回答1:

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.



标签: dm-script