/** Update an ID field - handles Patient ID, Accession#, StudyID etc */ public static String updateId(DicomObject ds, int tag, long deident) { String orig = ds.getString(tag); if( orig==null ) orig = Integer.toHexString(tag); String v = SHA1(orig+deident); v = v.substring(0,14).replace('+','_'); ds.putString(tag,null, v); return v; }
/** Update a UID type field - handles Study Instance UID, SOP UID etc */ public static String updateUID(DicomObject ds, int tag, long deident) { String orig = ds.getString(tag); String v = SHA1(orig+deident); String uid = "2.25."+decodeLong(v,0)+"."+decodeLong(v,8)+"."+decodeLong(v,16); ds.putString(tag,null, uid); return v; }