GDCM  3.0.24
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
gdcm::Anonymizer Class Reference

Anonymizer. More...

#include <gdcmAnonymizer.h>

Inheritance diagram for gdcm::Anonymizer:
[legend]
Collaboration diagram for gdcm::Anonymizer:
[legend]

Public Member Functions

 Anonymizer ()
 
 ~Anonymizer () override
 
bool BasicApplicationLevelConfidentialityProfile (bool deidentify=true)
 
bool Clear (PrivateTag const &pt)
 
bool Clear (Tag const &t)
 Identical to 'Empty' except no action is done when tag is not present. More...
 
bool Empty (PrivateTag const &pt)
 
bool Empty (Tag const &t)
 Make Tag t empty (if not found tag will be created) More...
 
const CryptographicMessageSyntaxGetCryptographicMessageSyntax () const
 
FileGetFile ()
 
bool Remove (PrivateTag const &pt)
 
bool Remove (Tag const &t)
 remove a tag (even a SQ can be removed) More...
 
bool RemoveGroupLength ()
 Main function that loop over all elements and remove group length. More...
 
bool RemovePrivateTags ()
 Main function that loop over all elements and remove private tags. More...
 
bool RemoveRetired ()
 Main function that loop over all elements and remove retired element. More...
 
bool Replace (PrivateTag const &t, const char *value)
 
bool Replace (PrivateTag const &t, const char *value, VL const &vl)
 
bool Replace (Tag const &t, const char *value)
 
bool Replace (Tag const &t, const char *value, VL const &vl)
 
void SetCryptographicMessageSyntax (CryptographicMessageSyntax *cms)
 Set/Get CMS key that will be used to encrypt the dataset within BasicApplicationLevelConfidentialityProfile. More...
 
void SetFile (const File &f)
 Set/Get File. More...
 
- Public Member Functions inherited from gdcm::Subject
 Subject ()
 
 ~Subject () override
 
unsigned long AddObserver (const Event &event, Command *)
 
unsigned long AddObserver (const Event &event, Command *) const
 
CommandGetCommand (unsigned long tag)
 
bool HasObserver (const Event &event) const
 
void InvokeEvent (const Event &)
 
void InvokeEvent (const Event &) const
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
- Public Member Functions inherited from gdcm::Object
 Object ()
 
 Object (const Object &)
 Special requirement for copy/cstor, assignment operator. More...
 
virtual ~Object ()
 
void operator= (const Object &)
 
virtual void Print (std::ostream &) const
 

Static Public Member Functions

static void ClearInternalUIDs ()
 
static std::vector< TagGetBasicApplicationLevelConfidentialityProfileAttributes ()
 Return the list of Tag that will be considered when anonymizing a DICOM file. More...
 
static SmartPointer< AnonymizerNew ()
 for wrapped language: instantiate a reference counted object More...
 

Protected Member Functions

bool BALCPProtect (DataSet &ds, Tag const &tag, const IOD &iod)
 
bool CanEmptyTag (Tag const &tag, const IOD &iod) const
 
void RecurseDataSet (DataSet &ds)
 
- Protected Member Functions inherited from gdcm::Object
void Register ()
 
void UnRegister ()
 

Detailed Description

Anonymizer.

This class is a multi purpose anonymizer. It can work in 2 mode:

  1. dumb mode This is a dumb anonymizer implementation. All it allows user is simple operation such as:

Tag based functions:

DataSet based functions:

All function calls actually execute the user specified request. Previous implementation were calling a general Anonymize function but traversing a std::set is O(n) operation, while a simple user specified request is O(log(n)) operation. So 'm' user interaction is O(m*log(n)) which is < O(n) complexity.

  1. smart mode this mode implements the Basic Application Level Confidentiality Profile (DICOM PS 3.15-2008) In this case, it is extremely important to use the same Anonymizer class when anonymizing a FileSet. Once the Anonymizer is destroyed its memory of known (already processed) UIDs will be lost. which will make the anonymizer behaves incorrectly for attributes such as Series UID Study UID where user want some consistency. When attribute is Type 1 / Type 1C, a dummy generator will take in the existing value and produce a dummy value (a sha1 representation). sha1 algorithm is considered to be cryptographically strong (compared to md5sum) so that we meet the following two conditions:
    • Produce the same dummy value for the same input value
    • do not provide an easy way to retrieve the original value from the sha1 generated value

This class implement the Subject/Observer pattern trigger the following event:

See also
CryptographicMessageSyntax
Examples
ClinicalTrialAnnotate.cxx, CreateJPIPDataSet.cxx, and EncapsulateFileInRawData.cxx.

Constructor & Destructor Documentation

◆ Anonymizer()

gdcm::Anonymizer::Anonymizer ( )
inline

◆ ~Anonymizer()

gdcm::Anonymizer::~Anonymizer ( )
override

Member Function Documentation

◆ BALCPProtect()

bool gdcm::Anonymizer::BALCPProtect ( DataSet ds,
Tag const &  tag,
const IOD iod 
)
protected

◆ BasicApplicationLevelConfidentialityProfile()

bool gdcm::Anonymizer::BasicApplicationLevelConfidentialityProfile ( bool  deidentify = true)

PS 3.15 / E.1.1 De-Identifier An Application may claim conformance to the Basic Application Level Confidentiality Profile as a deidentifier if it protects all Attributes that might be used by unauthorized entities to identify the patient. NOT THREAD SAFE

◆ CanEmptyTag()

bool gdcm::Anonymizer::CanEmptyTag ( Tag const &  tag,
const IOD iod 
) const
protected

◆ Clear() [1/2]

bool gdcm::Anonymizer::Clear ( PrivateTag const &  pt)

◆ Clear() [2/2]

bool gdcm::Anonymizer::Clear ( Tag const &  t)

Identical to 'Empty' except no action is done when tag is not present.

◆ ClearInternalUIDs()

static void gdcm::Anonymizer::ClearInternalUIDs ( )
static

Clear the internal mapping of real UIDs to generated UIDs

Warning
the mapping is definitely lost

◆ Empty() [1/2]

bool gdcm::Anonymizer::Empty ( PrivateTag const &  pt)

Make PrivateTag pt empty (if not found tag will be created) Pay special attention that this code must be done before any call to Empty/Remove of the associated Private Creator, but before any call to Replace.

◆ Empty() [2/2]

bool gdcm::Anonymizer::Empty ( Tag const &  t)

Make Tag t empty (if not found tag will be created)

Examples
CreateJPIPDataSet.cxx.

◆ GetBasicApplicationLevelConfidentialityProfileAttributes()

static std::vector<Tag> gdcm::Anonymizer::GetBasicApplicationLevelConfidentialityProfileAttributes ( )
static

Return the list of Tag that will be considered when anonymizing a DICOM file.

Examples
GenFakeIdentifyFile.cxx, and TraverseModules.cxx.

◆ GetCryptographicMessageSyntax()

const CryptographicMessageSyntax* gdcm::Anonymizer::GetCryptographicMessageSyntax ( ) const

◆ GetFile()

File& gdcm::Anonymizer::GetFile ( )
inline

◆ New()

static SmartPointer<Anonymizer> gdcm::Anonymizer::New ( )
inlinestatic

for wrapped language: instantiate a reference counted object

◆ RecurseDataSet()

void gdcm::Anonymizer::RecurseDataSet ( DataSet ds)
protected

◆ Remove() [1/2]

bool gdcm::Anonymizer::Remove ( PrivateTag const &  pt)

remove a private tag (even a SQ can be removed) Pay special attention that this code must be done before any call to Empty/Remove of the associated Private Creator, but before any call to Replace. When the private reservation becomes empty, no check is done to automatically remove the private creator

◆ Remove() [2/2]

bool gdcm::Anonymizer::Remove ( Tag const &  t)

remove a tag (even a SQ can be removed)

◆ RemoveGroupLength()

bool gdcm::Anonymizer::RemoveGroupLength ( )

Main function that loop over all elements and remove group length.

Examples
ClinicalTrialAnnotate.cxx.

◆ RemovePrivateTags()

bool gdcm::Anonymizer::RemovePrivateTags ( )

Main function that loop over all elements and remove private tags.

Examples
ClinicalTrialAnnotate.cxx.

◆ RemoveRetired()

bool gdcm::Anonymizer::RemoveRetired ( )

Main function that loop over all elements and remove retired element.

◆ Replace() [1/4]

bool gdcm::Anonymizer::Replace ( PrivateTag const &  t,
const char *  value 
)

◆ Replace() [2/4]

bool gdcm::Anonymizer::Replace ( PrivateTag const &  t,
const char *  value,
VL const &  vl 
)

◆ Replace() [3/4]

bool gdcm::Anonymizer::Replace ( Tag const &  t,
const char *  value 
)

Replace tag with another value, if tag is not found it will be created: WARNING: this function can only execute if tag is a VRASCII

Examples
ClinicalTrialAnnotate.cxx, CreateJPIPDataSet.cxx, and EncapsulateFileInRawData.cxx.

◆ Replace() [4/4]

bool gdcm::Anonymizer::Replace ( Tag const &  t,
const char *  value,
VL const &  vl 
)

when the value contains \0, it is a good idea to specify the length. This function is required when dealing with VRBINARY tag

◆ SetCryptographicMessageSyntax()

void gdcm::Anonymizer::SetCryptographicMessageSyntax ( CryptographicMessageSyntax cms)

Set/Get CMS key that will be used to encrypt the dataset within BasicApplicationLevelConfidentialityProfile.

◆ SetFile()

void gdcm::Anonymizer::SetFile ( const File f)
inline

The documentation for this class was generated from the following file:

Generated on Fri May 3 2024 05:26:11 for GDCM by doxygen 1.9.1
SourceForge.net Logo