简体   繁体   English

NII 文件体素数据排序

[英]NII Files Voxel Data Ordering

I have a .nii file with the following meta data我有一个包含以下元数据的.nii文件

NII Header Size:               348
NII Magic Number:              n+1
Dimension Information:
       Frequency Dimension:    0
       Phase Dimension:        0
       Slice Dimension:        0
Number of Image Dimensions:    3
        Spatial Dimension X has length:         91
        Spatial Dimension Y has length:         109
        Spatial Dimension Z has length:         91
Intent Code:                   0
Data Type:                     FLOAT
Number of bits per Voxel:      32
Description:                   6.0.5:9e026117
Voxel Dimensions:
        Voxel Dimension X has length:         2.000000
        Voxel Dimension Y has length:         2.000000
        Voxel Dimension Z has length:         2.000000
Image data begins at byte:     352
Data Scaling:
        Slope:                 1.000000
        Y-Intercept:           0.000000
Color Range:
        Min:                   0.020708
        Max:                   9.358182
Slicing Information:
        Slice Start:            0
        Slice End:              0
        Slice Duration:         0.000000
        Slice Code:             0
Measurement Units:
       Spatial Dimension:      MILLIMETER
       Temporal Dimension:     SECOND
Auxiliary File:                render1t
Q Form Code:                   4
       b:                      0.000000
       c:                      1.000000
       d:                      0.000000
       x offset:               90.000000
       y offset:               -126.000000
       z offset:               -72.000000
S Form Code:                   4
Affine Matrix:
-2.000000      0.000000      0.000000      90.000000
0.000000      2.000000      0.000000      -126.000000
0.000000      0.000000      2.000000      -72.000000
0.000000      0.000000      0.000000      1.000000
Total number of voxels:        902629

How do I know how to read the image data?我怎么知道如何读取图像数据? I know it is an array of floats, but for each index in that array how do I translate it to a ijk voxel coordinate?我知道它是一个浮点数组,但是对于该数组中的每个索引,如何将其转换为ijk体素坐标? I'm really looking for what's the correct function to use that translates each float index in the .nii file to an appropriate ijk voxel coordinate.我真的在寻找将 .nii 文件中的每个浮点索引转换为适当的ijk体素坐标的正确函数。

I've been looking at this: https://brainder.org/2012/09/23/the-nifti-file-format/ , but either it was never mentioned, or I'm not understanding something.我一直在看这个: https://brainder.org/2012/09/23/the-nifti-file-format/ ,但要么从未提及,要么我不明白。

From a comment by AM Winkler on the page you linked:来自 AM Winkler 在您链接的页面上的评论:

The storage is RAS, ie, the the first dimension to be filled (ie, that runs faster), is “x”, from left to right, then “y” from posterior to anterior, then “z”, from inferior to superior.存储是RAS,即要填充的第一个维度(即运行速度更快),是“x”,从左到右,然后是“y”,从后到前,然后是“z”,从下到上. Of course these directions may not correspond to the actual brain orientation (if this is at all a brain), but once read, you adjust the orientation using one of the 3 orientation methods from the header, as described above.当然,这些方向可能与实际的大脑方向不对应(如果这完全是大脑),但是一旦读取,您可以使用标题中的 3 种方向方法之一调整方向,如上所述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM