Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De-identify DICOM tags #237

Closed
vijaysubramanya opened this issue Feb 21, 2022 · 3 comments
Closed

De-identify DICOM tags #237

vijaysubramanya opened this issue Feb 21, 2022 · 3 comments

Comments

@vijaysubramanya
Copy link

vijaysubramanya commented Feb 21, 2022

I'm trying to update/de-identify some of the metadata tags (such as Patient ID). Is there a way to update the file directly without reading the file and writing back to the file? Currently, I'm reading the file into a variable, updating the elements, and writing back to a new file as below:

dataset, _ := dicom.ParseFile("dicom/1.dcm", nil)
    for _, elem := range dataset.Elements {
        s := reflect.TypeOf(elem.Value.GetValue()).Kind()
        if s == reflect.Slice {
            elem.Value, _ = dicom.NewValue([]string{"abc"})
        }
    }
    f, err := os.Open("test.dcm")
    err = dicom.Write(f, dataset)
    }
@vijaysubramanya
Copy link
Author

@suyashkumar @jstutters

@suyashkumar
Copy link
Owner

Hi there! At the moment, I'm not sure of a great way to safely update the file "in place" if that's what you want.

Something I would like to do is update the element-by-element parsing API (e.g. the Next() API on the parser) be more memory efficient by only holding onto the Dataset elements it needs for future parsing, and otherwise just transiently emitting the Elements one at a time.

@suyashkumar
Copy link
Owner

Closing this, as I think the question was answered re: in-place editing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants