public abstract class ClinicalTrialsAttributes
extends java.lang.Object
An abstract class of static methods to support removing identifying attributes and adding Clinical Trials Patient, Study and Series Modules attributes.
UID attributes are handled specially, in that they may be kept, removed or remapped. Remapping means that any UID that is not standard (e.g., not a SOP Class, etc.) will be replaced consistently with another generated UID, such that when that UID is encountered again, the same replacement value will be used. The replacement mapping persists within the invocation of the JVM until it is explciitly flushed. A different JVM invocation will replace the UIDs with different values. Therefore, multiple instances that need to be remapped consistently must be cleaned within the same invocation.
Note that this map could grow quite large and consumes resources in memory, and hence in a server application should be flushed at appropriate intervals using the appropriate method.
Modifier and Type | Class and Description |
---|---|
class |
ClinicalTrialsAttributes.HandleDates |
class |
ClinicalTrialsAttributes.HandleStructuredContent |
class |
ClinicalTrialsAttributes.HandleUIDs |
Modifier and Type | Method and Description |
---|---|
static void |
addAgeDerivedFromBirthDateAndStudyRelatedDate(AttributeList list)
Add the Patient's Age derived from the Patient's Birth Date and study-related date.
|
static void |
addClinicalTrialsAttributes(AttributeList list,
boolean replaceConventionalAttributes,
java.lang.String clinicalTrialSponsorName,
java.lang.String clinicalTrialProtocolID,
java.lang.String clinicalTrialProtocolName,
java.lang.String clinicalTrialSiteID,
java.lang.String clinicalTrialSiteName,
java.lang.String clinicalTrialSubjectID,
java.lang.String clinicalTrialSubjectReadingID,
java.lang.String clinicalTrialTimePointID,
java.lang.String clinicalTrialTimePointDescription,
java.lang.String clinicalTrialCoordinatingCenterName)
Add the attributes of the Clinical Trials Patient, Study and Series Modules, to a list of attributes.
|
static void |
addContributingEquipmentSequence(AttributeList list,
boolean retainExistingItems,
CodedSequenceItem purposeOfReferenceCodeSequence,
java.lang.String manufacturer,
java.lang.String institutionName,
java.lang.String institutionalDepartmentName,
CodedSequenceItem institutionalDepartmentTypeCodeSequence,
java.lang.String institutionAddress,
java.lang.String stationName,
java.lang.String manufacturerModelName,
java.lang.String deviceSerialNumber,
java.lang.String softwareVersion,
java.lang.String contributionDescription,
java.lang.String contributionDateTime,
java.lang.String[] operatorNames,
PersonIdentification[] operatorIdentifications)
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
|
static void |
addContributingEquipmentSequence(AttributeList list,
boolean retainExistingItems,
CodedSequenceItem purposeOfReferenceCodeSequence,
java.lang.String manufacturer,
java.lang.String institutionName,
java.lang.String institutionalDepartmentName,
java.lang.String institutionAddress,
java.lang.String stationName,
java.lang.String manufacturerModelName,
java.lang.String deviceSerialNumber,
java.lang.String softwareVersion,
java.lang.String contributionDescription)
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
|
static void |
addContributingEquipmentSequence(AttributeList list,
boolean retainExistingItems,
CodedSequenceItem purposeOfReferenceCodeSequence,
java.lang.String manufacturer,
java.lang.String institutionName,
java.lang.String institutionalDepartmentName,
java.lang.String institutionAddress,
java.lang.String stationName,
java.lang.String manufacturerModelName,
java.lang.String deviceSerialNumber,
java.lang.String softwareVersion,
java.lang.String contributionDescription,
java.lang.String contributionDateTime)
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
|
static void |
addContributingEquipmentSequence(AttributeList list,
boolean retainExistingItems,
CodedSequenceItem purposeOfReferenceCodeSequence,
java.lang.String manufacturer,
java.lang.String institutionName,
java.lang.String institutionalDepartmentName,
java.lang.String institutionAddress,
java.lang.String stationName,
java.lang.String manufacturerModelName,
java.lang.String deviceSerialNumber,
java.lang.String softwareVersion,
java.lang.String contributionDescription,
java.lang.String contributionDateTime,
java.lang.String[] operatorNames,
PersonIdentification[] operatorIdentifications)
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
|
static void |
addContributingEquipmentSequence(AttributeList list,
java.lang.String manufacturer,
java.lang.String institutionName,
java.lang.String institutionalDepartmentName,
java.lang.String institutionAddress,
java.lang.String stationName,
java.lang.String manufacturerModelName,
java.lang.String deviceSerialNumber,
java.lang.String softwareVersion)
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
|
protected static void |
addType1LongStringAttribute(AttributeList list,
AttributeTag t,
java.lang.String value,
SpecificCharacterSet specificCharacterSet) |
protected static void |
addType2LongStringAttribute(AttributeList list,
AttributeTag t,
java.lang.String value,
SpecificCharacterSet specificCharacterSet) |
protected static void |
addType3DateTimeAttribute(AttributeList list,
AttributeTag t,
java.lang.String value) |
protected static void |
addType3LongStringAttribute(AttributeList list,
AttributeTag t,
java.lang.String value,
SpecificCharacterSet specificCharacterSet) |
protected static void |
addType3ShortStringAttribute(AttributeList list,
AttributeTag t,
java.lang.String value,
SpecificCharacterSet specificCharacterSet) |
protected static void |
addType3ShortTextAttribute(AttributeList list,
AttributeTag t,
java.lang.String value,
SpecificCharacterSet specificCharacterSet) |
static java.util.Date |
findEarliestDateTime(AttributeList list)
Get the earliest patient event related date and time.
|
protected static java.util.Date |
findEarliestDateTime(AttributeList list,
java.util.Date earliestSoFar,
java.lang.String dateToUseForUnaccompaniedTimes)
Get the earliest patient event related date and time.
|
static void |
flushMapOfUIDs()
Flush (remove all entries in) the map of original UIDs to replacement UIDs.
|
static java.util.Date |
getDateOffsetByEarliestMovedToEpoch(java.util.Date existingDate,
java.util.Date epochForDateModification,
java.util.Date earliest)
Move the date and time by the offset from the earliest date to the epoch.
|
static java.lang.String |
getDateToUseForUnaccompaniedTimes(AttributeList list)
Get the date to use for time attributes that don't have a date sibling and which may be nested in sequences.
|
static java.util.Map<java.lang.String,java.lang.String> |
getMapOfOriginalToReplacementUIDs()
Get the map of original UIDs to replacement UIDs.
|
static AttributeTag |
getTagOfTimeAttributeCorrespondingToDateAttribute(AttributeTag dateTag)
Get the Time Attribute corresponding to the Date Attribute.
|
static boolean |
isSafePrivateAttribute(AttributeTag tag,
AttributeList list)
Is a private tag safe?
|
static boolean |
isSafePrivateAttribute(java.lang.String creator,
AttributeTag tag)
Is a private tag safe?
|
static boolean |
isSafePrivateSequenceAttribute(java.lang.String creator,
AttributeTag tag)
Is a private tag a safe sequence VR that needs to be read as SQ if UN.
|
protected static boolean |
isValidCandidateForEarliestDateTime(java.util.Date candidate) |
static void |
main(java.lang.String[] arg)
For testing.
|
static void |
remapUIDAttributes(AttributeList list)
Remap UID attributes in a list of attributes, recursively iterating through nested sequences.
|
static void |
removeClinicalTrialsAttributes(AttributeList list)
Remove the attributes of the Clinical Trials Patient, Study and Series Modules, from a list of attributes.
|
protected static void |
removeOrCleanStructuredContent(AttributeList list,
int handleStructuredContent,
boolean keepDescriptors,
boolean keepSeriesDescriptors,
boolean keepProtocolName,
boolean keepPatientCharacteristics,
boolean keepDeviceIdentity,
boolean keepInstitutionIdentity,
int handleUIDs,
int handleDates)
Remove or clean structured content including the SR content tree (whether an SR object or not) in a list of attributes, recursively iterating through nested sequences.
|
static void |
removeOrNullIdentifyingAttributes(AttributeList list,
boolean keepUIDs,
boolean keepDescriptors,
boolean keepPatientCharacteristics)
De-identify a list of attributes.
|
static void |
removeOrNullIdentifyingAttributes(AttributeList list,
int handleUIDs,
boolean keepDescriptors,
boolean keepPatientCharacteristics)
De-identify a list of attributes.
|
static void |
removeOrNullIdentifyingAttributes(AttributeList list,
int handleUIDs,
boolean keepDescriptors,
boolean keepSeriesDescriptors,
boolean keepPatientCharacteristics,
boolean keepDeviceIdentity,
boolean keepInstitutionIdentity)
De-identify a list of attributes.
|
static void |
removeOrNullIdentifyingAttributes(AttributeList list,
int handleUIDs,
boolean keepDescriptors,
boolean keepSeriesDescriptors,
boolean keepProtocolName,
boolean keepPatientCharacteristics,
boolean keepDeviceIdentity,
boolean keepInstitutionIdentity,
int handleDates,
java.util.Date epochForDateModification,
java.util.Date earliestDateInSet)
De-identify a list of attributes.
|
static void |
removeOrNullIdentifyingAttributes(AttributeList list,
int handleUIDs,
boolean keepDescriptors,
boolean keepSeriesDescriptors,
boolean keepProtocolName,
boolean keepPatientCharacteristics,
boolean keepDeviceIdentity,
boolean keepInstitutionIdentity,
int handleDates,
java.util.Date epochForDateModification,
java.util.Date earliestDateInSet,
int handleStructuredContent)
De-identify a list of attributes.
|
static void |
removeOrNullIdentifyingAttributes(AttributeList list,
int handleUIDs,
boolean keepDescriptors,
boolean keepSeriesDescriptors,
boolean keepProtocolName,
boolean keepPatientCharacteristics,
boolean keepDeviceIdentity,
boolean keepInstitutionIdentity,
int handleDates,
java.util.Date epochForDateModification,
java.util.Date earliestDateInSet,
int handleStructuredContent,
boolean aggregateAgesOver89)
De-identify a list of attributes.
|
static void |
removeOrNullIdentifyingAttributes(AttributeList list,
int handleUIDs,
boolean keepDescriptors,
boolean keepSeriesDescriptors,
boolean keepPatientCharacteristics,
boolean keepDeviceIdentity,
boolean keepInstitutionIdentity,
int handleDates,
java.util.Date epochForDateModification,
java.util.Date earliestDateInSet)
De-identify a list of attributes.
|
protected static void |
removeOrNullIdentifyingAttributesRecursively(AttributeList list,
int handleUIDs,
boolean keepDescriptors,
boolean keepSeriesDescriptors,
boolean keepProtocolName,
boolean keepPatientCharacteristics,
boolean keepDeviceIdentity,
boolean keepInstitutionIdentity,
boolean aggregateAgesOver89)
De-identify a list of attributes, recursively iterating through nested sequences.
|
protected static void |
removeOrRemapDateAndTimeAttributes(AttributeList list,
int handleDates,
java.util.Date epochForDateModification,
java.util.Date earliest,
java.lang.String dateToUseForUnaccompaniedTimes)
Remove or remap Date, Time and DateTime attributes (other than Patient Birth) in a list of attributes, recursively iterating through nested sequences.
|
protected static void |
removeOrRemapUIDAttributes(AttributeList list,
int handleUIDs)
Remove or remap UID attributes in a list of attributes, recursively iterating through nested sequences.
|
protected static void |
removeStructuredContent(AttributeList list) |
static void |
removeUIDAttributes(AttributeList list)
Remove UID attributes in a list of attributes, recursively iterating through nested sequences.
|
public static final java.lang.String defaultValueForMissingNonZeroLengthStrings
public static final java.lang.String defaultValueForMissingPossiblyZeroLengthStrings
protected static final DicomDictionary dictionary
protected static java.util.Map mapOfOriginalToReplacementUIDs
public static final java.lang.String replacementForAgeString
public static final java.lang.String replacementForContainerIdentifier
public static final java.lang.String replacementForContentCreatorName
public static final java.lang.String replacementForDateInStructuredContent
public static final java.lang.String replacementForDateTimeInStructuredContent
public static final java.lang.String replacementForDescriptionOrLabel
public static final java.lang.String replacementForDetectorID
public static final java.lang.String replacementForDeviceSerialNumber
public static final java.lang.String replacementForPersonNameInStructuredContent
public static final java.lang.String replacementForSpecimenIdentifier
public static final java.lang.String replacementForTextInStructuredContent
public static final java.lang.String replacementForTimeInStructuredContent
public static final java.lang.String replacementForVerifyingObserverName
public static final java.lang.String replacementForVerifyingOrganization
protected static UIDGenerator uidGenerator
public static void addAgeDerivedFromBirthDateAndStudyRelatedDate(AttributeList list)
Add the Patient's Age derived from the Patient's Birth Date and study-related date.
Does nothing if no value for Patient's Birth Date.
Uses the Study, Series, Acquisition or Content Date in that order if present, else does nothing.
list
- the list of attributes in which to find the dob and date and to which to add the agepublic static void addClinicalTrialsAttributes(AttributeList list, boolean replaceConventionalAttributes, java.lang.String clinicalTrialSponsorName, java.lang.String clinicalTrialProtocolID, java.lang.String clinicalTrialProtocolName, java.lang.String clinicalTrialSiteID, java.lang.String clinicalTrialSiteName, java.lang.String clinicalTrialSubjectID, java.lang.String clinicalTrialSubjectReadingID, java.lang.String clinicalTrialTimePointID, java.lang.String clinicalTrialTimePointDescription, java.lang.String clinicalTrialCoordinatingCenterName) throws DicomException
Add the attributes of the Clinical Trials Patient, Study and Series Modules, to a list of attributes.
list
- the list of attributes to which to add the attributesreplaceConventionalAttributes
- if true, use the supplied clinical trials attributes in place of the conventional ID attributes as wellclinicalTrialSponsorName
- the sponsor nameclinicalTrialProtocolID
- the protocol IDclinicalTrialProtocolName
- the protocol nameclinicalTrialSiteID
- the site IDclinicalTrialSiteName
- the site nameclinicalTrialSubjectID
- the subject IDclinicalTrialSubjectReadingID
- the subject reading IDclinicalTrialTimePointID
- the time point IDclinicalTrialTimePointDescription
- the time point descriptionclinicalTrialCoordinatingCenterName
- the coordinating center nameDicomException
- if error in DICOM encodingpublic static void addContributingEquipmentSequence(AttributeList list, boolean retainExistingItems, CodedSequenceItem purposeOfReferenceCodeSequence, java.lang.String manufacturer, java.lang.String institutionName, java.lang.String institutionalDepartmentName, CodedSequenceItem institutionalDepartmentTypeCodeSequence, java.lang.String institutionAddress, java.lang.String stationName, java.lang.String manufacturerModelName, java.lang.String deviceSerialNumber, java.lang.String softwareVersion, java.lang.String contributionDescription, java.lang.String contributionDateTime, java.lang.String[] operatorNames, PersonIdentification[] operatorIdentifications) throws DicomException
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
Attributes are added if supplied string value are added if not null. May be zero length.
list
- the list of attributes to which to add the Contributing Equipment SequenceretainExistingItems
- if true, retain any existing items in Contributing Equipment Sequence, otherwise remove thempurposeOfReferenceCodeSequence
- the purpose of referencemanufacturer
- the manufacturerinstitutionName
- the institution nameinstitutionalDepartmentName
- the institution department nameinstitutionalDepartmentTypeCodeSequence
- the institution department typeinstitutionAddress
- the institution addressstationName
- the station namemanufacturerModelName
- the manufacturer model namedeviceSerialNumber
- the device serial numbersoftwareVersion
- the software versioncontributionDescription
- the contribution descriptioncontributionDateTime
- the contribution datetimeoperatorNames
- an array of Strings of one or more operator's names, or null if not to be addedoperatorIdentifications
- an array of PersonIdentification
, or null if not to be addedDicomException
- if error in DICOM encodingpublic static void addContributingEquipmentSequence(AttributeList list, boolean retainExistingItems, CodedSequenceItem purposeOfReferenceCodeSequence, java.lang.String manufacturer, java.lang.String institutionName, java.lang.String institutionalDepartmentName, java.lang.String institutionAddress, java.lang.String stationName, java.lang.String manufacturerModelName, java.lang.String deviceSerialNumber, java.lang.String softwareVersion, java.lang.String contributionDescription) throws DicomException
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
Attributes are added if supplied string value are added if not null. May be zero length.
list
- the list of attributes to which to add the Contributing Equipment SequenceretainExistingItems
- if true, retain any existing items in Contributing Equipment Sequence, otherwise remove thempurposeOfReferenceCodeSequence
- the purpose of referencemanufacturer
- the manufacturerinstitutionName
- the institution nameinstitutionalDepartmentName
- the institution department nameinstitutionAddress
- the institution addressstationName
- the station namemanufacturerModelName
- the manufacturer model namedeviceSerialNumber
- the device serial numbersoftwareVersion
- the software versioncontributionDescription
- the contribution descriptionDicomException
- if error in DICOM encodingpublic static void addContributingEquipmentSequence(AttributeList list, boolean retainExistingItems, CodedSequenceItem purposeOfReferenceCodeSequence, java.lang.String manufacturer, java.lang.String institutionName, java.lang.String institutionalDepartmentName, java.lang.String institutionAddress, java.lang.String stationName, java.lang.String manufacturerModelName, java.lang.String deviceSerialNumber, java.lang.String softwareVersion, java.lang.String contributionDescription, java.lang.String contributionDateTime) throws DicomException
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
Attributes are added if supplied string value are added if not null. May be zero length.
list
- the list of attributes to which to add the Contributing Equipment SequenceretainExistingItems
- if true, retain any existing items in Contributing Equipment Sequence, otherwise remove thempurposeOfReferenceCodeSequence
- the purpose of referencemanufacturer
- the manufacturerinstitutionName
- the institution nameinstitutionalDepartmentName
- the institution department nameinstitutionAddress
- the institution addressstationName
- the station namemanufacturerModelName
- the manufacturer model namedeviceSerialNumber
- the device serial numbersoftwareVersion
- the software versioncontributionDescription
- the contribution descriptioncontributionDateTime
- the contribution datetimeDicomException
- if error in DICOM encodingpublic static void addContributingEquipmentSequence(AttributeList list, boolean retainExistingItems, CodedSequenceItem purposeOfReferenceCodeSequence, java.lang.String manufacturer, java.lang.String institutionName, java.lang.String institutionalDepartmentName, java.lang.String institutionAddress, java.lang.String stationName, java.lang.String manufacturerModelName, java.lang.String deviceSerialNumber, java.lang.String softwareVersion, java.lang.String contributionDescription, java.lang.String contributionDateTime, java.lang.String[] operatorNames, PersonIdentification[] operatorIdentifications) throws DicomException
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
Attributes are added if supplied string value are added if not null. May be zero length.
list
- the list of attributes to which to add the Contributing Equipment SequenceretainExistingItems
- if true, retain any existing items in Contributing Equipment Sequence, otherwise remove thempurposeOfReferenceCodeSequence
- the purpose of referencemanufacturer
- the manufacturerinstitutionName
- the institution nameinstitutionalDepartmentName
- the institution department nameinstitutionAddress
- the institution addressstationName
- the station namemanufacturerModelName
- the manufacturer model namedeviceSerialNumber
- the device serial numbersoftwareVersion
- the software versioncontributionDescription
- the contribution descriptioncontributionDateTime
- the contribution datetimeoperatorNames
- an array of Strings of one or more operator's names, or null if not to be addedoperatorIdentifications
- an array of PersonIdentification
, or null if not to be addedDicomException
- if error in DICOM encodingpublic static void addContributingEquipmentSequence(AttributeList list, java.lang.String manufacturer, java.lang.String institutionName, java.lang.String institutionalDepartmentName, java.lang.String institutionAddress, java.lang.String stationName, java.lang.String manufacturerModelName, java.lang.String deviceSerialNumber, java.lang.String softwareVersion) throws DicomException
Add the attributes of the Contributing Equipment Sequence to a list of attributes.
Attributes are added if supplied string value are added if not null. May be zero length.
Retains any existing items in Contributing Equipment Sequence.
Uses ("109104","DCM","De-identifying Equipment")
for the Purpose of Reference.
Uses "Deidentified"
for the Contribution Description.
Uses the current date and time for the Contribution DateTime.
list
- the list of attributes to which to add the Contributing Equipment Sequencemanufacturer
- the manufacturerinstitutionName
- the institution nameinstitutionalDepartmentName
- the institution department nameinstitutionAddress
- the institution addressstationName
- the station namemanufacturerModelName
- the manufacturer model namedeviceSerialNumber
- the device serial numbersoftwareVersion
- the software versionDicomException
- if error in DICOM encodingprotected static void addType1LongStringAttribute(AttributeList list, AttributeTag t, java.lang.String value, SpecificCharacterSet specificCharacterSet) throws DicomException
DicomException
protected static void addType2LongStringAttribute(AttributeList list, AttributeTag t, java.lang.String value, SpecificCharacterSet specificCharacterSet) throws DicomException
DicomException
protected static void addType3DateTimeAttribute(AttributeList list, AttributeTag t, java.lang.String value) throws DicomException
DicomException
protected static void addType3LongStringAttribute(AttributeList list, AttributeTag t, java.lang.String value, SpecificCharacterSet specificCharacterSet) throws DicomException
DicomException
protected static void addType3ShortStringAttribute(AttributeList list, AttributeTag t, java.lang.String value, SpecificCharacterSet specificCharacterSet) throws DicomException
DicomException
protected static void addType3ShortTextAttribute(AttributeList list, AttributeTag t, java.lang.String value, SpecificCharacterSet specificCharacterSet) throws DicomException
DicomException
public static java.util.Date findEarliestDateTime(AttributeList list)
Get the earliest patient event related date and time.
Ignores equipment related dates like calibration, patient related dates like birth date, and non-patient instance related dates like effective and information issue.
list
- the list of attributes from the top level data setprotected static java.util.Date findEarliestDateTime(AttributeList list, java.util.Date earliestSoFar, java.lang.String dateToUseForUnaccompaniedTimes)
Get the earliest patient event related date and time.
Ignores equipment related dates like calibration, patient related dates like birth date, and non-patient instance related dates like effective and information issue.
list
- the list of attributes from the top level data setearliestSoFar
- for recursiondateToUseForUnaccompaniedTimes
- the date to use for time attributes that don't have a date siblingpublic static void flushMapOfUIDs()
Flush (remove all entries in) the map of original UIDs to replacement UIDs.
public static java.util.Date getDateOffsetByEarliestMovedToEpoch(java.util.Date existingDate, java.util.Date epochForDateModification, java.util.Date earliest)
Move the date and time by the offset from the earliest date to the epoch.
existingDate
- epochForDateModification
- earliest
- public static java.lang.String getDateToUseForUnaccompaniedTimes(AttributeList list)
Get the date to use for time attributes that don't have a date sibling and which may be nested in sequences.
E.g., to use with RadiopharmaceuticalStartTime.
list
- the list of attributes from the top level data setpublic static java.util.Map<java.lang.String,java.lang.String> getMapOfOriginalToReplacementUIDs()
Get the map of original UIDs to replacement UIDs.
public static AttributeTag getTagOfTimeAttributeCorrespondingToDateAttribute(AttributeTag dateTag)
Get the Time Attribute corresponding to the Date Attribute.
dateTag
- public static boolean isSafePrivateAttribute(AttributeTag tag, AttributeList list)
Is a private tag safe?
Safe private attributes are all those that are known not to contain individually identifiable information.
Private creators are always considered safe.
Private transient UIDs are also considered "safe", since they can then be removed/remapped based in a subsequent step.
tag
- the tag in questionlist
- the list in which the tag is contained from which the private creator can be extractedpublic static boolean isSafePrivateAttribute(java.lang.String creator, AttributeTag tag)
Is a private tag safe?
Safe private attributes are all those that are known not to contain individually identifiable informationR.
Private creators are always considered safe, though there is no point in calling this method for private creator tags ... use AttributeTag.isPrivateCreator() instead.
Private transient UIDs are also considered "safe", since they can then be removed/remapped based in a subsequent step.
creator
- the private creator of the block containing the tagtag
- the tag in questionpublic static boolean isSafePrivateSequenceAttribute(java.lang.String creator, AttributeTag tag)
Is a private tag a safe sequence VR that needs to be read as SQ if UN.
creator
- the private creator of the block containing the tagtag
- the tag in questionprotected static boolean isValidCandidateForEarliestDateTime(java.util.Date candidate)
public static void main(java.lang.String[] arg)
For testing.
Read a DICOM object from the file specified on the command line, and remove identifying attributes, and add sample clinical trials attributes.
arg
- two arguments, a DICOM input file and a DICOM output filepublic static void remapUIDAttributes(AttributeList list) throws DicomException
Remap UID attributes in a list of attributes, recursively iterating through nested sequences.
list
- the list of attributes to be cleaned upDicomException
- if error in DICOM encodingpublic static void removeClinicalTrialsAttributes(AttributeList list)
Remove the attributes of the Clinical Trials Patient, Study and Series Modules, from a list of attributes.
list
- the list of attributes from which to remove the attributesprotected static void removeOrCleanStructuredContent(AttributeList list, int handleStructuredContent, boolean keepDescriptors, boolean keepSeriesDescriptors, boolean keepProtocolName, boolean keepPatientCharacteristics, boolean keepDeviceIdentity, boolean keepInstitutionIdentity, int handleUIDs, int handleDates) throws DicomException
Remove or clean structured content including the SR content tree (whether an SR object or not) in a list of attributes, recursively iterating through nested sequences.
list
- the list of attributes to be cleaned uphandleStructuredContent
- keep, remove or modify structured contentkeepDescriptors
- if true, keep the text description and comment attributeskeepSeriesDescriptors
- if true, keep the series description even if all other descriptors are removedkeepProtocolName
- if true, keep protocol name even if all other descriptors are removedkeepPatientCharacteristics
- if true, keep patient characteristics (such as might be needed for PET SUV calculations)keepDeviceIdentity
- if true, keep device identitykeepInstitutionIdentity
- if true, keep institution identityhandleUIDs
- remove or remap the UIDshandleDates
- keep, remove or modify dates and timesDicomException
- if error in DICOM encodingpublic static void removeOrNullIdentifyingAttributes(AttributeList list, boolean keepUIDs, boolean keepDescriptors, boolean keepPatientCharacteristics) throws DicomException
De-identify a list of attributes.
De-identifies attributes within nested sequences, other than Context Sequence.
Handles UIDs as requested, including within nested sequences, including Context Sequence.
Leaves dates and times alone (other than Patient Birth).
Does not de-identify any specific content items in structured content, e.g., within Content Sequence.
Also adds record that de-identification has been performed.
list
- the list of attributes to be cleaned upkeepUIDs
- if true, keep the UIDskeepDescriptors
- if true, keep the text description and comment attributeskeepPatientCharacteristics
- if true, keep patient characteristics (such as might be needed for PET SUV calculations)DicomException
- if error in DICOM encodingpublic static void removeOrNullIdentifyingAttributes(AttributeList list, int handleUIDs, boolean keepDescriptors, boolean keepPatientCharacteristics) throws DicomException
De-identify a list of attributes.
De-identifies attributes within nested sequences, other than Context Sequence.
Handles UIDs as requested, including within nested sequences, including Context Sequence.
Leaves dates and times alone (other than Patient Birth).
Does not de-identify any specific content items in structured content, e.g., within Content Sequence.
Also adds record that de-identification has been performed.
list
- the list of attributes to be cleaned uphandleUIDs
- keep, remove or remap the UIDskeepDescriptors
- if true, keep the text description and comment attributeskeepPatientCharacteristics
- if true, keep patient characteristics (such as might be needed for PET SUV calculations)DicomException
- if error in DICOM encodingpublic static void removeOrNullIdentifyingAttributes(AttributeList list, int handleUIDs, boolean keepDescriptors, boolean keepSeriesDescriptors, boolean keepPatientCharacteristics, boolean keepDeviceIdentity, boolean keepInstitutionIdentity) throws DicomException
De-identify a list of attributes.
De-identifies attributes within nested sequences, other than Context Sequence.
Handles UIDs as requested, including within nested sequences, including Context Sequence.
Leaves dates and times alone (other than Patient Birth).
Does not de-identify any specific content items in structured content, e.g., within Content Sequence.
Also adds record that de-identification has been performed.
list
- the list of attributes to be cleaned uphandleUIDs
- keep, remove or remap the UIDskeepDescriptors
- if true, keep the text description and comment attributeskeepSeriesDescriptors
- if true, keep the series description even if all other descriptors are removedkeepPatientCharacteristics
- if true, keep patient characteristics (such as might be needed for PET SUV calculations)keepDeviceIdentity
- if true, keep device identitykeepInstitutionIdentity
- if true, keep institution identityDicomException
- if error in DICOM encodingpublic static void removeOrNullIdentifyingAttributes(AttributeList list, int handleUIDs, boolean keepDescriptors, boolean keepSeriesDescriptors, boolean keepProtocolName, boolean keepPatientCharacteristics, boolean keepDeviceIdentity, boolean keepInstitutionIdentity, int handleDates, java.util.Date epochForDateModification, java.util.Date earliestDateInSet) throws DicomException
De-identify a list of attributes.
De-identifies attributes within nested sequences.
Handles UIDs as requested, including within nested sequences, including Content Sequence.
Handles dates and times as requested (other than Patient Birth), including within nested sequences, including Content Sequence.
Does not de-identify any specific content items in structured content, e.g., within Content Sequence.
Also adds record that de-identification has been performed.
list
- the list of attributes to be cleaned uphandleUIDs
- keep, remove or remap the UIDskeepDescriptors
- if true, keep the text description and comment attributeskeepSeriesDescriptors
- if true, keep the series description even if all other descriptors are removedkeepProtocolName
- if true, keep protocol name even if all other descriptors are removedkeepPatientCharacteristics
- if true, keep patient characteristics (such as might be needed for PET SUV calculations)keepDeviceIdentity
- if true, keep device identitykeepInstitutionIdentity
- if true, keep institution identityhandleDates
- keep, remove or modify dates and timesepochForDateModification
- the epoch to which to move the earliest date, used if handleDates is modify dates, otherwise nullearliestDateInSet
- the known earliest date to move to the specified epoch, used if handleDates is modify dates, otherwise null; if null, the earliest in the supplied list is used; MUST be the earliest date and time else unaccompanied time attributes may cross midnightDicomException
- if error in DICOM encodingpublic static void removeOrNullIdentifyingAttributes(AttributeList list, int handleUIDs, boolean keepDescriptors, boolean keepSeriesDescriptors, boolean keepProtocolName, boolean keepPatientCharacteristics, boolean keepDeviceIdentity, boolean keepInstitutionIdentity, int handleDates, java.util.Date epochForDateModification, java.util.Date earliestDateInSet, int handleStructuredContent) throws DicomException
De-identify a list of attributes.
De-identifies attributes within nested sequences.
Handles UIDs as requested, including within nested sequences, including Content Sequence.
Handles dates and times as requested (other than Patient Birth), including within nested sequences, including Content Sequence.
Handles structured content as requested, including within nested sequences, including (and not just confined to) Content Sequence.
Also adds record that de-identification has been performed.
list
- the list of attributes to be cleaned uphandleUIDs
- keep, remove or remap the UIDskeepDescriptors
- if true, keep the text description and comment attributeskeepSeriesDescriptors
- if true, keep the series description even if all other descriptors are removedkeepProtocolName
- if true, keep protocol name even if all other descriptors are removedkeepPatientCharacteristics
- if true, keep patient characteristics (such as might be needed for PET SUV calculations)keepDeviceIdentity
- if true, keep device identitykeepInstitutionIdentity
- if true, keep institution identityhandleDates
- keep, remove or modify dates and timesepochForDateModification
- the epoch to which to move the earliest date, used if handleDates is modify dates, otherwise nullearliestDateInSet
- the known earliest date to move to the specified epoch, used if handleDates is modify dates, otherwise null; if null, the earliest in the supplied list is used; MUST be the earliest date and time else unaccompanied time attributes may cross midnighthandleStructuredContent
- keep, remove or modify structured contentDicomException
- if error in DICOM encodingpublic static void removeOrNullIdentifyingAttributes(AttributeList list, int handleUIDs, boolean keepDescriptors, boolean keepSeriesDescriptors, boolean keepProtocolName, boolean keepPatientCharacteristics, boolean keepDeviceIdentity, boolean keepInstitutionIdentity, int handleDates, java.util.Date epochForDateModification, java.util.Date earliestDateInSet, int handleStructuredContent, boolean aggregateAgesOver89) throws DicomException
De-identify a list of attributes.
De-identifies attributes within nested sequences.
Handles UIDs as requested, including within nested sequences, including Content Sequence.
Handles dates and times as requested (other than Patient Birth), including within nested sequences, including Content Sequence.
Can optionally group ages over 89 years into single age of 90 as per HIPAA PR ยง164.514(b)(2)(i)(C).
Handles structured content as requested, including within nested sequences, including (and not just confined to) Content Sequence.
Also adds record that de-identification has been performed.
list
- the list of attributes to be cleaned uphandleUIDs
- keep, remove or remap the UIDskeepDescriptors
- if true, keep the text description and comment attributeskeepSeriesDescriptors
- if true, keep the series description even if all other descriptors are removedkeepProtocolName
- if true, keep protocol name even if all other descriptors are removedkeepPatientCharacteristics
- if true, keep patient characteristics (such as might be needed for PET SUV calculations)keepDeviceIdentity
- if true, keep device identitykeepInstitutionIdentity
- if true, keep institution identityhandleDates
- keep, remove or modify dates and timesepochForDateModification
- the epoch to which to move the earliest date, used if handleDates is modify dates, otherwise nullearliestDateInSet
- the known earliest date to move to the specified epoch, used if handleDates is modify dates, otherwise null; if null, the earliest in the supplied list is used; MUST be the earliest date and time else unaccompanied time attributes may cross midnighthandleStructuredContent
- keep, remove or modify structured contentaggregateAgesOver89
- if true, and keepPatientCharacteristics true, combine patient ages over 89 years into single 90 year categoryDicomException
- if error in DICOM encodingpublic static void removeOrNullIdentifyingAttributes(AttributeList list, int handleUIDs, boolean keepDescriptors, boolean keepSeriesDescriptors, boolean keepPatientCharacteristics, boolean keepDeviceIdentity, boolean keepInstitutionIdentity, int handleDates, java.util.Date epochForDateModification, java.util.Date earliestDateInSet) throws DicomException
De-identify a list of attributes.
De-identifies attributes within nested sequences, other than Context Sequence.
Handles UIDs as requested, including within nested sequences, including Context Sequence.
Handles dates and times as requested (other than Patient Birth), including within nested sequences, including Context Sequence.
Does not de-identify any specific content items in structured content, e.g., within Content Sequence.
Also adds record that de-identification has been performed.
list
- the list of attributes to be cleaned uphandleUIDs
- keep, remove or remap the UIDskeepDescriptors
- if true, keep the text description and comment attributeskeepSeriesDescriptors
- if true, keep the series description even if all other descriptors are removedkeepPatientCharacteristics
- if true, keep patient characteristics (such as might be needed for PET SUV calculations)keepDeviceIdentity
- if true, keep device identitykeepInstitutionIdentity
- if true, keep institution identityhandleDates
- keep, remove or modify dates and timesepochForDateModification
- the epoch to which to move the earliest date, used if handleDates is modify dates, otherwise nullearliestDateInSet
- the known earliest date to move to the specified epoch, used if handleDates is modify dates, otherwise null; if null, the earliest in the supplied list is used; MUST be the earliest date and time else unaccompanied time attributes may cross midnightDicomException
- if error in DICOM encodingprotected static void removeOrNullIdentifyingAttributesRecursively(AttributeList list, int handleUIDs, boolean keepDescriptors, boolean keepSeriesDescriptors, boolean keepProtocolName, boolean keepPatientCharacteristics, boolean keepDeviceIdentity, boolean keepInstitutionIdentity, boolean aggregateAgesOver89) throws DicomException
De-identify a list of attributes, recursively iterating through nested sequences.
Does not process UIDs, but does remove sequences that would be invalidated by removing UIDs, e.g., Source Image Sequence and Referenced Image Sequence. If necessary caller should use removeOrRemapUIDAttributes()
.
Does not process dates and times (other than Patient Birth). If necessary caller should use removeOrRemapDateAndTimeAttributes()
.
list
- the list of attributes to be cleaned uphandleUIDs
- keep, remove or remap the UIDskeepDescriptors
- if true, keep the text description and comment attributeskeepSeriesDescriptors
- if true, keep the series description even if all other descriptors are removedkeepProtocolName
- if true, keep protocol name even if all other descriptors are removedkeepPatientCharacteristics
- if true, keep patient characteristics (such as might be needed for PET SUV calculations)keepDeviceIdentity
- if true, keep device identitykeepInstitutionIdentity
- if true, keep device identityaggregateAgesOver89
- if true, and keepPatientCharacteristics true, combine patient ages over 89 years into single 90 year categoryDicomException
- if error in DICOM encodingprotected static void removeOrRemapDateAndTimeAttributes(AttributeList list, int handleDates, java.util.Date epochForDateModification, java.util.Date earliest, java.lang.String dateToUseForUnaccompaniedTimes) throws DicomException
Remove or remap Date, Time and DateTime attributes (other than Patient Birth) in a list of attributes, recursively iterating through nested sequences.
list
- the list of attributes to be cleaned uphandleDates
- keep, remove or modify dates and timesepochForDateModification
- used if handleDates is modify dates, otherwise nullearliest
- used to determine the offset from the epoch to remove from all dates and times - MUST be the earliest date and time else unaccompanied time attributes may cross midnightdateToUseForUnaccompaniedTimes
- used for time attributes that don't have a date sibling and which may be nested in sequences, e.g., RadiopharmaceuticalStartTimeDicomException
- if error in DICOM encodingprotected static void removeOrRemapUIDAttributes(AttributeList list, int handleUIDs) throws DicomException
Remove or remap UID attributes in a list of attributes, recursively iterating through nested sequences.
list
- the list of attributes to be cleaned uphandleUIDs
- remove or remap the UIDsDicomException
- if error in DICOM encodingprotected static void removeStructuredContent(AttributeList list)
public static void removeUIDAttributes(AttributeList list) throws DicomException
Remove UID attributes in a list of attributes, recursively iterating through nested sequences.
list
- the list of attributes to be cleaned upDicomException
- if error in DICOM encoding