英文:
Digital Micrograph - Callback to return a custom image on CameraAcquire() method
问题
我正在使用Digital Micrograph进行一些自动化测试,我想在获取图像时从特定文件夹返回自定义图像。我在文档中找不到明确的事件。有办法向CameraAcquire方法添加回调吗?
例如,如果我运行此代码:
number camID = CameraGetActiveCameraID()
image img1
CameraPrepareForAcquire(camID)
img1 := CameraAcquire(camID)
ShowImage(img1)
img1 将被设置为我的自定义图像,而不是CameraAcquire(camID)通常返回的图像。
英文:
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
答案1
得分: 0
如果我理解您的问题正确,我认为您可以在自动化测试脚本中使用OpenImage函数来替代CameraAcquire。您可以在DM的在线帮助中找到有关此函数的详细信息(通过“帮助”>“搜索”菜单命令访问)。OpenImage函数只接受一个参数,即包含自定义图像文件路径的字符串。如果您希望脚本提示您定位并选择自定义图像文件(而不是硬编码其文件路径),您可以使用OpenDialog函数。有关其用法的示例在在线帮助的“脚本”>“示例脚本”>“文件”部分中提供。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论