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 16, 2008 8:57:11 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


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
 

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 : Tuesday, June 17, 2008 5:18:14 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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


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)

 
#3 Posted : Tuesday, June 17, 2008 8:56:30 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


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
 
#4 Posted : Wednesday, June 18, 2008 6:51:45 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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


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?

 
#5 Posted : Tuesday, June 24, 2008 9:04:59 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


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
 
#6 Posted : Wednesday, June 25, 2008 6:14:13 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

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.

 
#7 Posted : Thursday, June 26, 2008 8:40:21 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


I am not able send the prog???
 
#8 Posted : Thursday, June 26, 2008 8:46:10 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


Iam sending the prog to support@LEADTOOLS.com

.please check it out....
subject  : To Add Private Tag
please check it out ......

sakthi
 
#9 Posted : Thursday, June 26, 2008 10:12:43 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


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
 
#10 Posted : Sunday, June 29, 2008 4:44:30 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

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)
'---------------------------
File Attachment(s):
DisplayedTag.zip (126kb) downloaded 43 time(s).
 
#11 Posted : Monday, June 30, 2008 4:29:34 AM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


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
File Attachment(s):
image.zip (21kb) downloaded 43 time(s).
 
#12 Posted : Monday, June 30, 2008 5:44:56 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

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.
File Attachment(s):
DicomDemo_Copy.zip (166kb) downloaded 50 time(s).
 
#13 Posted : Monday, June 30, 2008 9:21:42 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


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

 
#14 Posted : Tuesday, July 1, 2008 5:25:31 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

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)
'---------------
 
#15 Posted : Wednesday, July 2, 2008 2:31:29 AM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


thanks for ur reply...I will check it and let u know...

regards
sakthi

 
#16 Posted : Sunday, July 6, 2008 11:47:43 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


Hi dude ,
Its working fine .....But I have one more probs ....Actually I have to insert near 20 private tags in my dcm file.....I have started from  1048645 .and it goes on till 1048662 but its not at all inserting .
I am sure probs is assigning this address i.e 1048645.Can U  suggest me some series like 1048645 start from XXXXX1 to XXXXXX20 ..Actually when I looked  through the .Net Help they have mentioned  to add up odd values(gggg) ...I could not just this address....Can u explain me....

Thanks
Sakthi
 
#17 Posted : Monday, July 7, 2008 5:19:05 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

Sakthi,
What are the exact tag numbers that did not insert? Are they all even or are any of them odd (e.g. ends with 1, 3, 5, ...)?
 
#18 Posted : Monday, July 7, 2008 8:19:03 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26


I have used Group and elements series as follows..
The code is here

  Dim tag1 As DicomTag = DicomTagTable.Instance.Insert(1048645, &HFFFFFFFFL, "System0", DicomVRType.LO, 1, 1, 1)
           tag1 = DicomTagTable.Instance.Insert(1048646, &HFFFFFFFFL, "System1", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048647, &HFFFFFFFFL, "System2", DicomVRType.LO, 1, 1, 1)
           tag1 = DicomTagTable.Instance.Insert(1048648, &HFFFFFFFFL, "System3", DicomVRType.LO, 1, 1, 1)
           tag1 = DicomTagTable.Instance.Insert(1048649, &HFFFFFFFFL, "System4", DicomVRType.LO, 1, 1, 1)
           tag1 = DicomTagTable.Instance.Insert(1048650, &HFFFFFFFFL, "System5", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048651, &HFFFFFFFFL, "System6", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048652, &HFFFFFFFFL, "System7", DicomVRType.LO, 1, 1, 1)
           tag1  = DicomTagTable.Instance.Insert(1048653, &HFFFFFFFFL, "System8", DicomVRType.LO, 1, 1, 1)
           tag1 = DicomTagTable.Instance.Insert(1048654, &HFFFFFFFFL, "System9", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048655, &HFFFFFFFFL, "System10", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048656, &HFFFFFFFFL, "System11", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048657, &HFFFFFFFFL, "System12", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048658, &HFFFFFFFFL, "System13", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048659, &HFFFFFFFFL, "System14", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048660, &HFFFFFFFFL, "System15", DicomVRType.LO, 1, 1, 1)
            tag1 = DicomTagTable.Instance.Insert(1048661, &HFFFFFFFFL, "System16", DicomVRType.LO, 1, 1, 1)
           tag1 = DicomTagTable.Instance.Insert(1048662, &HFFFFFFFFL, "System17", DicomVRType.LO, 1, 1, 1)
 ds.Load(filename, 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, "1", DicomCharacterSetType.Default)
                        End If

                        element = DS.InsertElement(Nothing, False, 1048646, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,  "2", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048647, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,  "3", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048648, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,  "4", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048649, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,  "5", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048650, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,  "6", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048651, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,  "7", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048652, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element, "8", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048653, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,  "9", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048654, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,  "10", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048655, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,  "11", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048656, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element, "12", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048657, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element, "13", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048658, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element, "14", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048659, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element, "15", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048660, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,"16", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048661, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element,"17", DicomCharacterSetType.Default)
                        End If
                        element = DS.InsertElement(Nothing, False, 1048662, DicomVRType.LO, False, 1)
                        If Not element Is Nothing Then
                            DS.FreeElementValue(element)
                            DS.SetStringValue(element, "18", DicomCharacterSetType.Default)
                        End If

 The output is attached...which is wrong ...Please check it and Correct me If  I am  Wrong....


Thanks
Sakthi




File Attachment(s):
image1.zip (8kb) downloaded 40 time(s).
 
#19 Posted : Monday, July 7, 2008 8:20:50 PM(UTC)

sakthi  
sakthi

Groups: Registered
Posts: 26




File Attachment(s):
image2.zip (31kb) downloaded 44 time(s).
 
#20 Posted : Tuesday, July 8, 2008 5:36:58 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

Sakthi,
You are inserting tags with even numbers, such as 1048646, 48 an 50. Only insert ODD tags that end with (1, 3, 5, 7, 9).
Please read the topic 'Private Data Elements' in the .NET help file.

 
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.702 seconds.