Search code examples
eventscallbackdm-script

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 there a way to add a callback to CameraAcquire method?

For example, if I run this:

number camID = CameraGetActiveCameraID()
image img1
CameraPrepareForAcquire(camID)
img1 := CameraAcquire(camID)
ShowImage(img1)

The img1 would be set to my custom image, instead of what CameraAcquire(camID) would normally return.

Thanks


Solution

  • If I understand your question correctly, I believe you can use the OpenImage function in place of CameraAcquire in your automation test script. You can find details about this function in the Scripting > File Input and Output section of DM's on-line help (accessed via the Help > Search menu command). OpenImage takes only one argument, a string containing the file path to your custom image. If you want your script to prompt you to locate and select the custom image file (instead of hard-coding its file path), you can use the OpenDialog function. An example of its usage is given in the Scripting > Example Scripts > Files section of the on-line help.