public boolean bigEndian() { return e.bigEndian(); }
public DicomElement bigEndian(boolean bigEndian) { if (e.bigEndian() == bigEndian || e.isEmpty()) return this; throw new UnsupportedOperationException(); }
private byte[] toBytes(DicomElement a, boolean bigEndian) { return a == null ? null : a.bigEndian(bigEndian).getBytes(); }
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(); }
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(); }
a.bigEndian(ts.bigEndian()); if (a.hasItems()) { if (vr == VR.SQ) {
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); }