Java Code Examples for org.dcm4che3.data.Attributes#isEmpty()
The following examples show how to use
org.dcm4che3.data.Attributes#isEmpty() .
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: 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; }
Example 2
Source File: ForwardUtil.java From weasis-dicom-tools with Eclipse Public License 2.0 | 4 votes |
public static void storeMulitpleDestination(ForwardDicomNode fwdNode, List<ForwardDestination> destList, Params p) throws Exception { if (destList == null || destList.isEmpty()) { throw new IllegalStateException("Cannot find the DICOM destination from " + fwdNode.toString()); } // Exclude DICOMDIR if ("1.2.840.10008.1.3.10".equals(p.cuid)) { LOGGER.warn("Cannot send DICOMDIR {}", p.iuid); return; } if (destList.size() == 1) { storeOneDestination(fwdNode, destList.get(0), p); } else { List<ForwardDestination> destConList = new ArrayList<>(); for (ForwardDestination fwDest : destList) { try { if (fwDest instanceof DicomForwardDestination) { prepareTransfer((DicomForwardDestination) fwDest, p.getCuid(), p.getTsuid()); } destConList.add(fwDest); } catch (Exception e) { LOGGER.error("Cannot connect to the final destination", e); } } if (destConList.isEmpty()) { return; } else if (destConList.size() == 1) { storeOneDestination(fwdNode, destConList.get(0), p); } else { List<File> files = null; try { Attributes attributes = new Attributes(); ForwardDestination fistDest = destConList.get(0); if (fistDest instanceof DicomForwardDestination) { files = transfer(fwdNode, (DicomForwardDestination) fistDest, attributes, p); } else if (fistDest instanceof WebForwardDestination) { files = transfer(fwdNode, (WebForwardDestination) fistDest, null, p); } if (!attributes.isEmpty()) { for (int i = 1; i < destConList.size(); i++) { ForwardDestination dest = destConList.get(i); if (dest instanceof DicomForwardDestination) { transferOther(fwdNode, (DicomForwardDestination) dest, attributes, p); } else if (dest instanceof WebForwardDestination) { transferOther(fwdNode, (WebForwardDestination) dest, attributes, p); } } } } finally { if (files != null) { // Force to clean if tmp bulk files for (File file : files) { FileUtil.delete(file); } } } } } }