Package org.dcm4che3.data

Examples of org.dcm4che3.data.DatePrecision


        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

    @Test
    public void testFormatDTwithTZ() {
        assertEquals("19700101020000.000+0200",
                DateUtils.formatDT(tz, new Date(0),
                        new DatePrecision(Calendar.MILLISECOND, true)));
    }
View Full Code Here

                DateUtils.parseDA(tz, "19700101", true).getTime());
    }

    @Test
    public void testParseTM() {
        DatePrecision precision = new DatePrecision();
        assertEquals(0,
                DateUtils.parseTM(tz, "020000.000", precision).getTime());
        assertEquals(Calendar.MILLISECOND, precision.lastField);
    }
View Full Code Here

        assertEquals(Calendar.MILLISECOND, precision.lastField);
    }

    @Test
    public void testParseTMacrnema() {
        DatePrecision precision = new DatePrecision();
        assertEquals(0,
                DateUtils.parseTM(tz, "02:00:00", precision).getTime());
        assertEquals(Calendar.SECOND, precision.lastField);
    }
View Full Code Here

        assertEquals(Calendar.SECOND, precision.lastField);
    }

    @Test
    public void testParseTMceil() {
        DatePrecision precision = new DatePrecision();
        assertEquals(MINUTE - 1,
                DateUtils.parseTM(tz, "0200", true, precision).getTime());
        assertEquals(Calendar.MINUTE, precision.lastField);
    }
View Full Code Here

        assertEquals(Calendar.MINUTE, precision.lastField);
    }

    @Test
    public void testParseDT() {
        DatePrecision precision = new DatePrecision();
        assertEquals(0,
                DateUtils.parseDT(tz, "19700101020000.000", precision).getTime());
        assertEquals(Calendar.MILLISECOND, precision.lastField);
        assertFalse(precision.includeTimezone);
    }
View Full Code Here

        assertFalse(precision.includeTimezone);
    }

    @Test
    public void testParseWithTZ() {
        DatePrecision precision = new DatePrecision();
        assertEquals(2 * HOUR,
                DateUtils.parseDT(tz, "19700101020000.000+0000", precision).getTime());
        assertEquals(Calendar.MILLISECOND, precision.lastField);
        assertTrue(precision.includeTimezone);
    }
View Full Code Here

        assertTrue(precision.includeTimezone);
    }

    @Test
    public void testParseDTceil() {
        DatePrecision precision = new DatePrecision();
        assertEquals(YEAR - 2 * HOUR - 1,
                DateUtils.parseDT(tz, "1970", true, precision).getTime());
        assertEquals(Calendar.YEAR, precision.lastField);
        assertFalse(precision.includeTimezone);
    }
View Full Code Here

TOP

Related Classes of org.dcm4che3.data.DatePrecision

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.