Foros del Web » Programación para mayores de 30 ;) » C/C++ »

Problem with updating itk image in Qt user interface

Estas en el tema de Problem with updating itk image in Qt user interface en el foro de C/C++ en Foros del Web. Hello !! I have a problem that I would like to tell you because is about some days that I don’t have new ideas. Thanks ...
  #1 (permalink)  
Antiguo 12/09/2011, 06:45
 
Fecha de Ingreso: julio-2011
Mensajes: 7
Antigüedad: 12 años, 9 meses
Puntos: 0
Problem with updating itk image in Qt user interface

Hello !!

I have a problem that I would like to tell you because is about some days that I don’t have new ideas. Thanks in advanced 

I have an image pointed with a double* pointer, and I want to translate it into itk::smartpointer for updating the user graphic interface, for this purpose I made this method :

Código:
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
		}

	}
}
And then is called here:
Código:
//Translation of the double* image into itk:smartpointer image
	double2itk(out_inv, &(ui.imageframe->imagereader), alto, ancho);
And after that, the user interface is updated:

Código:
// Update of the image shonw in the user interface
	ui.imageframe->update();
The problem is that it seems that everything is working correctly, but the image in the interface is not updated.
Another option also valid for my project could be to stored the image in a ‘.bmp’ or ‘.jpeg’ file.

Could someone help me? Any ideas of what is not working properly? Is there any function for creating this image files?

Thanks so much!!

Cheers

Antonio
  #2 (permalink)  
Antiguo 12/09/2011, 07:59
Avatar de Eternal Idol  
Fecha de Ingreso: mayo-2004
Ubicación: Lucentum
Mensajes: 6.192
Antigüedad: 19 años, 11 meses
Puntos: 74
Respuesta: Problem with updating itk image in Qt user interface

¿Es un chiste o que?
__________________
¡Peron cumple, Evita dignifica! VIVA PERON CARAJO
  #3 (permalink)  
Antiguo 12/09/2011, 08:44
 
Fecha de Ingreso: julio-2011
Mensajes: 7
Antigüedad: 12 años, 9 meses
Puntos: 0
Respuesta: Problem with updating itk image in Qt user interface

Cita:
Iniciado por Eternal Idol Ver Mensaje
¿Es un chiste o que?

No, es un problema real, con algún fallo muy estúpido probablemente pero que no soy capaz de ver ...si me puedes ayudar te estaría muy agradecido!
  #4 (permalink)  
Antiguo 12/09/2011, 10:04
Avatar de Eternal Idol  
Fecha de Ingreso: mayo-2004
Ubicación: Lucentum
Mensajes: 6.192
Antigüedad: 19 años, 11 meses
Puntos: 74
Respuesta: Problem with updating itk image in Qt user interface

No me referia a eso, este no es un foro angloparlante.

En cuanto al problema: depuralo.
__________________
¡Peron cumple, Evita dignifica! VIVA PERON CARAJO
  #5 (permalink)  
Antiguo 13/09/2011, 03:22
 
Fecha de Ingreso: julio-2011
Mensajes: 7
Antigüedad: 12 años, 9 meses
Puntos: 0
Respuesta: Problem with updating itk image in Qt user interface

Pido disculpas, no me había dado cuenta, aquí está el problema traducido;

Tengo una imagen apuntada con un puntero double*, y quiero "traducirla" a un itk::smartppointer para poder actualizar la interfaz gráfica ( hecha en Qt), para ello creo este método :


Código:
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
		}

	}
}
Este método es llamado en esta linea:

Código:
//Translation of the double* image into itk:smartpointer image
	double2itk(out_inv, &(ui.imageframe->imagereader), alto, ancho);
Después de eso, la interfaz gráfica es actualizada :
Código:
// Update of the image shonw in the user interface
	ui.imageframe->update();
Todo parece funcionar correctamente pero la imagen en la interfaz gráfica no se actualiza.

Otra solución válida para mi proyecto sería guardar la imagen en un formato '.bmp' o 'jpeg'. Alguién sabe algún proceso para esto?

Gracias!
  #6 (permalink)  
Antiguo 13/09/2011, 03:26
 
Fecha de Ingreso: julio-2011
Mensajes: 7
Antigüedad: 12 años, 9 meses
Puntos: 0
Respuesta: Problem with updating itk image in Qt user interface

Cita:
Iniciado por Eternal Idol Ver Mensaje
No me referia a eso, este no es un foro angloparlante.

En cuanto al problema: depuralo.

El problema llevo días depurandolo, ya he comprobado que los valores de los pixeles de la imagen son correctos y se escriben en '*salida', esto lo he comprobado en estas tres lineas del método principal que posteo:

Código:
			pixelValue= *(im_proc+x+ancho*y);
			(*salida)->SetPixel(pixelIndex,pixelValue);
			aux = (*salida)->GetPixel(pixelIndex); //
el valor de la imagen inicialmente está en el puntero double* 'im_proc', y lo guardo en 'pixelValue', despues de esto fijo los valores de los pixeles en el formato de la imagen que quiero en 'salida*', por ello la última linea es para ver si con el método correspondiente el valor que he fijado en la imagen es el correcto ( es decir, el mismo que en Pixelvalue) y así es....

Etiquetas: c++, gui, itk, qt4
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:42.