public static void addTag(TagW tag) { if (tag != null) { tags.put(tag.getKeyword(), tag); } }
public String getDisplayedName() { if (displayedName == null) { return StringUtil.splitCamelCaseString(getKeyword()); } return displayedName; }
public static <T> T getTagValue(TagReadable tagable, TagW tag, Class<T> type) { if (tagable != null && tag != null) { try { return type.cast(tagable.getTagValue(tag)); } catch (ClassCastException e) { LOGGER.error("Cannot cast the value of \"{}\" into {}", tag.getKeyword(), type, e); //$NON-NLS-1$ } } return null; } }
private static void writeImages(Map<String, SOPInstanceReferenceAndMAC> map, Writer mf) throws IOException { String sopUID = TagD.get(Tag.ReferencedSOPInstanceUID).getKeyword(); String sopClass = TagD.get(Tag.ReferencedSOPClassUID).getKeyword(); String frames = TagD.get(Tag.ReferencedFrameNumber).getKeyword(); for (SOPInstanceReferenceAndMAC sopRef : map.values()) { mf.append("\n<"); //$NON-NLS-1$ mf.append(Xml.Level.INSTANCE.getTagName()); mf.append(" "); //$NON-NLS-1$ Xml.addXmlAttribute(sopUID, sopRef.getReferencedSOPInstanceUID(), mf); Xml.addXmlAttribute(sopClass, sopRef.getReferencedSOPClassUID(), mf); int[] fms = sopRef.getReferencedFrameNumber(); if (fms != null) { String frameList = IntStream.of(fms).mapToObj(String::valueOf).collect(Collectors.joining("\\")); //$NON-NLS-1$ Xml.addXmlAttribute(frames, frameList, mf); } mf.append("/>"); //$NON-NLS-1$ } } }
private static void readTags(SplittingModalityRules data, XMLStreamReader xmler, boolean multiframe, String endElement) throws XMLStreamException { int eventType; boolean state = true; while (xmler.hasNext() && state) { eventType = xmler.next(); switch (eventType) { case XMLStreamConstants.START_ELEMENT: TagW tag = getTag(xmler.getName().getLocalPart()); if (tag != null) { Condition condition = readCondition(data, xmler, tag.getKeyword()); if (multiframe) { data.addMultiFrameTags(tag, condition); } else { data.addSingleFrameTags(tag, condition); } } break; case XMLStreamConstants.END_ELEMENT: if (endElement.equals(xmler.getName().getLocalPart())) { state = false; } break; default: break; } } }
public PatientComparator(XMLStreamReader xmler) { setPatientId(TagUtil.getTagAttribute(xmler, TagD.get(Tag.PatientID).getKeyword(), null)); setIssuerOfPatientID(TagUtil.getTagAttribute(xmler, TagD.get(Tag.IssuerOfPatientID).getKeyword(), null)); setName(TagUtil.getTagAttribute(xmler, TagD.get(Tag.PatientName).getKeyword(), null)); setSex(TagUtil.getTagAttribute(xmler, TagD.get(Tag.PatientSex).getKeyword(), null)); setBirthdate(TagUtil.getTagAttribute(xmler, TagD.get(Tag.PatientBirthDate).getKeyword(), null)); }
private static void writeKoElement(KOSpecialElement ko, Writer mf) throws IOException { mf.append("\n<"); //$NON-NLS-1$ mf.append(ArcParameters.TAG_SEL); mf.append(" "); //$NON-NLS-1$ Xml.addXmlAttribute(SEL_NAME, ko.getLabelWithoutPrefix(), mf); mf.append(" "); //$NON-NLS-1$ String sereiesUID = TagD.get(Tag.SeriesInstanceUID).getKeyword(); Xml.addXmlAttribute(sereiesUID, TagD.getTagValue(ko, Tag.SeriesInstanceUID, String.class), mf); mf.append(">"); //$NON-NLS-1$ for (Entry<String, Map<String, SOPInstanceReferenceAndMAC>> entry : ko.sopInstanceReferenceMapBySeriesUID .entrySet()) { mf.append("\n<"); //$NON-NLS-1$ mf.append(Xml.Level.SERIES.getTagName()); mf.append(" "); //$NON-NLS-1$ Xml.addXmlAttribute(sereiesUID, entry.getKey(), mf); mf.append(">"); //$NON-NLS-1$ writeImages(entry.getValue(), mf); mf.append("\n</"); //$NON-NLS-1$ mf.append(Xml.Level.SERIES.getTagName()); mf.append(">"); //$NON-NLS-1$ } mf.append("\n</"); //$NON-NLS-1$ mf.append(ArcParameters.TAG_SEL); mf.append(">"); //$NON-NLS-1$ }
private static void readImages(SeriesAndInstanceReference rfSeries, XMLStreamReader xmler, ReaderParams params) throws XMLStreamException { List<SOPInstanceReferenceAndMAC> instances = new ArrayList<>(); BiConsumerWithException<XMLStreamReader, ReaderParams, XMLStreamException> method = (x, r) -> { String sopUID = TagUtil.getTagAttribute(xmler, TagD.get(Tag.ReferencedSOPInstanceUID).getKeyword(), null); String sopClassUID = TagUtil.getTagAttribute(xmler, TagD.get(Tag.ReferencedSOPClassUID).getKeyword(), null); int[] seqFrame = (int[]) TagD.get(Tag.ReferencedFrameNumber).getValue(xmler); SOPInstanceReferenceAndMAC referencedSOP = new SOPInstanceReferenceAndMAC(); referencedSOP.setReferencedSOPInstanceUID(sopUID); referencedSOP.setReferencedSOPClassUID(sopClassUID); referencedSOP.setReferencedFrameNumber(seqFrame); instances.add(referencedSOP); }; readElement(xmler, Xml.Level.INSTANCE.getTagName(), Xml.Level.SERIES.getTagName(), method, params); rfSeries.setReferencedSOPInstances(instances); }
patient = new MediaSeriesGroupNode(TagD.getUID(Level.PATIENT), patientPseudoUID, DicomModel.patient.getTagView()); patient.setTag(idTag, TagUtil.getTagAttribute(xmler, idTag.getKeyword(), TagW.NO_VALUE)); patient.setTag(nameTag, TagUtil.getTagAttribute(xmler, nameTag.getKeyword(), TagW.NO_VALUE)); patient.setTagNoNull(issuerIdTag, TagUtil.getTagAttribute(xmler, issuerIdTag.getKeyword(), null));
private static void readSelection(XMLStreamReader xmler, ReaderParams params) throws XMLStreamException { String sereiesUIDKey = TagD.get(Tag.SeriesInstanceUID).getKeyword(); String name = TagUtil.getTagAttribute(xmler, KOSpecialElement.SEL_NAME, null); String koSeriesUID = TagUtil.getTagAttribute(xmler, sereiesUIDKey, null);
TagUtil.getTagAttribute(xmler, TagW.WadoTransferSyntaxUID.getKeyword(), null)); dicomSeries.setTagNoNull(TagW.WadoCompressionRate, TagUtil.getIntegerTagAttribute(xmler, TagW.WadoCompressionRate.getKeyword(), null)); dicomSeries.setTagNoNull(TagW.DirectDownloadThumbnail, TagUtil.getTagAttribute(xmler, TagW.DirectDownloadThumbnail.getKeyword(), null)); sop = new SopInstance(sopInstanceUID, frame); sop.setDirectDownloadFile( TagUtil.getTagAttribute(xmler, TagW.DirectDownloadFile.getKeyword(), null)); seriesInstanceList.addSopInstance(sop);