How to generate unique DICOM UID?
Asked Answered
L

1

12

I am working on DICOM gated (PET) data.
I would like to artificially create a DICOM image series which includes gated data. I am inquiring on the increment values of SOPInstanceUID which labels each image slice in each phase or gate.

These have different values for each slice in a gate and are incremented between gates but I can't find out the logic to how this value is chosen.

Is there a reference to where and how these values are written?

Landman answered 19/9, 2017 at 15:27 Comment(3)
The UIDs have to be unique. It does not matter how you create them, just their uniqueness matters. Usually, a root UID is used and then you append to it a different suffix for each instance. The logic used to find the suffix is up to you (increment, use the time, etc).Alidaalidade
@PaoloBrandoli: Increment logic if used, must be used with care considering all scenarios to guarantee uniqueness. I am personally against it. Common pit-fall is when the instance is deleted and next instance is created, the earlier counter should not be used.Maley
Does this answer your question? How to generate SOPInstance UID for DICOM file?Experimental
M
28

Multiple algorithms to generate DICOM UID are explained in this answer with their drawbacks.

As per DICOM specifications, all UIDs including SOPInstanceUID in question should be unique. This is irrelevant to what data (gated PET data or other) you are working on.

Following is from specifications:

2017a Part 5 - Data Structures and Encoding (9 Unique Identifiers (UIDs))

Unique Identifiers (UIDs) provide the capability to uniquely identify a wide variety of items. They guarantee uniqueness across multiple countries, sites, vendors and equipment. Different classes of objects, instance of objects and information entities can be distinguished from one another across the DICOM universe of discourse irrespective of any semantic context.

UID consists of two parts:

  1. Organization root:
    This part of UID ensures the uniqueness across organizations. There are service providers who offer this for free. Medical Connections is the one I am aware about. You can contact them to get the one for free.

  2. Suffix:
    Further, you should generate suffix in such a way that it guarantees uniqueness inside your organization.

Following are the general rules for DICOM UID:

  1. Total length must be <= 64 characters, including the stops
  2. Must contain only digits 0-9 and full stops
  3. Each numeric "component" (between stops) must be a valid and unambiguous integer number, and so must not have a leading zero (unless the whole component is zero)
  4. Must be guaranteed to be unique - this means:
    • It must be derived from a proper official root under your sole control.
    • It must not be created by appending digits (however special you consider the combination!) to someone else's UID.
    • In particular, series UIDs for secondary capture images, KIN objects etc. must not be created as derivatives of the Study UID (unless you own that root!)
  5. Related to the above, there is no expectation or requirement that the Study UID, Series UID and Instance UID for images should be derived from the same root (though in practice, Series UID and Instance UID normally are, as both must be generated internally by the equipment which generates the images)
  6. Date and Time are useful for generating UIDs, but only if:
    • Each machine has a unique root (normally your company UID root + a machine specific suffix such as a serial number
    • If it is possible for UIDs to be generated at > 1 per second, then a sequential counter should also be used
    • if on a multi-threaded machine, then the thread ID or a properly interlocked counter are needed to prevent 2 applications or 2 threads in the same application from generating identical UIDs simultaneously.
    • Do not use time on its own - it is too easy to end up with a leading zero 0 - e.g. 20060724.093017 use instead 20060724093017

Same can be found in specifications.


Following example is from DICOM Specifications to generate UID. Please note that this is Informative section.

2017a Part 5 - Data Structures and Encoding (B Creating a Privately Defined Unique Identifier (Informative))

B.1 Organizationally Derived UID:

The following example presents a particular choice made by a specific organization in defining its suffix to guarantee uniqueness of a SOP Instance UID.

"1.2.840.xxxxx.3.152.235.2.12.187636473"

In this example, the root is:

  • 1 Identifies ISO
  • 2 Identifies ANSI Member Body
  • 840 Country code of a specific Member Body (U.S. for ANSI)
  • xxxxx Identifies a specific Organization.(assigned by ANSI)

In this example the first two components of the suffix relate to the identification of the device:

  • 3 Manufacturer defined device type
  • 152 Manufacturer defined serial number

The remaining four components of the suffix relate to the identification of the image:

  • 235 Study number
  • 2 Series number
  • 12 Image number
  • 187636473 Encoded date and time stamp of image acquisition

In this example, the organization has chosen these components to guarantee uniqueness. Other organizations may choose an entirely different series of components to uniquely identify its images. For example it may have been perfectly valid to omit the Study Number, Series Number and Image Number if the time stamp had a sufficient precision to ensure that no two images might have the same date and time stamp. Because of the flexibility allowed by the DICOM Standard in creating organizationally derived UIDs, implementations should not depend on any assumed structure of UIDs and should not attempt to parse UIDs to extract the semantics of some of its components.

There is one more way mentioned in specifications

2017a Part 5 - Data Structures and Encoding (B Creating a Privately Defined Unique Identifier (Informative))

B.2 UUID Derived UID:

UID may be constructed from the root "2.25." followed by a decimal representation of a Universally Unique Identifier (UUID). That decimal representation treats the 128 bit UUID as an integer, and may thus be up to 39 digits long (leading zeros must be suppressed).
A UUID derived UID may be appropriate for dynamically created UIDs, such as SOP Instance UIDs, but is usually not appropriate for UIDs determined during application software design, such as private SOP Class or Transfer Syntax UIDs, or Implementation Class UIDs.

Maley answered 20/9, 2017 at 7:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.