Package org.dcm4che3.imageio.codec

Examples of org.dcm4che3.imageio.codec.ImageReaderFactory$ImageReaderParam


        }
        return group != null ? group : imgAttrs;
    }

    private Attributes selectVOILUT(Attributes psAttrs, String iuid, int frame) {
        Sequence voiLUTs = psAttrs.getSequence(Tag.SoftcopyVOILUTSequence);
        if (voiLUTs != null)
            for (Attributes voiLUT : voiLUTs) {
                Sequence refImgs = voiLUT.getSequence(Tag.ReferencedImageSequence);
                if (refImgs == null || refImgs.isEmpty())
                    return voiLUT;
                for (Attributes refImg : refImgs) {
                    if (iuid.equals(refImg.getString(Tag.ReferencedSOPInstanceUID))) {
                        int[] refFrames = refImg.getInts(Tag.ReferencedFrameNumber);
                        if (refFrames == null)
View Full Code Here


        DicomInputStream dis = null;
        try {
            System.out.print("Validate: " + file + " ... ");
            dis = new DicomInputStream(file);
            Attributes attrs = dis.readDataset(-1, -1);
            ValidationResult result = attrs.validate(iod);
            if (result.isValid())
                System.out.println("OK");
            else {
                System.out.println("FAILED:");
                System.out.println(result.asText(attrs));
            }
        } catch (IOException e) {
            System.out.println("FAILED: " + e.getMessage());
        } finally {
            SafeClose.close(dis);
View Full Code Here

                    dParam.isPreferWindow());
            if (dParam.isAutoWindowing())
                lutParam.autoWindowing(imgAttrs, raster);
            lutParam.setPresentationLUT(imgAttrs);
        }
        LookupTable lut = lutParam.createLUT(outBits);
        lut.lookup(raster, destRaster);
        return destRaster;
    }
View Full Code Here

                sm.getDataType() == raster.getSampleModel().getDataType()
                        ? raster
                        : Raster.createWritableRaster(sm, null);
        Attributes imgAttrs = metadata.getAttributes();
        StoredValue sv = StoredValue.valueOf(imgAttrs);
        LookupTableFactory lutParam = new LookupTableFactory(sv);
        DicomImageReadParam dParam = param instanceof DicomImageReadParam
                ? (DicomImageReadParam) param
                : new DicomImageReadParam();
        Attributes psAttrs = dParam.getPresentationState();
        if (psAttrs != null) {
            lutParam.setModalityLUT(psAttrs);
            lutParam.setVOI(
                    selectVOILUT(psAttrs,
                            imgAttrs.getString(Tag.SOPInstanceUID),
                            frameIndex+1),
                    0, 0, false);
            lutParam.setPresentationLUT(psAttrs);
        } else {
            Attributes sharedFctGroups = imgAttrs.getNestedDataset(
                    Tag.SharedFunctionalGroupsSequence);
            Attributes frameFctGroups = imgAttrs.getNestedDataset(
                    Tag.PerFrameFunctionalGroupsSequence, frameIndex);
            lutParam.setModalityLUT(
                    selectFctGroup(imgAttrs, sharedFctGroups, frameFctGroups,
                            Tag.PixelValueTransformationSequence));
            if (dParam.getWindowWidth() != 0) {
                lutParam.setWindowCenter(dParam.getWindowCenter());
                lutParam.setWindowWidth(dParam.getWindowWidth());
            } else
                lutParam.setVOI(
                    selectFctGroup(imgAttrs, sharedFctGroups, frameFctGroups,
                            Tag.FrameVOILUTSequence),
                    dParam.getWindowIndex(),
                    dParam.getVOILUTIndex(),
                    dParam.isPreferWindow());
            if (dParam.isAutoWindowing())
                lutParam.autoWindowing(imgAttrs, raster);
            lutParam.setPresentationLUT(imgAttrs);
        }
        LookupTable lut = lutParam.createLUT(outBits);
        lut.lookup(raster, destRaster);
        return destRaster;
    }
View Full Code Here

         WritableRaster destRaster =
                sm.getDataType() == raster.getSampleModel().getDataType()
                        ? raster
                        : Raster.createWritableRaster(sm, null);
        Attributes imgAttrs = metadata.getAttributes();
        StoredValue sv = StoredValue.valueOf(imgAttrs);
        LookupTableFactory lutParam = new LookupTableFactory(sv);
        DicomImageReadParam dParam = param instanceof DicomImageReadParam
                ? (DicomImageReadParam) param
                : new DicomImageReadParam();
        Attributes psAttrs = dParam.getPresentationState();
View Full Code Here

            config.getAttributes(imageReadersDN);
        } catch (NameNotFoundException e) {
            return;
        }

        ImageReaderFactory factory = new ImageReaderFactory();
        NamingEnumeration<SearchResult> ne =
                config.search(imageReadersDN, "(objectclass=dcmImageReader)");
        try {
            while (ne.hasMore()) {
                SearchResult sr = ne.next();
                Attributes attrs = sr.getAttributes();
                factory.put(
                        LdapUtils.stringValue(attrs.get("dicomTransferSyntax"), null),
                        new ImageReaderParam(
                                LdapUtils.stringValue(
                                        attrs.get("dcmIIOFormatName"), null),
                                LdapUtils.stringValue(
View Full Code Here

        if (prevExt == null) {
            store(deviceDN, ext.getImageReaderFactory());
            return;
        }
        String imageReadersDN = CN_IMAGE_READER_FACTORY + deviceDN;
        ImageReaderFactory factory = ext.getImageReaderFactory();
        ImageReaderFactory prevFactory = prevExt.getImageReaderFactory();
        for (Entry<String, ImageReaderParam> entry : prevFactory.getEntries()) {
            String tsuid = entry.getKey();
            if (factory.get(tsuid) == null)
                config.destroySubcontext(dnOf(tsuid, imageReadersDN));
        }
        for (Entry<String, ImageReaderParam> entry : factory.getEntries()) {
            String tsuid = entry.getKey();
            String dn = dnOf(tsuid, imageReadersDN);
            ImageReaderParam prevParam = prevFactory.get(tsuid);
            if (prevParam == null)
                config.createSubcontext(dn,
                        storeTo(tsuid, entry.getValue(), new BasicAttributes(true)));
            else
                config.modifyAttributes(dn,
View Full Code Here

            throws BackingStoreException {
        if (!deviceNode.nodeExists("dcmImageReaderFactory"))
            return;
       
        Preferences prefs = deviceNode.node("dcmImageReaderFactory");
        ImageReaderFactory factory = new ImageReaderFactory();
        for (String tsuid : prefs.childrenNames())
            factory.put(tsuid, load(prefs.node(tsuid)));
       
        device.addDeviceExtension(new ImageReaderExtension(factory));       
    }
View Full Code Here

                        : ByteOrder.LITTLE_ENDIAN);
                this.frameLength = pmi.frameLength(width, height, samples, bitsAllocated);
                this.pixeldata = (BulkData) pixeldata;
            } else {
                String tsuid = dis.getTransferSyntax();
                ImageReaderParam param =
                        ImageReaderFactory.getImageReaderParam(tsuid);
                if (param == null)
                    throw new IOException("Unsupported Transfer Syntax: " + tsuid);
                this.decompressor = ImageReaderFactory.getImageReader(param);
                this.patchJpegLS = param.patchJPEGLS;
View Full Code Here

    private ImageInputStreamImpl iisOfFrame(int frameIndex)
            throws IOException {
        SegmentedInputImageStream siis = new SegmentedInputImageStream(
                iis, pixeldataFragments, frameIndex);
        return patchJpegLS != null
                ? new PatchJPEGLSImageInputStream(siis, patchJpegLS)
                : siis;
    }
View Full Code Here

TOP

Related Classes of org.dcm4che3.imageio.codec.ImageReaderFactory$ImageReaderParam

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.