更新itk图像在Qt用户界面
Updating itk image in Qt user interface
我有一个问题,我想告诉你,因为有几天我没有新的想法。
我有一个双*指针指向的图像,我想把它转换成itk::smartpointer来更新用户图形界面,为此我做了这个方法:
void prueba_r01::double2itk( double *im_proc, ImageType::Pointer *salida, int alto, int ancho)
// This method translate the double* image into itk:smartpointer image
ImageType::IndexType pixelIndex; // pixelIndex[0]= index x-axis; pixelIndex[1] = index y-axisy
ImageType::PixelType pixelValue;
ImageType::PixelType aux; //auxiliar variable for checking the behaviour of the programm
// Doing a sweep of all the image (is in double *im_proc) translating the values into itk pointer format
for (int x=0; x<ancho; x++){ // ancho: widht of the image
pixelIndex[0]=x;//x position
for (int y=0; y<alto; y++){ // alto: height of the image
pixelIndex[1]=y;//y position
pixelValue= *(im_proc+x+ancho*y);
(*salida)->SetPixel(pixelIndex,pixelValue);
aux = (*salida)->GetPixel(pixelIndex); // checking that the image has been correctly transtaled from im_proc to salida-- > CHECKED
}
}
}
then在这里被调用:
//Translation of the double* image into itk:smartpointer image
double2itk(out_inv, &(ui.imageframe->imagereader), alto, ancho);
之后,用户界面更新:
// Update of the image shonw in the user interface
ui.imageframe->update();
问题是,似乎一切都在正常工作,但在界面中的图像没有更新。另一个选项也对我的项目有效,可以将图像存储在' .bmp '或' .jpeg '文件中。有人能帮帮我吗?知道是什么出了问题吗?是否有创建这个图像文件的函数?
ITK具有内置机制,具有相当大的安全优势。此外:它们可以像任何图像源一样在管道中使用,并且因为它们使用您现有的数组,它们将比循环索引快得多(我认为)。
http://www.itk.org/Doxygen/html/classitk_1_1ImportImageFilter.html http://www.itk.org/Doxygen/html/classitk_1_1ImportImageContainer.html http://www.itk.org/Wiki/ITK/Examples/IO/ImportImageFilter您必须使用importtimagecontainer,并且在设置内存管理选项时要非常小心。
默认情况下,ITK将在自己之后进行清理,并期望能够删除外部指针指向的内存。
用户指南中有这样的例子。
还有一个很好的wiki示例:http://www.vtk.org/Wiki/ITK/Examples/IO/ImportImageFilter
相关文章:
- Qt5 用户界面编译器:-i 选项不可用
- QMenuBar 不使用原生样式? c++ , QTDesigner.用户界面
- 如何将C 中的后端写入与TCL/TCK用户界面连接
- 是否可以通过图形用户界面 (GUI) 与 Linux 命令行界面 (CLI) 进行交互
- 拥有用于QT应用程序的Web用户界面的最佳方法
- 面向海思处理器的用户界面SDK
- 如何在C++中使用我自己的库创建用户界面
- 使用 C++ 进行用户界面设计
- Qt用户可自定义的热键
- QT 图形用户界面进度条
- 用户界面在 qt 应用程序中未更新
- 带有 c++ 的图形用户界面.当我使用按钮时滞后
- Leap Motion C++的用户界面
- C++图形用户界面和控制台应用程序
- 在C++中实现一个基于文本命令的用户界面
- 向图像查看器插件添加用户界面
- 带有用户界面编译器的Qt动态样式表
- 使用两个用户界面- Qt 5.5
- 更新itk图像在Qt用户界面
- 在主机应用程序中使用Qt用户界面