DEC VAX 与 IA-32 的字节顺序
问题的描述如下。如果您不感兴趣,可以跳到最后一行。
我正在使用
人体头部的 109 切片 MRI 数据集。完整的切片连续存储为 256 x 256 数组。像素由 2 个连续字节组成,构成一个二进制整数。数据在西门子 Magnetom 上采集,由新泽西州艾斯林的西门子医疗系统公司提供。
进而:
数据集是在数字设备公司 (DEC) VAX 计算机上写入的。每个文件仅包含像素,以行主顺序存储,每个像素 2 字节整数。要在具有正常字节顺序(DEC 使用反向字节顺序)的计算机上使用图像,您应该交换备用字节,例如在 UNIX 中使用“dd”命令。对 3dknee 数据集执行此操作的示例命令是:
% dd if=3dknee of=3dknee.new conv=swab
我不知道实际值是什么,所以我不能仅通过查看字节顺序是否正确来判断。
底线
DEC VAX 的字节顺序与 IA-32 中的字节顺序相同还是相反?
A description of the problem follows. You can skip to the bottom line if you're not interested.
I am working with a data file with this description:
A 109-slice MRI data set of a human head. Complete slices are stored consecutively as a 256 x 256 array. Pixels consist of 2 consecutive bytes making one binary integer. Data taken on the Siemens Magnetom and provided courtesy of Siemens Medical Systems, Inc., Iselin, NJ.
and then:
The data sets were written on a Digital Equipment Corporation (DEC) VAX computer. Each file contains only pixels, stored in row major order with 2-byte integers per pixel. To use the images on machines that have normal byte order (DECs use reverse byte order), you should swap alternate bytes, for example using the 'dd' command in UNIX. A sample command that does this for the 3dknee data set is:
% dd if=3dknee of=3dknee.new conv=swab
I don't know what the real values are, so I can't judge just by looking if the byte order is correct.
The Bottom line
Is the byte order of a DEC VAX the same as in IA-32, or reversed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据此页面和此页面,VAX 和 x86 都使用小端字节顺序。所以不需要转换。
According to this page and this page, the VAX and x86 both use little-endian byte order. So no conversion should be needed.