Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, June 30, 2008 4:14:09 AM(UTC)

anjali  
anjali

Groups: Registered
Posts: 43


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

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, June 30, 2008 5:39:38 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

I will test your code here and see if I can reproduce the issue. I will get back to you as soon as possible.
 
#3 Posted : Tuesday, July 1, 2008 2:58:16 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


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()
 
#4 Posted : Tuesday, July 1, 2008 3:58:01 AM(UTC)

anjali  
anjali

Groups: Registered
Posts: 43


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?

 

 

 
#5 Posted : Wednesday, July 2, 2008 3:50:07 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


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
 
#6 Posted : Wednesday, July 2, 2008 11:05:33 PM(UTC)

anjali  
anjali

Groups: Registered
Posts: 43


It 's working .

Thank you.

 

 
#7 Posted : Saturday, July 5, 2008 4:14:49 AM(UTC)

anjali  
anjali

Groups: Registered
Posts: 43


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.

 

 

 
#8 Posted : Sunday, July 6, 2008 2:46:31 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


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?

 
#9 Posted : Sunday, July 6, 2008 8:35:28 PM(UTC)

anjali  
anjali

Groups: Registered
Posts: 43


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?

 

 

File Attachment(s):
 
#10 Posted : Monday, July 7, 2008 2:44:52 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


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.

 
#11 Posted : Monday, July 7, 2008 11:07:47 PM(UTC)

anjali  
anjali

Groups: Registered
Posts: 43


Why hightbit, bitsored and LargestImagePixelValue are changing?

 
#12 Posted : Tuesday, July 8, 2008 3:45:37 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


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.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.116 seconds.