Java Code Examples for org.dcm4che3.data.Attributes#update()
The following examples show how to use
org.dcm4che3.data.Attributes#update() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultAttributeEditor.java From weasis-dicom-tools with Eclipse Public License 2.0 | 5 votes |
@Override public boolean apply(Attributes data, AttributeEditorContext context) { if (data != null) { boolean update = false; if (generateUIDs) { if ("2.25".equals(UIDUtils.getRoot())) { UIDUtils.setRoot("2.25.35"); } // New Study UID String oldStudyUID = data.getString(Tag.StudyInstanceUID); String studyUID = uidMap.computeIfAbsent(oldStudyUID, k -> UIDUtils.createUID()); data.setString(Tag.StudyInstanceUID, VR.UI, studyUID); // New Series UID String oldSeriesUID = data.getString(Tag.SeriesInstanceUID); String seriesUID = uidMap.computeIfAbsent(oldSeriesUID, k -> UIDUtils.createUID()); data.setString(Tag.SeriesInstanceUID, VR.UI, seriesUID); // New Sop UID String iuid = UIDUtils.createUID(); data.setString(Tag.SOPInstanceUID, VR.UI, iuid); update = true; } if (tagToOverride != null && !tagToOverride.isEmpty()) { data.update(Attributes.UpdatePolicy.OVERWRITE, tagToOverride, null); update = true; } return update; } return false; }
Example 2
Source File: CLIUtils.java From weasis-dicom-tools with Eclipse Public License 2.0 | 5 votes |
public static boolean updateAttributes(Attributes data, Attributes attrs, String uidSuffix) { if (attrs.isEmpty() && uidSuffix == null) { return false; } if (uidSuffix != null) { data.setString(Tag.StudyInstanceUID, VR.UI, data.getString(Tag.StudyInstanceUID) + uidSuffix); data.setString(Tag.SeriesInstanceUID, VR.UI, data.getString(Tag.SeriesInstanceUID) + uidSuffix); data.setString(Tag.SOPInstanceUID, VR.UI, data.getString(Tag.SOPInstanceUID) + uidSuffix); } data.update(Attributes.UpdatePolicy.OVERWRITE, attrs, null); return true; }