This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

dicomanon

Anonymize DICOM file

Syntax

dicomanon(file_in,file_out)
dicomanon(___,'keep',fields)
dicomanon(___,'update',attributes)
dicomanon(___,Name,Value)

Description

example

dicomanon(file_in,file_out) removes confidential medical information from the DICOM file file_in and creates a new file file_out with the modified values. Image data and other attributes are unmodified.

dicomanon(___,'keep',fields) modifies all of the confidential data except for those listed in fields. This syntax is useful for keeping metadata that does not uniquely identify the patient but is useful for diagnostic purposes (such as PatientAge and PatientSex).

Note

Keeping certain fields might compromise patient confidentiality.

dicomanon(___,'update',attributes) modifies the confidential data and updates particular confidential data listed in attributes. Use this syntax to preserve the Study/Series/Image hierarchy or to replace a specific value with a more generic property (such as removing PatientBirthDate but keeping a computed PatientAge).

dicomanon(___,Name,Value) uses name-value pairs to provide additional options to the parser.

Examples

collapse all

Create a version of a DICOM file with all the personal information removed.

dicomanon('US-PAL-8-10x-echo.dcm','US-PAL-anonymized.dcm');

Create a version of a DICOM file with personal information removed, keeping certain fields that could be useful for training.

dicomanon('US-PAL-8-10x-echo.dcm','US-PAL-anonymized.dcm','keep',...
         {'PatientAge','PatientSex','StudyDescription'})

Anonymize a series of images, keeping the hierarchy.

values.StudyInstanceUID = dicomuid;
values.SeriesInstanceUID = dicomuid;
 
d = dir('*.dcm');
for p = 1:numel(d)
	dicomanon(d(p).name, sprintf('anon%d.dcm', p), ...
		'update', values)
end

Input Arguments

collapse all

Name of DICOM file to read, specified as a character vector or string scalar.

Data Types: char | string

Name of anonymized DICOM file to write, specified as a character vector or string scalar.

Data Types: char | string

Names of the fields to preserve, specified as a cell array of field names.

Names of the attributes to preserve, specified as a structure whose fields are attribute names. The structure values are the attribute values to preserve.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: dicomanon('CT-MONO2-16-ankle.dcm','CT-MONO2-16-ankle_anon.dcm','UseVRHeuristic',false)

Write nonstandard attributes to the anonymized file, specified as the comma-separated pair consisting of 'WritePrivate' and false or true.

When set to true, then dicomanon includes private extensions in the file, which could compromise patient confidentiality.

Data Types: logical

Read noncompliant DICOM files that switch value representation (VR) modes incorrectly, specified as the comma-separated pair consisting of 'UseVRHeuristic' and true or false.

When 'UseVRHeuristic' is true (the default), then dicomanon instructs the parser to use a heuristic to help read certain noncompliant files which switch value representation (VR) modes incorrectly. A small number of compliant files will not be read correctly. dicomanon displays a warning if the heuristic is employed. Set 'UseVRHeuristic' to false to read these compliant files. Compliant files are always written.

Data Types: logical

Tips

Introduced before R2006a