private void addPixelData(Attributes dest, Attributes src, int frame) { VR.Holder vr = new VR.Holder(); Object pixelData = src.getValue(Tag.PixelData, vr); if (pixelData instanceof byte[]) { dest.setBytes( Tag.PixelData, vr.vr, extractPixelData((byte[]) pixelData, frame, calcFrameLength(src))); } else if (pixelData instanceof BulkData) { dest.setValue( Tag.PixelData, vr.vr, extractPixelData((BulkData) pixelData, frame, calcFrameLength(src))); } else { Fragments destFrags = dest.newFragments(Tag.PixelData, vr.vr, 2); destFrags.add(null); destFrags.add(((Fragments) pixelData).get(frame + 1)); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (getClass() != obj.getClass()) return false; Fragments other = (Fragments) obj; if (bigEndian != other.bigEndian) return false; if (privateCreator == null) { if (other.privateCreator != null) return false; } else if (!privateCreator.equals(other.privateCreator)) return false; if (tag != other.tag) return false; if (vr != other.vr) return false; ListIterator<Object> e1 = listIterator(); ListIterator<Object> e2 = other.listIterator(); while (e1.hasNext() && e2.hasNext()) { Object o1 = e1.next(); Object o2 = e2.next(); if (!itemsEqual(o1, o2)) return false; } if (e1.hasNext() || e2.hasNext()) return false; return true; }