Welcome to LEAD Support Forum Login | Register | Faq  

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

How to insert Private tags in Dicom
Started by sakthi at 06-17-2008 2:02. Topic has 19 replies.

Print Search « Previous Thread Next Thread »
  06-17-2008, 2:02
sakthi is not online. Last active: 9/1/2008 10:05:27 AM sakthi

Top 50 Posts
Joined on 05-09-2008
Posts 46
How to insert Private tags in Dicom
Reply Quote
Hi,
I am using leadtools v.15.I would like to insert private tag in my dicom file...I have used the following code  ....
***********************************************************************
  Dim element As DicomElement
  element = DS.InsertElement(Nothing, False, 1048647, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                             DS.FreeElementValue(element)
                            DS.SetStringValue(element, "SystemID", DicomCharacterSetType.Default)
                        End If
*************************************************************************
The above code inserting things like shown below...
Group         Element       Tag Descripition           VR                Length                Value
0x0010       0x0047                                            LO                10                      SystemID

But I need my result like this ...
Group         Element       Tag Descripition           VR                Length                Value
0x0010       0x0047           SystemID                  LO                10                     userinput

Can u please suggest me how to handle this issue......
As per the above code TagDescripition field is empty  and its wrongly inserted in Value field....
please correct my code
thanks in advance
Sakthi

   Report 
  06-17-2008, 10:23
Adam Boulad is not online. Last active: 7/23/2008 4:14:05 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 406
Re: How to insert Private tags in Dicom
Reply Quote

Sakthi,

The SetStringValue function will update the value of the tag, so if you want the value of the tag to be 'userinput', then 'userinput' should be passed with the SetStringValue function.

To set the Tag Description to SystemID, use the following line (VB.NET) in the application that will display the tag. In other words, to view the private tag, you must insert the tag using the following line in the application that will view the tag before loading the DICOM file.

Dim tag1 As DicomTag = DicomTagTable.Instance.Insert(1048647, &HFFFFFFFFL, "SystemID", DicomVRType.LO, 1, 1, 1)


Adam Boulad
LEADTOOLS Technical Support

   Report 
  06-18-2008, 2:01
sakthi is not online. Last active: 9/1/2008 10:05:27 AM sakthi

Top 50 Posts
Joined on 05-09-2008
Posts 46
Re: How to insert Private tags in Dicom
Reply Quote
Thanks for replying,
I have added the code which u have sent ...but it show the same  result as mentioned before...
please go through my code...Is anything went wrong in below shown code..Please correct me....

Dim tag1 As DicomTag = DicomTagTable.Instance.Insert(1048645, &HFFFFFFFFL, "SystemID", DicomVRType.LO, 1, 1, 1)
 element = DS.InsertElement(Nothing, False, 1048645, DicomVRType.LO, False, 1)
 If Not element Is Nothing Then
    DS.FreeElementValue(element)
     DS.SetStringValue(element, "SystemID", DicomCharacterSetType.Default)
  End If
   DS.Save(filename, DicomDataSetSaveFlags.ExplicitVR)

Tag descripition is still empty....
Group         Element       Tag Descripition           VR                Length                Value
0x0010       0x0047                                            LO                10                   SystemID

thanks
sakthi

   Report 
  06-18-2008, 11:56
Adam Boulad is not online. Last active: 7/23/2008 4:14:05 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 406
Re: How to insert Private tags in Dicom
Reply Quote

sakthi,

As I told you earlier, the SetStringValue function will update the value of the tag, so if you want the value of the tag to be 'userinput', then 'userinput' should be passed with the SetStringValue function.

Did you try to use

Dim tag1 As DicomTag = DicomTagTable.Instance.Insert(1048645, &HFFFFFFFFL, "SystemID",

before loading the DICOM file?


Adam Boulad
LEADTOOLS Technical Support

   Report 
  06-25-2008, 2:09
sakthi is not online. Last active: 9/1/2008 10:05:27 AM sakthi

Top 50 Posts
Joined on 05-09-2008
Posts 46
Re: How to insert Private tags in Dicom
Reply Quote
Hi,
Can  u please send a sample prog for adding Private tag to dicom files...using Vb.net...

Dim tag1 As DicomTag = DicomTagTable.Instance.Insert(1048645, &HFFFFFFFFL, "SystemID",
I have tried the above mentioned code but its not at all working.....

Its urgent,Please

Thanks in advance
sakthi

   Report 
  06-25-2008, 11:19
Adam Boulad is not online. Last active: 7/23/2008 4:14:05 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 406
Re: How to insert Private tags in Dicom
Reply Quote
Sakthi,
Can you please create a small sample project (not your full application) that only shows the problem and does the following:
1- Load DICOM file.
2- Display DICOM file and tags.
3- Insert DICOM tags that you want (SystemID).
And I will modify this project for you.
Please include your project in a ZIP or RAR file and don't use the 'Preview' feature.


Adam Boulad
LEADTOOLS Technical Support

   Report 
  06-27-2008, 1:45
sakthi is not online. Last active: 9/1/2008 10:05:27 AM sakthi

Top 50 Posts
Joined on 05-09-2008
Posts 46
Re: How to insert Private tags in Dicom
Reply Quote
I am not able send the prog???

   Report 
  06-27-2008, 1:51
sakthi is not online. Last active: 9/1/2008 10:05:27 AM sakthi

Top 50 Posts
Joined on 05-09-2008
Posts 46
Re: How to insert Private tags in Dicom
Reply Quote
Iam sending the prog to support@LEADTOOLS.com.  .please check it out....
subject  : To Add Private Tag
please check it out ......

sakthi

   Report 
  06-27-2008, 3:17
sakthi is not online. Last active: 9/1/2008 10:05:27 AM sakthi

Top 50 Posts
Joined on 05-09-2008
Posts 46
Re: How to insert Private tags in Dicom
Reply Quote
hi i try to send a sample prog but getting some probs,thats y i have attached the code...

just do few things...
1.Imports this first..

Imports System.IO
Imports System.Data.SqlClient
Imports System.Windows.Forms
Imports Leadtools.MedicalViewer
Imports Leadtools.Dicom
Imports Leadtools.Codecs
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Text
Imports System.Net
Imports System.Threading
Imports Microsoft.Win32
Imports System.Convert
Imports Leadtools
Imports Leadtools.Dicoms
Imports System
Imports Microsoft.VisualBasic


2.please add the following function in any button ....
private sub addprivatetag()
   Dim _ImageMain As RasterImage
        RasterCodecs.Startup()
        DicomEngine.Startup()
        Dim codecs As RasterCodecs = New RasterCodecs()
        Dim filepath As String = "D:\\sample.dcm"
        Dim savepath As String = "D:\\sample1.dcm"
        _ImageMain = codecs.Load(filepath)   ' load window Bitmap file
        Dim tag1 As DicomTag = DicomTagTable.Instance.Insert(1048645, &HFFFFFFFFL, "SystemID", DicomVRType.LO, 1, 1, 1)
        Dim DS As DicomDataSet = New DicomDataSet
        DS.Initialize(DicomClassType.Undefined, DicomDataSetInitializeType.ImplicitVRLittleEndian)

        Dim elem As DicomElement = DS.FindFirstElement(Nothing, DicomTagType.PixelData, True)
        DS.SetImage(elem, _ImageMain, DicomImageCompressionType.JpegLossless, _
                DicomImagePhotometricInterpretationType.Monochrome2, _
                _ImageMain.BitsPerPixel, 2, DicomSetImageFlags.AutoSetVoiLut)

        Dim element As DicomElement
        element = DS.InsertElement(Nothing, False, DicomTagType.CineRate, DicomVRType.IS, False, 0)
        If Not element Is Nothing Then
            DS.SetIntValue(element, New Integer() {999}, 1)
            Dim value As Integer() = DS.GetIntValue(element, 0, 1) ' can also call GetLongValue
        End If
        'Dim tag1 As DicomTag = DicomTagTable.Instance.Insert(1048645, &HFFFFFFFFL, "SystemID", DicomVRType.LO, 1, 1, 1)
        element = DS.InsertElement(Nothing, False, 1048645, DicomVRType.LO, False, 1)
        If Not element Is Nothing Then
            DS.FreeElementValue(element)
            DS.SetStringValue(element, "SystemID", DicomCharacterSetType.Default)
        End If
        DS.Save(savepath, DicomDataSetSaveFlags.ExplicitVR)
        RasterCodecs.Shutdown()
end sub



please check it out.....

thanks

   Report 
  06-29-2008, 9:49
Adam Boulad is not online. Last active: 7/23/2008 4:14:05 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 406
Re: How to insert Private tags in Dicom

Attachment: DisplayedTag.zip
Reply Quote
Sakhti,
You can use the following code and insert it in the menuItemOpen_Click event in our VB.NET DicomDemo in the following directory: [LEADTOOLS 15]\Examples\DotNet\VB\DicomDemo.
I have attached two images; DisplayedTag.jpg shows the Tag description of 'SystemID' and Tag value of 'UserInput'.
Code.jpg shows the code inserted and the place I inserted it in.

The Code:
'---------------------------
Dim tag1 As DicomTag = DicomTagTable.Instance.Insert(1048645, &HFFFFFFFFL, "SystemID", DicomVRType.LO, 1, 1, 1)
Dim dicomFileName As String = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\IMAGE1.dic"
ds.Load(dicomFileName, DicomDataSetLoadFlags.None)
Dim element As DicomElement
element = ds.InsertElement(Nothing, False, 1048645, DicomVRType.LO, False, 1)
If Not element Is Nothing Then
ds.FreeElementValue(element)
ds.SetStringValue(element, "UserInput", DicomCharacterSetType.Default)
End If
ds.Save("E:\testfiles\DIC\test2.dic", DicomDataSetSaveFlags.None)
'---------------------------
Adam Boulad
LEADTOOLS Technical Support

   Report 
  06-30-2008, 9:34
sakthi is not online. Last active: 9/1/2008 10:05:27 AM sakthi

Top 50 Posts
Joined on 05-09-2008
Posts 46
Re: How to insert Private tags in Dicom

Attachment: image.zip
Reply Quote
hi,
I have  tried out as per your instruction, but the result is not correct...Instead of SystemID I am getting tags as Item ..I have attached image which shows result ..please check it out
thanks
Sakthi
   Report 
  06-30-2008, 10:49
Adam Boulad is not online. Last active: 7/23/2008 4:14:05 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 406
Re: How to insert Private tags in Dicom

Attachment: DicomDemo_Copy.zip
Reply Quote
Sakthi,
I'm attaching the modified version of the [LEADTOOLS 15]\Examples\DotNet\VB\DicomDemo project. The code is inserted in the menuItemOpen_Click event. Please extract the folder in the attachment 'DicomDemo_Copy' to the directory:
[LEADTOOLS 15]\Examples\DotNet\VB\
Please try it.
Adam Boulad
LEADTOOLS Technical Support

   Report 
  07-01-2008, 2:26
sakthi is not online. Last active: 9/1/2008 10:05:27 AM sakthi

Top 50 Posts
Joined on 05-09-2008
Posts 46
Re: How to insert Private tags in Dicom
Reply Quote
Its working ....thanks...
Now how to retreive data from dicom image...
I have used following code but it shows error...please correct me .
Dim ds as dicomdataset
 ds.Load(filename, DicomDataSetLoadFlags.None)
Msgbox( Utils.GetStringValue(ds, "SystemID"))
how to retreive user tag value.....can please help me out ....


Thanks
Sakthi


   Report 
  07-01-2008, 10:30
Adam Boulad is not online. Last active: 7/23/2008 4:14:05 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 406
Re: How to insert Private tags in Dicom
Reply Quote
Sakthi,
If you want to retrieve the Tag value ('UserInput' in your example), you can use the following code:
'---------------
Dim element As DicomElement
Dim str As String
ds.Load(filename, DicomDataSetLoadFlags.None)
element = ds.FindFirstElement(Nothing, 1048645, False)
str = ds.GetStringValue(element, 0)
'---------------
Adam Boulad
LEADTOOLS Technical Support

   Report 
  07-02-2008, 7:36
sakthi is not online. Last active: 9/1/2008 10:05:27 AM sakthi

Top 50 Posts
Joined on 05-09-2008
Posts 46
Re: How to insert Private tags in Dicom
Reply Quote
thanks for ur reply...I will check it and let u know...

regards
sakthi


   Report 
Post
 Page 1 of 2 (20 items) 1 2 »
LEAD Support Fo... » Developer » DICOM/Medical I... » How to insert Private tags in Dicom

Powered by Community Server, by Telligent Systems