例如,在下面所示的图像中,左侧是(位蒙版)图像,我想创建一个封闭的ROI,其顶点连接虚拟光圈的轮廓,该轮廓在右侧(用手绘制,形状并不精确)。当然,ROI可以在现有图像或新图像上。
这在使用脚本的虚拟光圈到4D-STEM数据集的应用程序中有关需要将一个掩盖的图像(例如虚拟光圈,只有零和一个)转换为ROI,然后应用Si-Map功能,以加快计算和自动化(我在这里之前提出的另一个问题一个>,在这里得到部分答案)。
我想知道如何使用脚本进行操作?任何提示都对此表示赞赏!
For example in the image shown below, the left side is the (bit masked) image, and I want to create a closed ROI with their vertex connecting the contour of the virtual aperture, shown on the right side (which is drawn by hand, not precise to the shape). Of course the ROI can be on the existing image or on a new image.

This is related in an application to virtual aperture to 4D-STEM datasets using scripts, I need to convert a bit masked image (like a virtual aperture, having only zeros and ones) to an ROI, and then apply the SI-Map function so to speed up the calculation and automation (the other question I raised here some time ago, and a partial answer here).
I'm wondering how to do this with a script? Any hints are appreciated!
发布评论
评论(1)
没有将任意掩码转换为ROI的命令或简单方法。
这部分是如此,因为ROI定义为一组顶点。
为了进行转换,首先必须从二进制掩码中创建“大纲”掩码,然后获取所有轮廓点的XY坐标,然后具有算法来对这些点进行分类,以便它们形成A(闭环。
然后,可以创建ROI并将点添加为顶点。都是可行的,但不平凡。
但是我想知道为什么要竭尽全力?
如果主要用例是使用ROI限制SI中的某些数据,则必须将ROI转换回一个或另一个点的二进制掩码。那么,为什么不首先使用口罩呢?
如果这只是掩码可视化的问题,那么我建议使用用于任务的注释:覆盖注释。
编辑:GMS的较旧版本不支持这种类型的注释。在这种情况下,可以创建一个RGB混合图像以显示。
There is no command or simple way to convert an arbitrary mask into a ROI.
This is partly so, because a ROI is defined as a set of vertices.
In order to do the conversion, one would first have to create the "outline" mask from the binary mask, then get the XY coordinates of all of the outline points, and then have an algorithm to sort these points so that they form a (closed) loop.
Then, one could create a ROI and add the points as vertices. All doable, but non-trivial.
But I'm wondering why one would even go to that length?
If the primary use-case is to use the ROI to limit some data in the SI, then one will have to convert the ROI back into a binary mask at one or another point. So why not just use the mask in the first place?
If it is just a question of visualization of the mask, then I would recommend using the annotation that is meant for the task: the overlay annotation.

Edit: Older versions of GMS do not support this type of annotation. In this case, one could instead create a RGB mix image for display.