【发布时间】:2014-03-24 23:43:28
【问题描述】:
您好,我在 ILArray
【问题讨论】:
标签: c# .net plot 2d ilnumerics
您好,我在 ILArray
【问题讨论】:
标签: c# .net plot 2d ilnumerics
图像数据目前最好(最简单)通过使用 ILSurface 进行可视化。由于这是 3D 图,因此您可能无法获得大型图像数据的最佳性能。幸运的是,ILNumerics 的场景图可以通过您自己的实现轻松改进这一点。
最简单的尝试是采用 ILPoints 形状,在网格中排列所需数量的点,并让每个点可视化输入矩阵中相应元素的值 - 比如说颜色(或大小)。
private void ilPanel1_Load(object sender, EventArgs e) {
using (ILScope.Enter()) {
// some 'input matrix'
ILArray<float> Z = ILSpecialData.sincf(40, 50);
// do some reordering: prepare vertices
ILArray<float> Y = 1, X = ILMath.meshgrid(
ILMath.vec<float>(1, Z.S[1]),
ILMath.vec<float>(1,Z.S[0]),
Y);
// reallocate the vertex positions matrix
ILArray<float> pos = ILMath.zeros<float>(3, X.S.NumberOfElements);
// fill in values
pos["0;:"] = X[":"];
pos["1;:"] = Y[":"];
pos["2;:"] = Z[":"];
// colormap used to map the values to colors
ILColormap cmap = new ILColormap(Colormaps.Hot);
// setup the scene
ilPanel1.Scene.Add(new ILPlotCube {
new ILPoints() {
Positions = pos,
Colors = cmap.Map(Z).T,
Color = null
}
});
}
}
显然,生成的点不会随表格缩放。因此,当表格尺寸增加时,“图像”的点之间的间隙会更大。因此,为了更好地实现,您可以调整使用ILTriangles 而不是ILPoints 的方法,以便组装相邻的矩形。
【讨论】: