public boolean visit(DicomElement attr) { toRemove[i++] = attr.tag(); return true; } });
public int tag() { return e.tag(); }
public DicomElement next() { fill(); if( next1==null ) { DicomElement ret = next2; next2 = null; return ret; } if( next2==null ) { DicomElement ret = next1; next1 = null; return ret; } if( next1.tag() < next2.tag() ) { DicomElement ret = next1; next1 = null; return ret; } DicomElement ret = next2; next2 = null; return ret; }
public boolean visit(DicomElement e) { attrs.remove(e.tag()); return true; }}); }
private void findNext() { while (itr.hasNext()) { next = itr.next(); if (filter(next.tag())) return; } next = null; }
public void add(DicomElement attr) { if (!filter(attr.tag())) { throw new IllegalArgumentException(); } attrs.add(attr); }
public boolean visit(DicomElement attr) { return !filter(attr.tag()) || visitor.visit(attr); } });
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); attrs = new BasicDicomObject(); attrs.setItemOffset(s.readLong()); DicomElement attr = (DicomElement) s.readObject(); while (attr.tag() != Tag.ItemDelimitationItem) { if (attr instanceof SequenceDicomElement) { ((SequenceDicomElement) attr).setParentDicomObject(attrs); } ((BasicDicomObject) attrs).addInternal(attr); attr = (DicomElement) s.readObject(); } } }
public static MappedDICOMObject toMap(DicomObject obj, Path parent) { if(obj == null) return null; MappedDICOMObject map = new MappedDICOMObject(parent); SpecificCharacterSet charSet = obj.getSpecificCharacterSet(); Iterator<DicomElement> it = obj.iterator(); while(it.hasNext()){ DicomElement e = it.next(); Object o = toObject(parent , e, charSet); TagValue tag = tagStruct.getTagValue(e.tag()); String t = (tag != null) ? tag.getAlias() : Integer.toString(e.tag()); map.put(t, o); } return map; }
DicomElement addInternal(DicomElement a) { final int tag = a.tag(); if ((tag & 0x0000ffff) == 0) { // do not include group length elements return a; } table.put(tag, a); if (tag == Tag.SpecificCharacterSet) { charset = SpecificCharacterSet.valueOf(a.getStrings(null, false)); } return a; }
private void writeItem(DicomElement a, int index) throws SAXException, IOException { if (file != null) file = new File(file, Integer.toString(index+1)); if (a.vr() == VR.SQ) { writeContent(a.getDicomObject(index), TAG_ITEM); } else { final byte[] data = a.getFragment(index); writeFragment(a.vr(), data, a.bigEndian(), fpath(a.tag(), a.vr(), data.length)); } if (file != null) file = file.getParentFile(); }
@Override public DicomElement next() { DicomElement attr = super.next(); if (attr.vr() == VR.SQ && attr.hasItems()) { return attr.filterItems(filter.getNestedDicomObject(attr.tag())); } return attr; }
tag = dcmElmt.tag();
+ vlen; len += alen; final int gggg = a.tag() & 0xffff0000; if (groupLength1) { if (gggg != gggg0) {
public boolean visit(DicomElement key) { DicomElement el = get(key.tag()); if (el == null) return false; if (key.hasDicomObjects()) { DicomObject itemKeys = key.getDicomObject(); if (itemKeys != null && !itemKeys.isEmpty()) { if (!el.hasDicomObjects() || el.isEmpty()) return false; for (int i = 0, n = el.countItems(); i < n; i++) { if (!el.getDicomObject(i).containsAll(itemKeys)) return false; } } } return true; } });
public void add(DicomElement a) { if (a.hasItems()) { final int n = a.countItems(); DicomElement t; if (a.vr() == VR.SQ) { t = putSequence(a.tag(), n); for (int i = 0; i < n; i++) { DicomObject srcItem = a.getDicomObject(i); BasicDicomObject item = new BasicDicomObject(srcItem.size()); item.setParent(this); srcItem.copyTo(item); t.addDicomObject(item); } } else { t = putFragments(a.tag(), a.vr(), a.bigEndian(), n); for (int i = 0; i < n; i++) { t.addFragment(a.getFragment(i)); } } a = t; } addInternal(a); }
private void transcodeItem(DicomInputStream in) throws SAXException, IOException { final DicomElement sq = in.sq(); final int itemLen = in.valueLength(); final VR sqvr = sq.vr(); final int index = sq.countItems(); if (file != null) file = new File(file, Integer.toString(index+1)); final String fpath = fpath(sq.tag(), sqvr, itemLen); startItemElement(in.tagPosition(), itemLen, fpath); in.readValue(in); if (sq.hasFragments() && index < sq.countItems()) { byte[] data = sq.getFragment(index); if (fpath != null) { writeToFile(data); } else { final boolean bigEndian = in.getTransferSyntax().bigEndian(); sqvr.formatXMLValue(data, bigEndian, null, cbuf, ch); } sq.setFragment(index, EMPTY_BYTES); // allow gc to release byte[] } endItemElement(); if (file != null) file = file.getParentFile(); }
private void writeElement(DicomObject attrs, DicomElement a) throws SAXException, IOException { VR vr = a.vr(); final int tag = a.tag(); if (file != null) file = new File(file, StringUtils.intToHex(tag)); String fpath = fpath(tag, vr, a.length()); startAttributeElement(tag, vr, a.length(), fpath, attrs); if (a.hasItems()) { for (int i = 0, n = a.countItems(); i < n; ++i) { writeItem(a, i); } } else { if (fpath != null) { writeToFile(a.getBytes()); } else { vr.formatXMLValue(a.getBytes(), a.bigEndian(), attrs.getSpecificCharacterSet(), cbuf, ch); } } endAttributeElement(); if (file != null) file = file.getParentFile(); }
public boolean visit(DicomElement attr) { int tag = attr.tag(); VR vr = attr.vr(); if (!TagUtils.isPrivateDataElement(tag) || (!resolveDestinationPrivateTags && TagUtils.isPrivateCreatorDataElement(tag)))