我主要使用数字显微镜 (DM) 脚本进行电子显微镜图像处理,最近开始学习 Python,因为它具有更广泛的多功能性、丰富的开放库和跨平台能力。
有人知道 Python(numpy)中是否有类似的工具来索引 2D(图像)或 3D(光谱图像)数组,类似于 DM 的 i 变量?
i 变量在本教程的第 11 页上简要介绍了 DM 脚本: http: //portal.tugraz.at/portal/page/portal/Files/felmi/images/DM-Script/DM-basic-scripting_bs。 pdf
它们是索引任何类似图像的 2D 或 3D 对象的简单方法,这对于图像处理非常方便,例如,生成掩码函数
例如,以下 DM 脚本
image t1 := RealImage ("test1", 4, 5, 5)
image t2 := RealImage ("test2", 4, 5, 5)
image t3 := RealImage ("test3", 4, 5, 5)
t1 = irow
// the value in each pixel equals to the row index
t2 = iradius
// the value in each pixel equals to the radius
// (i.e., distance to the center pixel)
t3 = itheta
// the value in each pixel quals to the angle (radian)
// to the center pixel (i.e., angle in polar representation)
t1.showimage(); t2.showimage(); t3.showimage()
产生以下图像(此处以电子表格或矩阵形式表示):
t1 =
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
t2=
3.5355339 2.9154758 2.5495098 2.5495098 2.9154758
2.9154758 2.1213202 1.5811388 1.5811388 2.1213202
2.5495098 1.5811388 0.70710677 0.70710677 1.5811388
2.5495098 1.5811388 0.70710677 0.70710677 1.5811388
2.9154758 2.1213202 1.5811388 1.5811388 2.1213202
t3=
-2.3561945 -2.1112158 -1.7681919 -1.3734008 -1.0303768
-2.6011732 -2.3561945 -1.8925469 -1.2490457 -0.78539819
-2.9441972 -2.8198421 -2.3561945 -0.78539819 -0.32175055
2.9441972 2.8198421 2.3561945 0.78539819 0.32175055
2.6011732 2.3561945 1.8925469 1.2490457 0.78539819