我有一个问题想告诉你,因为大约有几天我没有新的想法。
我有一个用双 * 指针指向的图像,我想将其转换为 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
}
}
}
然后在这里调用:
//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”文件中。有人可以帮助我吗?关于什么不能正常工作的任何想法?有没有创建这个图像文件的功能?