/** * Read File Meta Information from this stream into <code>DicomObject</code>. * <p> * If there is no File Meta Information on current stream position, the * method returns without changing the stream position. Otherwise the stream * will be parsed until the end of the File Meta Information is detected and * File Meta Information elements are put into <code>dest</code>. * * @param dest * <code>DicomObject</code> into which File Meta Information is * read. * @throws EOFException * if this stream reaches the end before the end of the File * Meta Information is detected. * @throws IOException * if an I/O error occurs. */ public void readFileMetaInformation(DicomObject dest) throws IOException { if (!expectFmiEnd) { return; } stopAtFmiEnd = true; try { readDicomObject(dest, -1); } finally { stopAtFmiEnd = false; } }
public DicomObject readDicomObject() throws IOException { DicomObject dest = new BasicDicomObject(); readDicomObject(dest, -1); return dest; }
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); DicomInputStream dis = new DicomInputStream(s, TransferSyntax.ExplicitVRLittleEndian); attrs = new BasicDicomObject(); dis.readDicomObject(attrs, -1); } }
attrs = dis.readDicomObject(); } finally { dis.close(); transcoderBufferSize); dis.setHandler(h); dis.readDicomObject(); } finally { dis.close();
public void readItem(DicomObject dest) throws IOException { dest.setItemOffset(pos); if (readHeader() != Tag.Item) throw new DicomCodingException("Expected (FFFE,E000) but read " + TagUtils.toString(tag)); readDicomObject(dest, vallen); }
in.readDicomObject(dcmObj, PEEK_LEN); info.tsuid = in.getTransferSyntax().uid(); info.fmiEndPos = in.getEndOfFileMetaInfoPosition();
private DicomObject readDicomObject(TransferSyntax ts) throws IOException { DicomObject dcm = new BasicDicomObject(); DicomInputStream din = new DicomInputStream(this, ts); try { din.readDicomObject(dcm, -1); } catch (DicomCodingException e) { log.warn(as.toString() + ": Failed to decode dicom object: " + e.getMessage()); throw new AAbort(); } finally { CloseUtils.safeClose(din); } return dcm; }
in = new DicomInputStream(inStream); in.setHandler(new StopTagInputHandler(Tag.StudyDate)); in.readDicomObject(dcmObj, PEEK_LEN); info.tsuid = in.getTransferSyntax().uid(); info.fmiEndPos = in.getEndOfFileMetaInfoPosition();
public DicomDirReader(RandomAccessFile raf) throws IOException { this.raf = raf; in = new DicomInputStream(raf); in.setHandler(new StopTagInputHandler(Tag.DirectoryRecordSequence)); filesetInfo = new FileSetInformation(); in.readDicomObject(filesetInfo.getDicomObject(), -1); in.setHandler(in); }
dis = new DicomInputStream(f); dis.setHandler(new StopTagInputHandler(Tag.PixelData)); DicomObject d = dis.readDicomObject(); DicomObject p_record = ap.makePatientDirectoryRecord(d); DicomObject sty_record = ap.makeStudyDirectoryRecord(d);
private long endPos() throws IOException { if (recordSeqLen == -1) { long endPos = raf.length() - 12; raf.seek(endPos); if (in.readHeader() == Tag.SequenceDelimitationItem) { recordSeqLen = (int) (endPos - firstRecordPos); } else { endPos = filesetInfo.getOffsetLastRootRecord(); raf.seek(endPos); in.setStreamPosition(endPos); DicomObject dcmobj = new BasicDicomObject(); while (in.readHeader() == Tag.Item) { in.readDicomObject(dcmobj, in.valueLength()); dcmobj.clear(); endPos = in.getStreamPosition(); } if (in.tag() != Tag.SequenceDelimitationItem) { throw new IOException("Unexpected Tag " + TagUtils.toString(in.tag()) + " at offset " + endPos); } recordSeqLen = (int) (endPos - firstRecordPos); } } return firstRecordPos + recordSeqLen; }
try { dis.setHandler(new StopTagInputHandler(Tag.PixelData)); attrs = dis.readDicomObject(); } finally { dis.close(); transcoderBufferSize); dis.setHandler(h); dis.readDicomObject(); } finally { dis.close();
TransferSyntax.ImplicitVRLittleEndian); DicomObject item = new BasicDicomObject(); dis1.readDicomObject(item, b.length); tmp.addDicomObject(item); item.setParent(attrs); item.setItemOffset(tagpos); readDicomObject(item, vallen); sq.addDicomObject(item); } else {
ds = dis.readDicomObject(); streamMetaData = new DicomStreamMetaData(); fixHeaderData(ds);
final DicomObject postPixelDs = postDis.readDicomObject(); if (postPixelDs != null && !postPixelDs.isEmpty()) {