Implementation Version Name

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
prakash
Posts: 50
Joined: Mon, 2008-05-19, 10:34
Contact:

#1 Post by prakash »

Ho can i Insert Implementation Version Name to DicomMetaInformation Header using Fileformat or Dataset?
Please Guide me

zaq
Posts: 11
Joined: Wed, 2008-06-18, 23:04

#2 Post by zaq »

prakash wrote:Ho can i Insert Implementation Version Name to DicomMetaInformation Header using Fileformat or Dataset?
Please Guide me
Implementation Version Name is just one of the DICOM's tag so inserting it doesn't differ from others.

First look into "PS 3.6" document ("DICOM Part 6: Data Dictionary") and search for "Implementation Version Name". You will find it under section "Registry of DICOM File Meta Elements" where you can find out its tag and Value Representation (VR). In this case it is respectively (0002,0013) and SH.

Value Representation determines what function should be used to inserting such tag. SH means short string, so the proper function will be `setString()' (for details about value representations see "PS 3.5", section 6.2: "VALUE REPRESENTATION (VR)").

Now, when you've collected all needed data, you can write the code:

Code: Select all

DcmTag tag( 0x2, 0x13 );
tag.lookupVRinDictionary(); // We don't need to set VR for known tags ourselfs.

DcmElement * element = new DcmShortString( tag ); 
element->setString( "New Implementation Version Name" ); 

dcmFileFormat->getMetaInfo()->insert( 
   element, 
   true // replace existing 
);
All of this however is acadmic and I've written it to explain to you how things work. Actually to set new value for public (known) tag you only have to write this:

Code: Select all

dcmFileFormat->getMetaInfo()->putAndInsertString( DcmTag( 0x2, 0x13), "New Implementation Version Name" ); 
This function does exactly the same as mine code written above. Further more it will convert passed string to proper VR if necessary so you can call it even while setting integer or float value, for example:

Code: Select all

dcmFileFormat->getMetaInfo()->putAndInsertString( DcmTag( some tag with float VR), "0.145" ); 
Hope it helped. :)

prakash
Posts: 50
Joined: Mon, 2008-05-19, 10:34
Contact:

#3 Post by prakash »

Thanks For ur reply
Yah I know this and already done this one , but this is not adding to Meta Info Header of the DICOMFIle. It is directly adding to Dataset which i dont need.
I need to add this Implementation Version name to MetaInfoHeader.
Hope you will guide me...

zaq
Posts: 11
Joined: Wed, 2008-06-18, 23:04

#4 Post by zaq »

If calling `putAndInsertString()' doesn't work, maybe try to remove the tag first and then create new one as described. Maybe that would help.

prakash
Posts: 50
Joined: Mon, 2008-05-19, 10:34
Contact:

#5 Post by prakash »

this is my code , can u suggest me where i am going wrong

DcmItem *metaInfo = dcm_dcmfrmt.getMetaInfo();
if (metaInfo)
{
delete metaInfo->remove(DCM_ImplementationVersionName);
}

DcmTag tag( 0x2, 0x13 );
tag.lookupVRinDictionary();
DcmElement * element = new DcmShortString( tag );
element->putString( ConvertBSTRToChar(_DcmDemographicInfo.SoftwareVersionName) );

metaInfo->insert(
element,
true
);
dcm_dcmfrmt.loadAllDataIntoMemory();
dcm_ofstatus=dcm_dcmfrmt.saveFile((const char*)DCMFilePath,
EXS_MPEG2MainProfileAtMainLevel);

if(dcm_ofstatus.bad())
{
_DcmErrorCode=QDCM_ERRORINSAVINGMPEG2DICOMFILE;
_DcmErrorString = dcm_ofstatus.text();
return S_FALSE;
}

zaq
Posts: 11
Joined: Wed, 2008-06-18, 23:04

#6 Post by zaq »

The code looks fine.

Hm... Why do you call `loadAllDataIntoMemory()'? Maybe this function or `saveFile()' does something to the header. Try remove existing Implementation Version Name but don't create a new one and see what will happen.

prakash
Posts: 50
Joined: Mon, 2008-05-19, 10:34
Contact:

#7 Post by prakash »

I have this one after your suggestion
DcmItem *metaInfo = dcm_dcmfrmt.getMetaInfo();
if (metaInfo)
{
delete metaInfo->remove(DCM_ImplementationVersionName);
}

dcm_ofstatus=dcm_dcmfrmt.saveFile((const char*)DCMFilePath,
EXS_MPEG2MainProfileAtMainLevel,EET_ExplicitLength,EGL_withGL,EPD_withoutPadding);

if(dcm_ofstatus.bad())
{
_DcmErrorCode=QDCM_ERRORINSAVINGMPEG2DICOMFILE;
_DcmErrorString = dcm_ofstatus.text();
return S_FALSE;
}

zaq
Posts: 11
Joined: Wed, 2008-06-18, 23:04

#8 Post by zaq »

Well, and what was the output? Did it create Implementation Version Name itself?

prakash
Posts: 50
Joined: Mon, 2008-05-19, 10:34
Contact:

#9 Post by prakash »

No Still i wont get the answer and not even implementation version Name is removed from meta info header
And i have done combination of padding tags and with different group Length Tags, but i am still unable to find the correct answer
Thanks in advance

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#10 Post by Jörg Riesmeier »

As you can read in other postings, you should change the definitions in dcmtk/dcmdata/include/dcmtk/dcmdata/dcuid.h if required. However, I don't see any reason to change this information. If you are using the DCMTK, implementation version name and implementation class UID should refer to this toolkit!

cmk
Posts: 7
Joined: Mon, 2009-03-30, 10:53

#11 Post by cmk »

Is there a way to set informations about the wrapping application
into the media header.
Something like a user-defined tag?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#12 Post by Jörg Riesmeier »

What do you mean by "wrapping application"?

cmk
Posts: 7
Joined: Mon, 2009-03-30, 10:53

#13 Post by cmk »

I mean the application that uses the DCMTK to write DICOM files.

I would like to see the application name and version, in addition to the DCMTK version, in every file the application have created.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#14 Post by Jörg Riesmeier »

If your application just writes (stores) DICOM files it has read or received from a third party system, you should use the Implementation Class UID and Implementation Version Name of the underlying DICOM toolkit (in this case DCMTK -- which is the default as you can read above).

If your application creates new SOP Instances (i.e. the content of the dataset), you should check the Equipment Modules applicable to the IOD you are using. Possible DICOM attributes are: Manufacturer, Manufacturer's Model Name, Software Versions and the like from the General Equipment Module.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest