Open apt2000 opened 1 year ago
FYI. I am seeing this duplication issue only with DicomAnonymizer.exe. When I invoke anonymize() from Python code, it appears to behave correctly.
Hello @apt2000,
I suspect that this comes from the regexp.
"find": "."
is going to take each character of the initial value and replace it with whatever is in replace.
So in my test file, 3860448
is replaced by ID003ID003ID003ID003ID003ID003ID003
(7xID003
because there are 7 characters in 3860448
)
What do you intend to do with this regexp ?
Hello @apt2000,
I suspect that this comes from the regexp.
"find": "."
is going to take each character of the initial value and replace it with whatever is in replace. So in my test file,3860448
is replaced byID003ID003ID003ID003ID003ID003ID003
(7xID003
because there are 7 characters in3860448
)What do you intend to do with this regexp ?
Thanks for looking into this. I am just looking to simply replace, the original PatientID with something different. Is there a way to specify this in the JSON file? I don't think "find": "*" worked for me.
In Python code which works fine, I am just using: def setupPatientID(dataset, tag): element = dataset.get(tag) if element is not None: element.value = args.new_id
extraAnonymizationRules[(0x0010, 0x0020)] = setupPatientID
I used the following JSON file: { "(0x0010, 0x0010)": { "action": "regexp", "find": ".", "replace": "ID001^ID002" }, "(0x0010, 0x0020)": { "action": "regexp", "find": ".", "replace": "ID003" }, } In the anonymized DICOM files, the PatientID tag gets set to ID003ID003 (i.e. it is duplicated). The PatientName tag is similarly duplicated and set to ID001^ID002ID001^ID002