0

我正在使用 teem 库将带有浮点结构点的 ASCII .vtk 文件转换为 nrrd。输出的文件似乎是一个原始的 NRRD0001,我已经能够在 paraview 中正确加载它,所以它似乎没问题。当我在 XTK 中加载该文件时,我没有错误消息,但没有显示任何内容。

我还尝试通过 unu 将其转换为 gzipped 编码,但没有成功:

teem-unu save -f "nrrd" -e "gzip" -i "./inputfile.vtk" -o "./outputfile.nrrd"

我注意到 XTK 工作 nrrd 文件的类型为 NRRD0004。

我可以用这种格式保存它吗?如何将其保存为 0004?

提前致谢,

安德烈亚


这是我的转换简单程序:

#include <teem/nrrd.h>

Nrrd *nrrd = nrrdNew();
if (nrrdLoad(nrrd, argv[1], NULL)==0 && nrrdSave(argv[2], nrrd, NULL)==0)
       printf("success\n");

VTK 文件标题:

# vtk DataFile Version 2.0
Image Builder vtk output
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 30 20 20
SPACING 10.266666 8.000000 11.900000
ORIGIN -154.000000 -176.470001 -119.000000
POINT_DATA 12000
SCALARS volume_scalars float 1
LOOKUP_TABLE default

转换后的 NRRD 文件输出:

NRRD0001
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
content: Image Builder vtk output
type: float
dimension: 3
sizes: 30 20 20
spacings: 10.266666 8 11.9
axis mins: -154 -176.470001 -119
endian: little
encoding: raw

可视化脚本与http://lessons.goxtk.com/11/相同

var r = new X.renderer('r');
    r.init();

    volume = new X.volume();
    volume.load('pocas.nrrd');             
    r.add(volume);        
    r.camera().setPosition(120,80,160);
    r.render();
4

3 回答 3

0

这可能还不受支持(.vtk 文件)。

您能否提供您想要完成的屏幕截图,以便我们了解您想要做什么..

于 2012-05-06T14:59:52.507 回答
0

刚刚通过谷歌找到了这个。我写了 unu 和 nrrd。如果 XTK 无法有效地加载文件,则它是 XTK 如何处理 nrrd 格式的属性,而不是您的文件。

只是想我会指出,对于 unu,您不必引用每个字符串 - 只需引用那些包含空格的字符串。

 unu save -f nrrd -e gzip -i ./inputfile.vtk -o ./outputfile.nrrd

也可以。

于 2012-06-19T04:55:35.220 回答
0

当我尝试将 dicom 文件转换为 nrrd 文件时,我遇到了同样的问题。我注意到 unu make 命令中的帮助比 unu make 网页帮助更详细。就我而言,我使用了以下 unu 命令:

./unu make -i CT/patient_%03d.dcm 1 369 1 -e raw -bs -1 -en little -t short 
-s 369 369 369 -dirs "(0.4,0,0) (0,0.4,0) (0,0,0.4)" -spc LPS -o CT.nrrd

在这种情况下,将 nrrd 文件生成为 0004 的关键是使用 -dirs 和 -spc 选项。我希望这对你有帮助!

来自联合国大学的帮助:

-dirs <v0 v1 ...> , --directions <v0 v1 ...> = (NOTE: must quote whole
                 vector list) The "space directions": the vectors in space
                 spanned by incrementing (by one) each axis index (the
                 column vectors of the index-to-world matrix transform),
                 OR, "none" for non-spatial axes. Give one vector per
                 axis. (Quoting around whole vector list, not
                 individually, is needed because of limitations in the
                 parser) (string)

  -spc <space> , --space <space> = identify the space (e.g. "RAS", "LPS")
                 in which the array conceptually lives, from the nrrdSpace
                 airEnum, which in turn determines the dimension of the
                 space. Or, use an integer to give the dimension of a
                 space that nrrdSpace doesn't know about By default (not
                 using this option), the enclosing space is set as
                 unknown. (string)

问候,

于 2012-05-08T17:57:28.370 回答