Client side anonymization help

236 views
Skip to first unread message

Asim

unread,
Feb 25, 2021, 5:06:28 PM2/25/21
to cornerstone platform
I'm trying to perform some client side anonymization with DICOM parser but require user input for a field like PatientName for anonymization. I understand this can be problematic in the case that the provided values exceed the previous length of the field. How should i handle this scenario? The anonymization example says it would require "resizing the Uint8Array and updating the length". How should I be doing this?

Chris Hafey

unread,
Feb 25, 2021, 5:11:23 PM2/25/21
to Asim, cornerstone platform
The output of dicomParser is the offset of the data portion of each attribute in the data set.  If you change the length of the data during anonymization, you need to resize the buffer and move bytes around to fit.  For example, if the parsed data length is 10 bytes and you de-identify it to a 16 byte value, you need to allocate a buffer 6 bytes bigger than the original one and copy the old data up to the de-identified attribute over, then the new deidentified data element and then the remaining data after that.  I haven't actually done this before myself, but I think it should work!

On Thu, Feb 25, 2021 at 4:06 PM Asim <asimdot...@gmail.com> wrote:
I'm trying to perform some client side anonymization with DICOM parser but require user input for a field like PatientName for anonymization. I understand this can be problematic in the case that the provided values exceed the previous length of the field. How should i handle this scenario? The anonymization example says it would require "resizing the Uint8Array and updating the length". How should I be doing this?

--
You received this message because you are subscribed to the Google Groups "cornerstone platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cornerstone-plat...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cornerstone-platform/85c49d56-53c8-48f7-9756-5d2077fb2714n%40googlegroups.com.

Salim Kanoun

unread,
Feb 25, 2021, 5:49:09 PM2/25/21
to cornerstone platform

Hi,

When I will have more time, I wanted to try this way using dcmjs


If you land with a solution that you could share I would be interested

Salim

Todd Jensen

unread,
Feb 26, 2021, 2:47:52 PM2/26/21
to cornerstone platform
I've used the following for character type elements (keeps element length the same):

var element = dataSet.elements[tag];

var deIdentifiedValue = "SomeTextHere";

for(var i=0; i < element.length; i++) {

  var char = (deIdentifiedValue.length > i) ? deIdentifiedValue.charCodeAt(i) : '0';

  dataSet.byteArray[element.dataOffset + i] = char;

}


Todd Jensen, PhD

Jensen Informatics LLC

Salim Kanoun

unread,
Mar 7, 2021, 6:43:24 PM3/7/21
to cornerstone platform
hi,

I have some feedback about dcmjs,
my first implementation seems to work properly on the early tests, I confirm that client side edition is easier with dcmjs as you can add / edit / delete dicom Tag without having to care about low level issue such as byte allocation.

Here is my code in developpement :

Best regards,

Salim

Asim

unread,
Mar 9, 2021, 3:51:52 PM3/9/21
to cornerstone platform
Hey Salim,

Thank you for the snippet! I've translated it for my use case and it seems to be working well here

Cheers,
Asim

Reply all
Reply to author
Forward
0 new messages