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 add(Object frag) { add(size(), frag); return true; }
@Override public boolean addAll(int index, Collection<? extends Object> c) { for (Object o : c) add(index++, o); return !c.isEmpty(); }