This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A port from javascript: https://hcintegrations.ca/2014/05/14/quick-and-dirty-javascript-dicomweb-uid-generator/ | |
public static string NewUID_dirty() | |
{ | |
var r = new System.Random(); | |
var uid = System.Text.RegularExpressions.Regex.Replace("2.25.xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx", "x", m => (r.Next()%16).ToString() ); | |
return System.Text.RegularExpressions.Regex.Replace(uid, "y", m => (r.Next()&3|8).ToString()); | |
} | |
// Trying to strictly follow the Dicom spec: ftp://medical.nema.org/medical/dicom/2013/output/html/part05.html#sect_B.2 | |
// More details at: ISO/IEC 9834-8 / ITU-T X.667, Section 6.3 |