https://github.com/okigan/dcmtk/blob/master/dcmdata/include/dcmtk/dcmdata/dcuid.h
/** creates a Unique Identifer in uid and returns uid.
* uid must be at least 65 bytes. Care is taken to make sure
* that the generated UID is 64 characters or less.
* If a prefix string is not passed as the second argument a
* default of SITE_INSTANCE_UID_ROOT (see below) will be used.
* Otherwise the supplied prefix string will appear at the beginning
* of uid.
* The UID is created by appending to the prefix the following:
* the host id (if obtainable, zero otherwise),
* the process id (if obtainable, zero otherwise),
* the system calendar time, and
* an accumulating counter for tis process.
* @param uid pointer to buffer of 65 or more characters in which the UID is returned
* @param prefix prefix for UID creation
* @return pointer to UID, identical to uid parameter
*/
DCMTK_DCMDATA_EXPORT char *dcmGenerateUniqueIdentifier ( char *uid, const char* prefix = NULL );
#include "dcmtk/dcmdata/dcuid.h"
....
char *uid = NULL;
dcmGenerateUniqueIdentifier(uid);
.....