This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, December 8, 2008 6:49:14 AM(UTC)
Groups: Registered
Posts: 101
Hi there,
I am using LEAD Tools 14.5 with Visual Basic 6.
Following are the versions of my LEAD Tools Dlls
LTDic14N.dll = 14.5.0.2
LTDic14s.dll = 14.5.0.1
LTDicDS14n.DLL = 14.5.0.2
I want to convert any non dicom image (i. e. JPEG, TIFF, BMP with any bits per pixel) to 12 bit DICOM MONOCHROME2 image.
My sample project is attached herewith for your kind perusal.
My problem is, though I am converting the image to 12 bit using Grayscale() method of LEADRasterProcess object before inserting it into DICOM Dataset, the output values (values after DICOM DS is saved on harddisk using SaveDS() method of LEAD DICOMDs) of BitsAllocated, BitsPerPixel and BitsStored are 16. And output value of HighBit is 15.
To reproduce same problem in your LEAD DICOM VB Demo :-
- Convert SourceImage.tif to DICOM using this sample
- Open Target.dic created after conversion in LEAD DICOM VB Demo application
- Open the Pixel Data element to view the image
- Observe BitsAllocated, BitsPerPixel and BitsStored values in ImageInfo. Value must be 16.
- Now under "Processing" menu, click on "Grayscale 12" submenu.
- Again observe BitsAllocated, BitsPerPixel and BitsStored values in ImageInfo. Those will be 16.
If I am converting image to 12 bits, these values should be changed accordingly. But its not happening.
Please help me out.
#2
Posted
:
Monday, December 8, 2008 6:56:11 AM(UTC)
Groups: Registered
Posts: 101
I am trying to upload sample code in zip file here but failed.
Following is the message displayed on screen.
"Unknown Error
We apologize, but an unknown error has occured in the forums.
This error has been logged."
Please let me know how should I upload zip file here ?
#3
Posted
:
Tuesday, December 9, 2008 12:45:09 AM(UTC)
Groups: Registered
Posts: 101
This is my sample application
#4
Posted
:
Wednesday, December 10, 2008 5:48:32 AM(UTC)
Groups: Registered
Posts: 101
#5
Posted
:
Wednesday, December 10, 2008 5:49:52 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Amit,
I received your project and I am currently investigating more about this issue. I will provide you with more information very soon.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#6
Posted
:
Wednesday, December 10, 2008 6:04:27 AM(UTC)
Groups: Registered
Posts: 101
I read few more posts on this site describing same problem and your solutions for the same.
I tried all those solutions but it did not worked.
any way, as you said you are working on it.
Waiting for your reply.
#7
Posted
:
Thursday, December 11, 2008 7:01:56 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Amit,
I checked your project and noticed that because you set DicomDS.EnableMethodErrors to False, your code does not detect that some function calls fail. For example, DicomDS.GetImageInformation fails, but your code continues and tries to check the members of DicomDS.ImageInfo.
I'm not sure yet where the source of the error is, so can you reproduce the problem using a smaller project that only contains the minimum needed code without having multiple subroutines calling one another?
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#8
Posted
:
Friday, December 12, 2008 5:33:36 AM(UTC)
Groups: Registered
Posts: 101
Now I have merged InsertBitmap function in ConvertToDIC function. As you said I enabled the method errors. Updated project is attached herewith.
Now it throws an error at "DicomDS.InsertElement"
Error is General Failure.
What should I do now ?
Further, how this could affect conversion to 12 bit DIC.
My primary target is to convert image to 12 bit DICOM.
Waiting for your reply
#9
Posted
:
Sunday, December 14, 2008 5:05:14 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Amit,
About the DicomDS.InsertElement issue, to resolve the problem, don't call the DicomDS.SetCurrentElement method before calling the DicomDS.InsertElement method. Please check the following code:
+------------+
If DicomDS.FindFirstElement(TAG_PIXEL_DATA, False) = DICOM_SUCCESS Then
DicomDS.DeleteElement
If DicomDS.InsertElement(True, TAG_PIXEL_DATA, VR_OB, False, 0) = DICOM_SUCCESS Then
hPixelDataElement = DicomDS.CurrentElement.hElement
End If
+------------+
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#10
Posted
:
Sunday, December 14, 2008 8:00:36 PM(UTC)
Groups: Registered
Posts: 101
Hi,
I followed the steps and the General Failure error is gone. Modified project is attached herewith.
But now the error is at "DicomDS.GetImageInformation 0" saying value is out of range.
I checked lead documentation. The parameter passed to GetImageInformation() method is index of image in pixel data element. In my case, it is zero and I passed same.
Please download and modify the same project and upload the updated one here. For my help, please put some comments in project. It will take much time if we keep playing with single error.
#11
Posted
:
Monday, December 15, 2008 1:27:39 AM(UTC)
Groups: Registered
Posts: 101
Hi,
I modified the project again and uploaded here for your reference.
Now EnableMethodErrors is true and there is no any error in entire application. Still, output image after conversion is 16 bit.
Please download and modify the same project and upload the updated one here. For my help, please put some comments in project.
Waiting for your reply.
#12
Posted
:
Tuesday, December 16, 2008 6:29:27 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Amit,
I want to investigate more about his issue. Please send an email to
support@leadtools.com and include the following information in your email: Your name, Company name and LEADTOOLS serial number.
Please don't forget to mention this forum post in your email to support.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#13
Posted
:
Wednesday, December 17, 2008 3:51:46 AM(UTC)
Groups: Registered
Posts: 101
Hi Maen,
I sent the mail according to your insturctions.
I received the following :-
Ticket#: 2008121710000181
Please reply soon.
Waiting for reply,
#14
Posted
:
Wednesday, December 17, 2008 8:58:23 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Amit,
I will send you a reply through support email.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#15
Posted
:
Thursday, December 18, 2008 4:33:17 AM(UTC)
Groups: Registered
Posts: 101
Thanks Maen for reply.
Will you please tell me approximately how much time it will take to resolve the issue. This will help me to schedule my project.
Also please make a post here when you send me Support eMail so that I can check it out.
Thanks again and waiting for reply.
#16
Posted
:
Sunday, December 21, 2008 9:15:20 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Amit,
Please check the following forum post (specially what my colleague GregR wrote
on 02-13-2008:
http://support.leadtools.com/SupportPortal/CS/forums/18967/ShowPost.aspx
The same thing should apply to our COM interface. Use the
ILEADRasterProcess.ShiftData function, ILEADRaster.LevelLowBit and
LevelHighBit, GetMinMaxVal, etc.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#17
Posted
:
Sunday, December 21, 2008 9:25:58 PM(UTC)
Groups: Registered
Posts: 101
Hi maen,
I tried your solution but it still not working.
The results of tests are as follows.
1) If I use 24 BPP image as source image, the modifications donot affect any way.
2) If I use 16 bits allocated 12 bits stored tif image (the one you attached in post 18967 on 13 Feb 2008), it shows output high bit 12 but image is totaly distorted.
I have attached my modified sample herewith.
As I have said in earlier post, please download and modify the project at your end and please upload modified project herewith for my reference. This will save your and my time.
Waiting for your reply.
#18
Posted
:
Monday, December 22, 2008 8:05:33 PM(UTC)
Groups: Registered
Posts: 101
I got your email
I have sent you the reply.
#19
Posted
:
Sunday, December 28, 2008 3:54:42 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Amit,
To change the stored bits to 12-bit, please try to use the following code:
+--+
Private Sub ConvertToDICOM()
...
If LeadRasterView1.Raster.Bitmap Then
'Convert image to 12 bits before inserting it into dataset
'RasterProc.Grayscale LeadRasterView1.Raster, IMAGE_BITS_PER_PIXEL
DicomDS.SetCurrentElement hPixelDataElement
LEADRasterView2.Raster.Bitmap = LeadRasterView1.Raster.Bitmap
RasterProc.Grayscale LEADRasterView2.Raster, 12
RasterProc.Grayscale LeadRasterView1.Raster, 12
RasterProc.ShiftData LEADRasterView2.Raster, LeadRasterView1.Raster, 0, 11, 0, 16 'IMAGE_BITS_PER_PIXEL
LEADRasterView2.Raster.SetMinMaxBits 0, 11
nRet = DicomDS.FindFirstElement(TAG_PIXEL_DATA, False)
Dim minValue As Integer
Dim maxValue As Integer
minValue = 0
maxValue = 11
RasterProc.ApplyLinearVOILUT LEADRasterView2.Raster, (maxValue - minValue) / 2, (maxValue - minValue), VOI_LUT_UPDATE_MIN_MAX
DicomDS.InsertBitmapValue LEADRasterView2.Raster.Bitmap, _
0, _
DICOM_IMAGE_COMPRESSION_NONE, _
DICOM_IMAGE_PHOTOMETRIC_MONOCHROME2, _
12, _
0, _
DICOM_SETIMAGE_AUTO_SAVE_OVERLAYS
+--+
Please check the code and let me know how it goes.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
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.