[Insight-users] Show a ITK Image data in Qt

Luis Ibanez luis . ibanez at kitware . com
Wed, 10 Dec 2003 16:25:07 -0500


Hi Chuyang,


When you say "unclear" do you mean "blurred" (smoothed) ?
or do you mean "dark"  ?

can you post a screenshot of the GUI somewhere in the web ?

Thanks,


   Luis



-----------
jiang wrote:

> Dear ITK users,
> I read a series of DICOM file to build a volume and show three slice view in
> different direction. I use Qt as user interface. And I adapt the
> ApplicationModel as Luis recommended
> http://public . kitware . com/pipermail/insight-users/2003-September/005094 . html
> It works fine. Now I want to display one slice of the volume in another
> QFrame. I extract one slice from volume by itk::ExtractImageFilter. And use
> itk::ImageRegionIterator to access the image and copy data to QImage as
> below:
> 	it(DesiredPiece,DesiredPiece->GetBufferedRegion());
> 	it.GoToBegin();
> 	for (unsigned int i=0;i<Size[0];i++)
> 	{
> 	  for (unsigned int j=0;j<Size[1];j++)
> 	  {
> 		image ->setPixel(j,i,it.Get());
> 		it++;
> 	  }
> 	}
> 
> Then show the QImage in the following code:
> Julien gave me some hints about how to do it in
> http://www . itk . org/pipermail/insight-users/2003-August/004568 . html
> 	if(image->isNull())
> 		image->create(size[0],size[1],8,2000 );
> 
> 	for (unsigned int i=0;i<256;i++)
> 	{
> 	  QColor* rgb = new QColor(i,i,i);
> 	  image ->setColor(i,rgb->rgb());
> 	}
> 
> 	ProcessImage.CopyDesiredPiece(image);//It is the above copy function
> 	bool ok;
> 	ok=	pm.convertFromImage(*image, Qt::PreferDither );
> 
> Then use QLabel to show pm:
> label->setPixmap(pm );
> 
> 
> My problem is: the image which is showed in the QFrame is not same as the
> slice shown in slice view as ApplicationModel does. In the slice view the
> image is very clear. But in the QFrame the same image data, but it is very
> unclear. I consider that it might be the parameters of window width and
> window center of image data. The data type is signed short.
> How can I show the image in the QFrame same as it is shown in the slice
> view?
> 
> 
> Thank you very much!
> 
> 
> Chunyan
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>