@Override public TagW getTagElement(int id) { Iterator<TagW> enumVal = tags.keySet().iterator(); while (enumVal.hasNext()) { TagW e = enumVal.next(); if (e.getId() == id) { return e; } } return null; }
public boolean containTag(int id) { for (Iterator<TagW> it = tags.keySet().iterator(); it.hasNext();) { if (it.next().getId() == id) { return true; } } return false; }
/** * Updates all Dicom Tags from the given document except Patient Dicom Group Tags * * @param xml */ public void updateAllButPatient(Tagable tagable) { if (tagable != null) { tagable.getTagEntrySetIterator().forEachRemaining(i -> { TagW tag = i.getKey(); if (tag != null && TagUtils.groupNumber(tag.getId()) != patientDicomGroupNumber) { tags.put(tag, i.getValue()); } }); } }
private void readXmlTag(TagW tag, Node node, DefaultTagable def) { // TODO implement DICOM XML : http://dicom.nema.org/medical/dicom/current/output/chtml/part19/chapter_A.html if (tag instanceof TagSeq && node.hasChildNodes()) { NodeList nodeList = node.getChildNodes(); Attributes attributes = new Attributes(); // FIXME handle only one sequence element Attributes[] list = new Attributes[1]; for (int i = 0; i < nodeList.getLength(); i++) { Node n = nodeList.item(i); if (n != null) { Optional.ofNullable(TagD.get(n.getNodeName())).ifPresent(t -> attributes.setValue(t.getId(), ElementDictionary.vrOf(t.getId(), null), n.getTextContent())); } } list[0] = attributes.getParent() == null ? attributes : new Attributes(attributes); def.setTagNoNull(tag, list); } else { tag.readValue(node.getTextContent(), def); } }
public boolean containsSameTagValues(Tagable tagable, Integer dicomGroupNumber) { if (tagable != null) { Iterator<Entry<TagW, Object>> iter = tagable.getTagEntrySetIterator(); while (iter.hasNext()) { Entry<TagW, Object> entry = iter.next(); TagW tag = entry.getKey(); if (tag != null && (dicomGroupNumber == null || TagUtils.groupNumber(tag.getId()) == dicomGroupNumber)) { if (this.containTagKey(tag)) { if (!TagUtil.isEquals(this.getTagValue(tag), entry.getValue())) { return false; } } else if (entry.getValue() != null) { return false; } } } } return true; }
private SearchParameters buildCurrentSearchParameters() { SearchParameters p = new SearchParameters(Messages.getString("DicomQrView.custom")); //$NON-NLS-1$ // Get value in text field String sTagValue = tfSearch.getText(); TagW item = (TagW) comboTags.getSelectedItem(); if (StringUtil.hasText(sTagValue) && item != null) { p.getParameters().add(new DicomParam(item.getId(), sTagValue)); } // Get modalities selection if (groupMod.getModelList().stream().anyMatch(c -> !c.isSelected())) { p.getParameters() .add(new DicomParam(Tag.ModalitiesInStudy, groupMod.getModelList().stream().filter(c -> c.isSelected() && c.getObject() instanceof Modality) .map(c -> ((Modality) c.getObject()).name()).toArray(String[]::new))); } LocalDate sDate = startDatePicker.getDate(); LocalDate eDate = endDatePicker.getDate(); if (sDate != null || eDate != null) { StringBuilder range = new StringBuilder(); range.append(TagD.formatDicomDate(sDate)); range.append("-"); //$NON-NLS-1$ range.append(TagD.formatDicomDate(eDate)); p.getParameters().add(new DicomParam(Tag.StudyDate, range.toString())); } return p; }
boolean time = false; if (tag instanceof TagW) { tagID = ((TagW) tag).getId(); TagType type = ((TagW) tag).getType(); date = TagType.DICOM_DATE == type || TagType.DATE == type;
public static void fillAttributes(Attributes dataset, final TagW tag, final Object val, ElementDictionary dic) { if (dataset != null && tag != null) { TagType type = tag.getType(); int id = tag.getId(); String key = dic.keywordOf(id); if (val == null || !StringUtil.hasLength(key)) {