Package org.dcm4che3.data

Examples of org.dcm4che3.data.BulkData


            Attributes frameFctGroups,
            int tag) {
        if (frameFctGroups == null) {
            return imgAttrs;
        }
        Attributes group = frameFctGroups.getNestedDataset(tag);
        if (group == null && sharedFctGroups != null) {
            group = sharedFctGroups.getNestedDataset(tag);
        }
        return group != null ? group : imgAttrs;
    }
View Full Code Here


        dis = new DicomInputStream(new ImageInputStreamAdapter(iis));
        dis.setIncludeBulkData(IncludeBulkData.URI);
        dis.setBulkDataDescriptor(BulkDataDescriptor.PIXELDATA);
        dis.setURI("java:iis"); // avoid copy of pixeldata to temporary file
        Attributes fmi = dis.readFileMetaInformation();
        Attributes ds = dis.readDataset(-1, -1);
        metadata = new DicomMetaData(fmi, ds);
        Object pixeldata = ds.getValue(Tag.PixelData, pixeldataVR );
        if (pixeldata != null) {
            frames = ds.getInt(Tag.NumberOfFrames, 1);
            width = ds.getInt(Tag.Columns, 0);
            height = ds.getInt(Tag.Rows, 0);
            samples = ds.getInt(Tag.SamplesPerPixel, 1);
            banded = samples > 1 && ds.getInt(Tag.PlanarConfiguration, 0) != 0;
            bitsAllocated = ds.getInt(Tag.BitsAllocated, 8);
            bitsStored = ds.getInt(Tag.BitsStored, bitsAllocated);
            dataType = bitsAllocated <= 8 ? DataBuffer.TYPE_BYTE
                                          : DataBuffer.TYPE_USHORT;
            pmi = PhotometricInterpretation.fromString(
                    ds.getString(Tag.PhotometricInterpretation, "MONOCHROME2"));
            if (pixeldata instanceof BulkData) {
                iis.setByteOrder(ds.bigEndian()
                        ? ByteOrder.BIG_ENDIAN
                        : ByteOrder.LITTLE_ENDIAN);
                this.frameLength = pmi.frameLength(width, height, samples, bitsAllocated);
                this.pixeldata = (BulkData) pixeldata;
            } else {
View Full Code Here

        }
    }

    private BulkData extractPixelData(BulkData src, int frame,
            int length) {
        return new BulkData(src.uriWithoutOffsetAndLength(),
                src.offset + frame * length, length,
                src.bigEndian);
    }
View Full Code Here

        dataset.setBytes("PRIVATE", 0x00090002, VR.OB, BYTE01);
        dataset.setDouble(Tag.FrameTime, VR.DS, 33.0);
        dataset.setInt(Tag.SamplesPerPixel, VR.US, 1);
        dataset.setInt(Tag.NumberOfFrames, VR.IS, 1);
        dataset.setInt(Tag.FrameIncrementPointer, VR.AT, Tag.FrameTime);
        dataset.setValue(Tag.OverlayData, VR.OW, new BulkData(null, "file:/OverlayData", false));
        Fragments frags = dataset.newFragments(Tag.PixelData, VR.OB, 2);
        frags.add(null);
        frags.add(new BulkData(null, "file:/PixelData", false));
        StringWriter writer = new StringWriter();
        JsonGenerator gen = Json.createGenerator(writer);
        new JSONWriter(gen).write(dataset);
        gen.flush();
        assertEquals(RESULT, writer.toString());
View Full Code Here

    public SegmentedInputImageStream(ImageInputStream stream,
            Fragments pixeldataFragments, int frameIndex) throws IOException {
        long[] offsets = new long[pixeldataFragments.size()-(frameIndex+1)];
        int[] length = new int[offsets.length];
        for (int i = 0; i < length.length; i++) {
            BulkData bulkData = (BulkData) pixeldataFragments.get(i+frameIndex+1);
            offsets[i] = bulkData.offset;
            length[i] = bulkData.length;
        }
        this.stream = stream;
        this.segmentPositionsList = offsets;
View Full Code Here

        ds.setNull(Tag.AccessionNumber, VR.SH);
        ds.newSequence(Tag.RequestAttributesSequence, 1)
                .add(requestAttributes());
        ds.setString(Tag.SOPClassUID, VR.UI, "1.2.3.4");
        ds.setString(Tag.SOPInstanceUID, VR.UI, "4.3.2.1");
        BulkData bdl = new BulkData(
                uri("OT-PAL-8-face"), 1654, 307200, false);
        ds.setValue(Tag.PixelData, VR.OW, bdl);
        Fragments frags = ds.newFragments("DicomOutputStreamTest", 0x99990010, VR.OB, 3);
        frags.add(null);
        frags.add(new byte[] { 1, 2, 3, 4 });
View Full Code Here

            break;
        }
   }

    private void bulkData(String uuid, String uri) {
        bulkData = new BulkData(uuid, uri, items.getLast().bigEndian());
    }
View Full Code Here

                setFileMetaInformationGroupLength(b);
        }
    }

    public BulkData createBulkData() throws IOException {
            BulkData bulkData;
        if (uri != null && !(super.in instanceof InflaterInputStream)) {
            bulkData = new BulkData(uri, pos, length, bigEndian);
            skipFully(length);
        } else {
            if (blkOut == null) {
                File blkfile = File.createTempFile(blkFilePrefix,
                        blkFileSuffix, blkDirectory);
                if (blkFiles == null)
                    blkFiles = new ArrayList<File>();
                blkFiles.add(blkfile);
                blkURI = blkfile.toURI().toString();
                blkOut = new FileOutputStream(blkfile);
                blkOutPos = 0L;
            }
            try {
                StreamUtils.copy(this, blkOut, length);
            } finally {
                if (!catBlkFiles) {
                    SafeClose.close(blkOut);
                    blkOut = null;
                }
            }
            bulkData = new BulkData(blkURI, blkOutPos, length, bigEndian);
            blkOutPos += length;
        }
        return bulkData;
    }
View Full Code Here

        if (next() != Event.VALUE_STRING) {
            throw new JsonParsingException("Unexpected " + event
                    + ", expected bulk data URI", location);
        }
        String uri = parser.getString();
        return new BulkData(null, uri, bigEndian);
    }
View Full Code Here

                     //do pdf check here
                if (isExtension(bulkDataFile, "pdf")) {
                    // set document metadata
                    isPDF = true;
                    metadata.setValue(Tag.EncapsulatedDocument, VR.OB,
                            new BulkData(null, "bulk", false));
                } else {
                    isPDF = false;
                    // images or video
                    metadata.setValue(Tag.PixelData, VR.OB, new BulkData(null,
                            "bulk", false));
                }
                // add URI here
                if (files.size() > 1)
                    throw new IllegalArgumentException(
View Full Code Here

TOP

Related Classes of org.dcm4che3.data.BulkData

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.