FAQ #41: How does DCMTK generate UIDs, and are they unique?

Frequently Asked Questions regarding DCMTK

Moderator: FAQ Team

Post Reply
Message
Author
Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1280
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

FAQ #41: How does DCMTK generate UIDs, and are they unique?

#1 Post by Marco Eichelberg » Wed, 2006-08-09, 14:55

:?: How does DCMTK generate UIDs, and are they unique?

:!: Unique identifiers (UIDs) are used in DICOM to identify all kinds of concepts and objects: SOP classes, transfer syntaxes, studies, series and SOP instances (objects) and much more. Any DICOM application that generates new objects must be able to generate UIDs, and these UIDs must be world-wide unique. The DICOM UID concept is based on ISO object identifiers (OIDs). The principle is that anyone can reserve (usually for a certain fee) a UID root number from a registration authority. This UID root number is guaranteed to be world-wide unique. The application then needs to add further numbers to generated unique UIDs based on this UID root.

The default DCMTK UID root is 1.2.276.0.7230010.3 (see FAQ #25 on how to compile DCMTK with a different UID root). Since there is no central registry of DCMTK-based applications that are installed world-wide, the toolkit uses a probabilistic scheme to generate UIDs that are very likely to be unique (i.e., the probability of a collision is extremely low). In practice, the following components are added to the UID root:
  • the constant .1.4 to indicate an instance UID
  • a host identifier
  • the process ID of the current process
  • a timestamp
  • a counter
The timestamp contains the number of seconds since the beginning of the epoch (1970), and the counter is incremented with each UID generated by the same process. The algorithm for determining the host ID, which is a 32-bit number, depends on the operating system:
  • On Posix systems, the result of gethostid() is used, if available
  • On some platforms, sysinfo() as declared in <sys/systeminfo.h> is used to determine the hardware serial number
  • On Windows systems, a CRC checksum is computed over some host specific information such as the MAC address of the first ethernet card, the serial number of the boot device, the IP address of the system and the processor type
  • On other systems, the IP address is used as the host ID
In summary, there is no absolute guarantee that there will never be a collision between UIDs generated by DCMTK, but a collision is extremely unlikely.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest