VMTK【1】Getting Started

%date:2016/9/20
%author:lingling不吃鱼

VMTK是直接安装可用的,提前只需要配置python2.7的环境即可,故安装过程不做赘述。
附上官网学习网址:
http://www.vmtk.org/documentation/getting-started.html
不习惯看英文的同学且为刚接触医学软件的新手可以结合这篇博客学习。

第一步:Reading and displaying images

PypePad界面输入:
vmtkimagereader -ifile first_dicom_file_in_the_series.dcm --pipe vmtkimageviewer
其中first_dicom_file_in_the_series.dcm,为DICOM格式文件中的第一个图片名称。
注意:路径地址与图片名称不允许有空格。
vmtk渲染窗口效果图
图片为渲染效果图

打开渲染窗口之后,可以进行如下操作:

Rotate the volume by left-clicking anywhere on the render window.
Translate the volume by middle-clicking anywhere on the render window.
Zoom the volume by right-clicking anywhere on the render window.
Probe the image planes (coordinates and graylevel) by left-clicking on them.
Move the image planes by middle-clicking on them.
Change window-level by right-clicking on image planes.
Quit the viewer by pressing q while the render window has focus.

基本上就是说:鼠标三个键(左中右)以及两个鼠标操作(点击和长按)随意组合能有对应的不同效果。
这个和VTK、MITK交互操作是一致的。

第二步:Image format conversion

格式转换,VMTK对DICOM格式只有读取的功能,没有处理的功能,若需要处理图像,就需要对图像格式进行转换

vmtkimagereader -ifile first_dicom_file_in_the_series.dcm --pipe vmtkimagewriter -ofile image_volume.vti

此行代码的功能是将DICOM序列格式文件转化成名为image_volume的vti格式文件

vmtkimagereader -ifile first_dicom_file_in_the_series.dcm --pipe vmtkimagewriter -f png -ofile image_file_prefix

此行代码的功能是将DICOM序列格式文件转化成名字前缀为image_file_prefix的png格式文件

第三步:File formats

VMTK能处理的文件格式:

图像

dcm (DICOM Image, only Read): Digital Imaging and Communications in Medicine (DICOM) is a standard for handling, storing, printing, and transmitting information in medical imaging. It includes a file format definition and a network communications protocol
mha/mhd (Meta Image): it specifies a standardized way of expressing the meta- information in the header about the pixel data; .mha: header embedded, .mhd+.raw (or other pixel data formats): header in separate file
nrrd (Nearly Raw Raster Data): similar to Meta Image, somewhat richer header
Analyze (Mayo Clinic Analyze 7.5): some issues with handling and reconstructing orientations; superseded by NIfTI; .hdr+.img
NIfTI (Neuroimaging Informatics Technology Initiative): descendant of the Analyze format (can be converted by just changing the header); interoperable with Analyze but orientation and time are treated properly; .hdr+.img or .nii
vti (VTK XML Image Data): the Visualization Toolkit (VTK) format for images; XML syntax with embedded binary data; very flexible; possible to represent multiple scalar/vector/tensor data in the same file; does not support image orientation (although it is possible to include custom data expressing orientation matrices)

表面

vtp (VTK XML): the Visualization Toolkit (VTK) format for surfaces; XML syntax with embedded binary data; PolyData (.vtp) — Serial vtkPolyData (unstructured)
stl (Stereolithography): STL (STereoLithography) is a file format native to the stereolithography CAD software created by 3D Systems. STL is also known as Standard Tessellation Language. STL files describe only the surface geometry of a three dimensional object without any representation of color, texture or other common CAD model attributes. The STL format specifies both ASCII and binary representations. Binary files are more common, since they are more compact
tec (Tecplot): TEC files are used by the TECPLOT program, which is a visualization program for technical data.

网格mesh

vtu (VTK XML): the Visualization Toolkit (VTK) format for meshes; XML syntax with embedded binary data; UnstructuredGrid (.vtu) — Serial vtkUnstructuredGrid (unstructured)
pvtu (VTK XMLP): the Visualization Toolkit (VTK) parallel format for meshes; XML syntax with embedded binary data
xda (libMesh, only Write): libMesh mesh files consist of two sections, the header and the data. The header contains important size information. It defines the number of elements, number of nodes, etc… that are in the mesh. The data section contains the actual element connectivity, the nodal coordinates, and any boundary condition information
msh (Fluent, only Write): Fluent mesh files format
lifev (LifeV): LifeV mesh files format
vtk: the Visualization Toolkit (VTK) format for meshes; ASCII or binary format
gambit: Gambit mesh files format
tec (Tecplot): TEC files are used by the TECPLOT program, which is a visualization program for technical data.
fdneut (FIDAP): Fidap LifeV files format
tetgen: Tetgen mesh files format
ngneut: Netgen neutral file format, which is particularly easy to read with a home-made program
xml (Dolfyn, only Write): XML file for the Dolfyn CFD software

第四步:Volume of interest (VOI) extraction

 vmtkimagereader -f dicom -d dicom_directory_path --pipe
 vmtkimagevoiselector -ofile image_volume_voi.vti

这两行代码的意思应该是读取文件选择感兴趣区域并保存。可惜我没有成功,报错no image.

第五步:Surface extraction using Marching Cubes

marching cubes进行表面提取

vmtkmarchingcubes -ifile image_volume_voi.vti -l 300.0 -ofile mc_surface.vtp --pipe vmtksurfaceviewer

下图是我的示例的效果图:
这里写图片描述

据说,

 vmtkimagereader -ifile image_volume_voi.vti --pipe
 vmtkmarchingcubes -l 300.0 -ofile mc_surface.vtp --pipe
 vmtkrenderer --pipe vmtkimageviewer --pipe vmtksurfaceviewer

可以将表面显示出来,然而我没有成功,依旧报错 no Image.
表面格式可以更改为tec的格式

 vmtkimagereader -ifile image_volume_voi.vti --pipe
 vmtkmarchingcubes -l 300.0 -ofile mc_surface.tec --pipe
 vmtkrenderer --pipe vmtkimageviewer --pipe vmtksurfaceviewer

这步我也没有继续尝试了,深深官网怀疑语句有问题。
vmtk pipe格式的语句是可以简化的,详见 :
http://www.vmtk.org/tutorials/PypesBasic.html

磕磕碰碰总算是成功了一半了,希望大家能够在这里互相学习和讨论。我也是刚入门,没有什么VTK的基础,学起来怕有些问题解决不了的,请大神们路过的时候多多指教。

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值