简体   繁体   English

如何使用vtk和itk创建可变尺寸的图像查看器

[英]How to create variable dimension image viewer with vtk and itk

I want to create image viewer with itk and vtk.But I have to define image dimension like 2D 3D.I don't want to do it.All I want is that when I read the image from harddisk ,program detect th dimension of image by itself.In other words, my program may read both 2D and 3D images and it gives me what the dimension is. 我想用itk和vtk创建图像查看器。但是我必须定义2D 3D之类的图像尺寸。我不想这样做。我想要的就是,当我从硬盘读取图像时,程序会检测图像的尺寸换句话说,我的程序可以读取2D和3D图像,并且可以显示尺寸。 What are your suggestions about it ? 您对此有何建议?

When you read an image in itk, you have to specify with the template the type of pixel and the dimension, example : typedef itk::Image ImageType; 在itk中读取图像时,必须使用模板指定像素类型和尺寸,例如:typedef itk :: Image ImageType; You cannot use a fitall dimension or reader. 您不能使用fitall尺寸或阅读器。 You should declare the image and reader for both 2D and 3D. 您应该声明2D和3D的图像和阅读器。 It is not a "clean" solution but you could do a "try" on both and take the working one. 这不是一个“干净”的解决方案,但是您可以对两者都进行“尝试”并采用可行的解决方案。

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

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