【问题标题】:The code to set/change the slice label for a line plot in DM script在 DM 脚本中设置/更改线图的切片标签的代码
【发布时间】:2019-09-10 04:29:37
【问题描述】:

尝试在 DM 脚本中找到具有设置/更改线图切片标签功能的代码,但找不到。

我的意思是代码可以在带有 DM 脚本的线图中将标签“切片 1”更改为“年龄”。

【问题讨论】:

    标签: dm-script


    【解决方案1】:

    您搜索的命令是ImageDisplaySetSliceLabelByID,使用示例如下:

    image img := RealImage("Slice Demo",4,100,3)
    img.ShowImage()
    img = icol*(irow+random())
    imageDisplay disp = img.ImageGetImageDisplay(0)
    disp.ImageDisplayChangeDisplayType(3)
    disp.LinePlotImageDisplaySetLegendShown(1)
    
    OKDialog("Now rename slices")
    number nSlices = disp.LinePlotImageDisplayCountSlices()
    for( number i=0; i<nSlices; i++ )
    {
        object id = disp.ImageDisplayGetSliceIDByIndex( i )
        disp.ImageDisplaySetSliceLabelByID( id, "entry #"+(i+1) )
    }
    

    F1 帮助中关于 Lineplot-displays 的示例部分通常是这些内容的良好起点:

    【讨论】:

    • 我尝试使用“object id = disp.ImageDisplaySetSliceLabelByID(id, “xxx”),弹出“unable to match this argument list to any existing function”。这是因为我的 DMv 版本是 3.01
    • 对我的DM来说,没有“DataDisplay”的示例脚本,第一个是简单的图像计算,然后是Tags、TagGroup和TagLists。不确定是不是因为离线版本?
    • @together 不,离线版本与它无关。 GMS 3.01 ??这是一个非常奇怪的版本。我肯定会建议您更新到当前的最新版本(3.3),但在 GMS 3.0.1 中可能有一个(它是 GMS 3 的第一个版本,仅在很短的时间内可用。)
    • @together 重读您的评论。您使用过“对象 id = disp.ImageDisplaySetSliceLabelByID(id, “xxx”)”?您不能将“id”用作参数并同时将其作为对象返回。您是否复制并粘贴了我的示例并运行它?
    • @together 太好了。那么您能否也将答案标记为已接受? (有什么不同?版本更新还是代码更改?)
    猜你喜欢
    • 1970-01-01
    • 2017-06-19
    • 2022-01-11
    • 1970-01-01
    • 1970-01-01
    • 2011-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多