How can I convert an UUID/GUID value like 8348d2c5-0a65-4560-bb24-f4f6bcba601d
(that I genreated with uuid v4) in to OID/DICOM UID like 2.25.17450698773882054
Based on other answer from @AmitJoshi; I can now answer my question:
Here is the JavaScript function:
function GenerateUidFromGuid(){
var guid = uuid.v4(); //Generate UUID using node-uuid *) package or some other similar package
var guidBytes = `0${guid.replace(/-/g, "")}`; //add prefix 0 and remove `-`
var bigInteger = bigInt(guidBytes,16); //As big integer are not still in all browser supported I use BigInteger **) packaged to parse the integer with base 16 from uuid string
return `2.25.${bigInteger.toString()}`; //Output the previus parsed integer as string by adding `2.25.` as prefix
}
Following are the references:
jsfiddle