/** * 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); }
public void writeCommand(DicomObject attrs) throws IOException { this.ts = TransferSyntax.ImplicitVRLittleEndian; writeElements(attrs.commandIterator(), true, new ItemInfo(attrs .commandIterator(), true)); }
/** * Write a DICOM dataset to the output stream. * * @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 writeDataset(DicomObject attrs, TransferSyntax transferSyntax) throws IOException { setTransferSyntax(transferSyntax); this.ts = transferSyntax; writeElements(attrs.datasetIterator(), includeGroupLength, createItemInfo(attrs)); if (autoFinish) { finish(); } }
/** * 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); } }
public void writeFileMetaInformation(DicomObject attrs) throws IOException { if (preamble != null) { write(preamble, 0, PREAMBLE_LENGTH); write('D'); write('I'); write('C'); write('M'); } this.ts = TransferSyntax.ExplicitVRLittleEndian; writeElements(attrs.fileMetaInfoIterator(), true, new ItemInfo(attrs .fileMetaInfoIterator(), true)); }