Package org.dcm4che3.io

Examples of org.dcm4che3.io.DicomOutputStream


        contentSeq.add(contentItem(valueTypeOf(inst), refSOP(cuid, iuid)));
        return true;
    }

    public void writeKOS() throws IOException {
        DicomOutputStream dos = new DicomOutputStream(
                new BufferedOutputStream(fname != null
                        ? new FileOutputStream(fname)
                        : new FileOutputStream(FileDescriptor.out)),
                nofmi ? UID.ImplicitVRLittleEndian
                      : UID.ExplicitVRLittleEndian);
        dos.setEncodingOptions(encOpts);
        try {
            dos.writeDataset(
                    nofmi ? null : kos.createFileMetaInformation(tsuid),
                    kos);
        } finally {
            dos.close();
        }
    }
View Full Code Here


    private void storeTo(Association as, Attributes fmi,
            PDVInputStream data, File file) throws IOException  {
        LOG.info("{}: M-WRITE {}", as, file);
        file.getParentFile().mkdirs();
        DicomOutputStream out = new DicomOutputStream(file);
        try {
            out.writeFileMetaInformation(fmi);
            data.copyTo(out);
        } finally {
            SafeClose.close(out);
        }
    }
View Full Code Here

        String cuid = cmd.getString(Tag.AffectedSOPClassUID);
        String iuid = cmd.getString(Tag.AffectedSOPInstanceUID);
        String tuid = eventInfo.getString(Tag.TransactionUID);
        File file = new File(storageDir, tuid );
        DicomOutputStream out = null;
        LOG.info("{}: M-WRITE {}", as, file);
        try {
            out = new DicomOutputStream(file);
            out.writeDataset(
                    Attributes.createFileMetaInformation(iuid, cuid,
                            UID.ExplicitVRLittleEndian),
                    eventInfo);
        } catch (IOException e) {
            LOG.warn(as + ": Failed to store Storage Commitment Result:", e);
View Full Code Here

        String iuid = rq.getString(Tag.AffectedSOPInstanceUID);
        File file = new File(storageDir, iuid);
        if (file.exists())
            throw new DicomServiceException(Status.DuplicateSOPinstance).
                setUID(Tag.AffectedSOPInstanceUID, iuid);
        DicomOutputStream out = null;
        LOG.info("{}: M-WRITE {}", as, file);
        try {
            out = new DicomOutputStream(file);
            out.writeDataset(
                    Attributes.createFileMetaInformation(iuid, cuid,
                            UID.ExplicitVRLittleEndian),
                    rqAttrs);
        } catch (IOException e) {
            LOG.warn(as + ": Failed to store Instance Available Notification:", e);
View Full Code Here

        file.delete();
    }

   @Test
    public void testWriteCommand() throws IOException {
       DicomOutputStream out = new DicomOutputStream(
               new FileOutputStream(file), UID.ImplicitVRLittleEndian);
       try {
           out.writeCommand(cechorq());
       } finally {
           out.close();
       }
       assertEquals(4, readAttributes().size());
    }
View Full Code Here

    }

    @Test
    public void testWriteDatasetWithoutFileMetaInformation()
            throws IOException {
        DicomOutputStream out = new DicomOutputStream(file);
        testWriteDataset(out, null);
    }
View Full Code Here

        testWriteDataset(out, null);
    }

    @Test
    public void testWriteDataset() throws IOException {
        DicomOutputStream out = new DicomOutputStream(file);
        testWriteDataset(out, UID.ExplicitVRLittleEndian);
    }
View Full Code Here

        testWriteDataset(out, UID.ExplicitVRLittleEndian);
    }

    @Test
    public void testWriteDatasetWithGroupLength() throws IOException {
        DicomOutputStream out = new DicomOutputStream(file);
        out.setEncodingOptions(
                new DicomEncodingOptions(true, true, false, true, false));
        testWriteDataset(out, UID.ExplicitVRLittleEndian);
    }
View Full Code Here

        testWriteDataset(out, UID.ExplicitVRLittleEndian);
    }

    @Test
    public void testWriteDatasetWithoutUndefLength() throws IOException {
        DicomOutputStream out = new DicomOutputStream(file);
        out.setEncodingOptions(
                new DicomEncodingOptions(false, false, false, false, false));
        testWriteDataset(out, UID.ExplicitVRLittleEndian);
    }
View Full Code Here

        testWriteDataset(out, UID.ExplicitVRLittleEndian);
    }

    @Test
    public void testWriteDatasetWithUndefEmptyLength() throws IOException {
        DicomOutputStream out = new DicomOutputStream(file);
        out.setEncodingOptions(
                new DicomEncodingOptions(false, true, true, true, true));
        testWriteDataset(out, UID.ExplicitVRLittleEndian);
    }
View Full Code Here

TOP

Related Classes of org.dcm4che3.io.DicomOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.