Class UIDGenerator
A class for generating new UIDs, deterministically or not, including potentially reproducible Study, Series and SOP Instance UIDs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet a different new UID for any purpose.getNewSeriesInstanceUID
(String studyID, String seriesNumber) Get a Series Instance UID.getNewSOPInstanceUID
(String studyID, String seriesNumber, String instanceNumber) Get a SOP Instance UID.getNewStudyInstanceUID
(String studyID) Get a Study Instance UID.Get a new UID for any purpose.static final void
Test generating SOP Instance UIDs.void
newStamp()
Reinitialize the UID generator with a new stamp using random and installation specific elements to create a unique root.
-
Constructor Details
-
UIDGenerator
public UIDGenerator()Create a UID generator.
This will use random and installation specific elements to create a unique root.
-
UIDGenerator
Create a UID generator.
This will use the supplied stamp rather than generating a unique root, to create repeatable UIDs.
- Parameters:
stamp
- a String of dotted numeric values in UID form
-
-
Method Details
-
newStamp
public void newStamp()Reinitialize the UID generator with a new stamp using random and installation specific elements to create a unique root.
For example, use between invocations of getNewUID().
-
getNewUID
Get a new UID for any purpose.
This will always be the same for this instance of the UIDGenerator, unless newStamp() has been called since the last time.
- Returns:
- the UID
- Throws:
DicomException
- if result is too long or otherwise not a valid UID
-
getAnotherNewUID
Get a different new UID for any purpose.
This will never be the same twice, since newStamp() is called.
- Returns:
- the UID
- Throws:
DicomException
- if result is too long or otherwise not a valid UID
-
getNewStudyInstanceUID
Get a Study Instance UID.
This will be the same for this instance of the UIDGenerator and the same parameter values.
Only use this if you really need reproducible UIDs; otherwise use getNewUID().
- Parameters:
studyID
- least significant 4 digits of leading numeric part is used- Returns:
- the UID
- Throws:
DicomException
- if result is too long or otherwise not a valid UID
-
getNewSeriesInstanceUID
Get a Series Instance UID.
This will be the same for this instance of the UIDGenerator and the same parameter values.
Only use this if you really need reproducible UIDs; otherwise use getNewUID().
- Parameters:
studyID
- least significant 4 digits of leading numeric part is usedseriesNumber
- least significant 4 digits of leading numeric part is used- Returns:
- the UID
- Throws:
DicomException
- if result is too long or otherwise not a valid UID
-
getNewSOPInstanceUID
public String getNewSOPInstanceUID(String studyID, String seriesNumber, String instanceNumber) throws DicomException Get a SOP Instance UID.
This will be the same for this instance of the UIDGenerator and the same parameter values.
Only use this if you really need reproducible UIDs; otherwise use getNewUID().
- Parameters:
studyID
- least significant 4 digits of leading numeric part is usedseriesNumber
- least significant 4 digits of leading numeric part is usedinstanceNumber
- least significant 4 digits of leading numeric part is used- Returns:
- the UID
- Throws:
DicomException
- if result is too long or otherwise not a valid UID
-
main
Test generating SOP Instance UIDs.
- Parameters:
arg
- a single numeric argument that is the number of UIDs to generate
-