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 : Tuesday, December 21, 2010 11:04:36 PM(UTC)
samit1984

Groups: Registered
Posts: 33


sir i want to change tag value
for example
if i want to change paitient name i am writing code as below

pTag = LDicomTag::Find(TAG_PATIENT_NAME);
if (pTag != NULL)
{
LDicomTag::SetName(pTag, TEXT("New name"));
}
nRet = pDS->SaveDS (TEXT"S:\\test\\work.dcm"), 0);

code execute without error but
when i open it with dicom deta set demo the value is not change it will still show the same old name
thanks samit
 

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 : Wednesday, December 22, 2010 6:00:52 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,022

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

To change a DICOM tag in a Dataset file, you can use this code:
L_INT nRet;
LDicomDS *pDS;
pDICOMELEMENT pElement;
pDS = new LDicomDS(NULL);
/* Load the data set from a DICOM file */
pDS->LoadDS(TEXT("D:\\LT\\images\\test2.dcm"), 0);
pElement = pDS->FindFirstElement(NULL, TAG_PATIENT_NAME, TRUE);
pDS->SetStringValue(pElement, TEXT("New^name"), 1, DICOM_CHARACTER_SET_DEFAULT);
// pDS->SetConvertValue(pElement, TEXT("New^name"), 1);
pElement = pDS->FindFirstElement(NULL, TAG_IMAGE_TYPE, FALSE);
pDS->SetConvertValue(pElement, TEXT("DERIVED\\PRIMARY"), 2);
nRet = pDS->SaveDS (TEXT("S:\\test\\work.dcm"), 0);
pDS->ResetDS();
delete pDS;

The LDicomTag class contains functionality for working with the table, or list (but not DICOM DataSet) of available Data Element Tags that LEADTOOLS maintains internally.
 
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.045 seconds.