如何 export/convert 线投影到 excel table 并排序 Y 坐标

How to export/convert line projection to excel table and order the Y coornidate

我写了一个代码可以得到图像的线投影(强度分布),我想convert/export这个线投影(强度分布)到excel table , 然后对所有的 Y 坐标进行排序。例如,除了所有Y坐标的最大值和最小值,我想知道最大的5个坐标值和最小的坐标值。 有没有代码可以达到这个功能?谢谢,

image line_projection
Realimage imgexmp
imgexmp := GetFrontImage()
number samples = 256, xscale, yscale, xsize, ysize
GetSize( imgexmp, xsize, ysize )
line_projection := CreateFloatImage( "line projection", Xsize, 1 )
line_projection = 0
line_projection[icol,0] += imgexmp
line_projection /= samples
ShowImage( line_projection )

这是一个非编码答案:

如果您在 DigitalMicrograph 中有线图显示,您只需将其复制粘贴到Excel中即可得到数字。

i.e. with the LinePlot image front most, preses CTRL + C to copy
(make sure there are no ROIs on it).
Switch to Excel and press CTRL + V.
Done.
==>

查找 'sorted' 值列表

如果您需要对大量值列表(即大图像)进行排序,以下内容可能还不够。但是,如果您的目标是用相对较少的 X 获得 "x highest" 值,那么下面的代码就可以了:

number nFind = 10
image test := GetFrontImage().ImageClone()
Result( "\n\n" + nFind + " highest values:\n" )
number x,y,v
For( number i=0; i<nFind; i++ )
{
    v = max(test,x,y)
    Result( "\t" + v + " at " + x + "\n" )
    test[x,y] = - Infinity()
}

使用副本,随后 "removing" 通过更改像素值来获得最大值。 max 命令很快 - 即使对于大图像 - 但 for-loop 迭代和单个像素的设置很慢。因此,如果数据很大,此脚本对于完整的 'sorting' 数据来说太慢了,但它可以快速为您提供 n 'highest' 个值。