@Override public Iterator<DicomElement> iterator(int fromTag, int toTag) { final long maxFromTag = Math.max(fromTag & 0xffffffff, this.fromTag); final long minToTag = Math.min(toTag & 0xffffffff, this.toTag); return new Itr(attrs.iterator((int) maxFromTag, (int) minToTag)); } }
@Override public Iterator<DicomElement> iterator() { return new Itr(attrs.iterator((int) fromTag, (int) toTag)); }
@Override public Iterator<DicomElement> iterator(int fromTag, int toTag) { return new FilterItr(attrs.iterator(fromTag, toTag)); }
public Iterator<DicomElement> iterator() { return new Itr(attrs.iterator()); }
public Iterator<DicomElement> iterator(int fromTag, int toTag) { return new Itr(attrs.iterator(fromTag, toTag)); }
public Iterator<DicomElement> iterator(int fromTag, int toTag) { return new UnmodifiabledIterator(dcmobj.iterator(fromTag, toTag)); }
@Override public Iterator<DicomElement> iterator() { return new FilterItr(attrs.iterator()); }
public Iterator<DicomElement> iterator() { return new UnmodifiabledIterator(dcmobj.iterator()); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof DicomObject)) { return false; } DicomObject other = (DicomObject) o; Iterator<DicomElement> it = iterator(); Iterator<DicomElement> otherIt = other.iterator(); while (it.hasNext() && otherIt.hasNext()) { if (!it.next().equals(otherIt.next())) return false; } return !it.hasNext() && !otherIt.hasNext(); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof DicomObject)) { return false; } DicomObject other = (DicomObject) o; Iterator<DicomElement> it = iterator(); Iterator<DicomElement> otherIt = other.iterator(); while (it.hasNext() && otherIt.hasNext()) { if (!it.next().equals(otherIt.next())) return false; } return !it.hasNext() && !otherIt.hasNext(); }
private void writeContent(DicomObject attrs, String qName) throws SAXException, IOException { AttributesImpl atts = new AttributesImpl(); if (!attrs.isRoot()) { atts.addAttribute("", ATTR_OFF, ATTR_OFF, "", Long.toString(attrs.getItemOffset())); } ch.startElement("", qName, qName, new AttributesImpl()); for (Iterator<DicomElement> it = attrs.iterator(); it.hasNext();) { writeElement(attrs, it.next()); } ch.endElement("", qName, qName); }
private int calcItemSqLen(DicomElement a) { int l = explicitSequenceLength ? 0 : 8; for (int i = 0, n = a.countItems(); i < n; ++i) { DicomObject item = a.getDicomObject(i); ItemInfo itemInfo = new ItemInfo(item.iterator(), includeGroupLength); if (childs == null) // lazy allocation childs = new LinkedList<ItemInfo>(); childs.add(itemInfo); l += 8 + itemInfo.len; } return l; } }
/** * Only for internal use by {@link org.dcm4che2.data.DicomObjectSerializer}. */ public void serializeDicomObject(DicomObject attrs) throws IOException { this.ts = TransferSyntax.ExplicitVRLittleEndian; writeElements(attrs.iterator(), false, null); writeHeader(Tag.ItemDelimitationItem, null, 0); }
/** Checks to see if the given DICOM object has any skipped elementss * and combined them into a list. * @param ds * @param ret is null initially and a list is created as required * @return */ public static List<SkippedDicomElement> checkHasSkippedElement(DicomObject ds, List<SkippedDicomElement> ret) { Iterator<DicomElement> it = ds.iterator(); while(it.hasNext()) { DicomElement de = it.next(); if( de instanceof SkippedDicomElement ) { if( ret==null ) ret = new ArrayList<SkippedDicomElement>(); ret.add((SkippedDicomElement) de); } else if( de.hasDicomObjects()) { int n = de.countItems(); for(int i=0; i<n; i++) { ret = checkHasSkippedElement(de.getDicomObject(i),ret); } } } return ret; }
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; }
/** * Write a DICOM dataset to the output stream. This one is needed to handle * a case where group 2 elements are within sequence items. * * @param attrs * A DicomObject containing the attributes to write. * @param transferSyntax * A TransferSyntax object representing the transfer syntax of * the file. * @throws IOException */ public void writeDicomObject(DicomObject attrs, TransferSyntax transferSyntax) throws IOException { setTransferSyntax(transferSyntax); this.ts = transferSyntax; writeElements(attrs.iterator(), includeGroupLength, createItemInfo(attrs)); if (autoFinish) { finish(); } }
private void writeItem(DicomObject item, ItemInfo itemInfo) throws IOException { item.setItemOffset(pos); int len; if (item.isEmpty()) { len = explicitItemLengthIfZero ? 0 : -1; } else { len = explicitItemLength ? itemInfo.len : -1; } writeHeader(Tag.Item, null, len); writeElements(item.iterator(), includeGroupLength, itemInfo); if (len == -1) { writeHeader(Tag.ItemDelimitationItem, null, 0); } }
for (Iterator<DicomElement> iterator = keys.iterator(); iterator.hasNext();)