Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

SetPicture and Render method problem
Started by anjali at 06-30-2008 9:19. Topic has 11 replies.

Print Search « Previous Thread Next Thread »
  06-30-2008, 9:19
anjali is not online. Last active: 8/29/2008 10:12:14 AM anjali

Top 150 Posts
Joined on 08-04-2006
Posts 17
SetPicture and Render method problem
Reply Quote

Hi, I am using LeadTools 14.5 and VB6

Problem with LeadRasterView1.SetPicture

I am getting the image into PictureBox using Render method

The Code is like this

RasterIO.Load LEADRasterView1.Raster, InputFilename,0, 0, 1

LEADRasterView1.Render Picture1.Hdc, 0, 0, LEADRasterView1.Raster.BitmapWidth, LEADRasterView1.Raster.BitmapHeight

LEADRasterView1.Raster.Bitmap = 0

LEADRasterView1.Raster.SetPicture Picture1

RasterIO.Save LEADRasterView1.Raster, outputfilename , 21, 24, 2, 0

The resulted bitmap  is of only 1X1 pixel in size.

Why it is not giving me the size same as that of original image size


   Report 
  06-30-2008, 10:44
Qasem Lubani is not online. Last active: 9/2/2008 11:31:52 AM Qasem Lubani



Top 10 Posts
Joined on 08-13-2006
Posts 1,044
Re: SetPicture and Render method problem
Reply Quote
I will test your code here and see if I can reproduce the issue. I will get back to you as soon as possible.
Qasem Al-Lubani
LEAD Technical Support
www.leadtools.com
   Report 
  07-01-2008, 8:03
Qasem Lubani is not online. Last active: 9/2/2008 11:31:52 AM Qasem Lubani



Top 10 Posts
Joined on 08-13-2006
Posts 1,044
Re: SetPicture and Render method problem
Reply Quote

I investigated the issue here and here is what I have found.

 

The device context handle (HDC) you are passing to the Render method is for the surface of the control, not the Picture object inside it. To assign to the picture itself, use code like this instead of using Render:

Picture1.Picture = LEADRasterView1.Raster.GetPicture()
Qasem Al-Lubani
LEAD Technical Support
www.leadtools.com
   Report 
  07-01-2008, 9:03
anjali is not online. Last active: 8/29/2008 10:12:14 AM anjali

Top 150 Posts
Joined on 08-04-2006
Posts 17
Re: SetPicture and Render method problem
Reply Quote

Hi,

it is not possible to use GetPicture

Actually I am loading the annotation on LeadRaster and using the Render I am getting the image along with annotation directly (on PctureBox)there is no need to burn the annotation. And after that I will get the resultant image (image+ann) from picture box into the LeadRaster again using SetPicture. Thats why Render is must.

Is there any another way?

 

 


   Report 
  07-02-2008, 8:55
Qasem Lubani is not online. Last active: 9/2/2008 11:31:52 AM Qasem Lubani



Top 10 Posts
Joined on 08-13-2006
Posts 1,044
Re: SetPicture and Render method problem
Reply Quote

If you must use Render, you need to use an HDC that is not 'volatile'. This means if you render to the surface of a control or window, that will be erased when the window gets repainted. One way is to use a LEAD Raster object, create an empty bitmap, and then obtain a non-volatile HDC for that bitmap like this:

 

 

RasterIO.Load LEADRasterView1.Raster, InputFilename, 0, 0, 1

 

Dim ras2 As New LEADRaster

ras2.CreateBitmap LEADRasterView1.Raster.BitmapWidth, LEADRasterView1.Raster.BitmapHeight, 24

Dim hDC

hDC = ras2.GetBitmapDC

LEADRasterView1.Render hDC, 0, 0, LEADRasterView1.Raster.BitmapWidth, LEADRasterView1.Raster.BitmapHeight

ras2.ReleaseBitmapDC

LEADRasterView1.Raster.Bitmap = 0

MsgBox "no bitmap"

LEADRasterView1.Raster.Bitmap = ras2.Bitmap
Qasem Al-Lubani
LEAD Technical Support
www.leadtools.com
   Report 
  07-03-2008, 4:10
anjali is not online. Last active: 8/29/2008 10:12:14 AM anjali

Top 150 Posts
Joined on 08-04-2006
Posts 17
Re: SetPicture and Render method problem
Reply Quote

It 's working .

Thank you.

 


   Report 
  07-05-2008, 9:19
anjali is not online. Last active: 8/29/2008 10:12:14 AM anjali

Top 150 Posts
Joined on 08-04-2006
Posts 17
Re: SetPicture and Render method problem
Reply Quote

According to your suggestion,I am getting the bitmap.

After getting this resultant bitmap I want to insert this bitmap into Dicomds

Dicomds.Bitmap=LeadRasterview1.Raster.Bitmap

and after that call

SetBitmapValue function with all parameters with original value .

Dicomds.SetBitmapValue(originalCompression, originalPhotometric,originalBitsperpixel, 2, DICOM_SETIMAGE_AUTO_SET_VOI_LUT)

the image becomes 16 bit and all the image information is changed.

Bitsotred, Highbit LargestImagePixelValue all are changed.

Any sugesstions please?

I am expecting just bimap is replaced with all data unchanged.

 

 


   Report 
  07-06-2008, 7:51
Qasem Lubani is not online. Last active: 9/2/2008 11:31:52 AM Qasem Lubani



Top 10 Posts
Joined on 08-13-2006
Posts 1,044
Re: SetPicture and Render method problem
Reply Quote

What is the value of the LeadRasterview1.Raster.BitmapBits before you insert the bitmap?

What are the values of originalCompression, originalPhotometric and originalBitsperpixel in your code?


Qasem Al-Lubani
LEAD Technical Support
www.leadtools.com
   Report 
  07-07-2008, 1:40
anjali is not online. Last active: 8/29/2008 10:12:14 AM anjali

Top 150 Posts
Joined on 08-04-2006
Posts 17
Re: SetPicture and Render method problem

Attachment: 1.3.12.2.1107.5.2.5.11067.4.0.1546547922413136.zip
Reply Quote

I am attaching the DICOM image, from which you can check its compression, HightBit , BitsStored, LargestImagePixelValue and all.

I am opening the dicom image

with LoadDS, getting dicomds.bitmap into the LeadrasterView1 and doing the above mentioned

operation on it, then i want to replace  dicomds bitamp  with this resultant bitmap in LeadRasterView1 for that purpose using SetBitmapValue and then save dicom file using Dicomds.SaveDS.

but for every image the bitmapbits are changed to 16 and LargestImagePixelValue with other than original value.

Why this is happening?

 

 


   Report 
  07-07-2008, 7:49
Qasem Lubani is not online. Last active: 9/2/2008 11:31:52 AM Qasem Lubani



Top 10 Posts
Joined on 08-13-2006
Posts 1,044
Re: SetPicture and Render method problem
Reply Quote

The DICOM dataset you attached contains a 16-bit image. This means the value of originalBitsperpixel in your code is probably 16. If you don't want it to be 16, pass a different value.

Please note that using a Windows device context handle (HDC) and the Render method does NOT work with 16-bit grayscale images, because standard Windows GDI functions do not support this pixel depth.


Qasem Al-Lubani
LEAD Technical Support
www.leadtools.com
   Report 
  07-08-2008, 4:12
anjali is not online. Last active: 8/29/2008 10:12:14 AM anjali

Top 150 Posts
Joined on 08-04-2006
Posts 17
Re: SetPicture and Render method problem
Reply Quote

Why hightbit, bitsored and LargestImagePixelValue are changing?


   Report 
  07-08-2008, 8:50
Qasem Lubani is not online. Last active: 9/2/2008 11:31:52 AM Qasem Lubani



Top 10 Posts
Joined on 08-13-2006
Posts 1,044
Re: SetPicture and Render method problem
Reply Quote

Since you appear to be inserting a completely new copy of the image that was somehow re-processed and converted from one pixel depth to another, my guess is that all image parameters are changing and that's a normal thing. Whether this behavior is correct for your application or not, it is up to you to decide based on the requirements of the program.

If you don't want this to happen, consider revising the steps that convert to a Picture object.
Qasem Al-Lubani
LEAD Technical Support
www.leadtools.com
   Report 
Post
LEAD Support Fo... » Developer » DICOM/Medical I... » SetPicture and Render method problem

Powered by Community Server, by Telligent Systems