Howto: Generate Unique Identifier (UID)¶
Here's an example that shows how the generation of three new UIDs works (e.g. to be used for a new SOP Instance created by dump2dcm):
Source Code¶
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dcuid.h"
#include "dcmtk/ofstd/ofstream.h"
int main(int /*argc*/, char * /*argv*/ [])
{
char uid[100];
STD_NAMESPACE cout << "Study Instance UID : " << dcmGenerateUniqueIdentifier(uid, SITE_STUDY_UID_ROOT) << OFendl;
STD_NAMESPACE cout << "Series Instance UID : " << dcmGenerateUniqueIdentifier(uid, SITE_SERIES_UID_ROOT) << OFendl;
STD_NAMESPACE cout << "SOP Instance UID : " << dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT) << OFendl;
return 0;
}