Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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.

    BmyGuest knows what they are talking about. This was exactly what I needed. Thanks! @BmyGuest – casewolf Jun 13, 2018 at 12:02

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.