当前位置: 首页>>代码示例>>Java>>正文


Java PlanarImage.wrapRenderedImage方法代码示例

本文整理汇总了Java中javax.media.jai.PlanarImage.wrapRenderedImage方法的典型用法代码示例。如果您正苦于以下问题:Java PlanarImage.wrapRenderedImage方法的具体用法?Java PlanarImage.wrapRenderedImage怎么用?Java PlanarImage.wrapRenderedImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.media.jai.PlanarImage的用法示例。


在下文中一共展示了PlanarImage.wrapRenderedImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeROIImage

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private RecognitionFrame makeROIImage(RecognitionFrame rf, Shape roi) {
    TiledImagePainter ci = rf.bimg;
    if (roi != null) {
        Rectangle roiBounds = roi.getBounds();
        if (logger.isTraceEnabled() && (roiBounds.getWidth() == 0 || roiBounds.getHeight() == 0)) {
            logger.trace("Warning: ROI bounds with width=0 or height=0. Skipping tile.");
            //return null; // instead an error message will be thrown in getAsBufferedImage
        }
        BufferedImage bi = rf.bimg.getImage().getAsBufferedImage(roiBounds, rf.bimg.getImage().getColorModel());
        ci = new TiledImagePainter(PlanarImage.wrapRenderedImage(bi), "roi");
        ci.getImage().setUseCache(false);
    }
    RecognitionFrame rf2 = new RecognitionFrame(ci);
    rf2.setClassShapes(rf.getClassShapes());
    rf2.initializeClassColors();
    ci.getImage().setUseCache(false);
    return rf2;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:19,代码来源:ObjectSegmentationWorker.java

示例2: process

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public PlanarImage process(final PlanarImage image) {
    if (image == null || (image.getWidth() * image.getHeight() > 6000 * 6000L))
        throw new IllegalArgumentException("this implementation can only handle images where width*height<=6000*6000. (And image cannot be null)");

    TMAPointsResult res = findCircles(image);
    this.radius = res.getRadius();
    List<Point> pList = res.getSpotList();

    HashMap<Point, Point> pMap = clusterLines(pList);
    pMap = discardDuplicatePoints(pMap);

    BufferedImage buffImg = res.getSpotImage();
    Graphics g = buffImg.createGraphics();
    g.setColor(Color.blue);
    g.setFont(new Font("System", Font.PLAIN, 9));
    for (Point p : pMap.keySet()) {
        Point pos = pMap.get(p);
        g.drawString(pos.x + "/" + pos.y, p.x, p.y);
    }

    spotMap = pMap;

    return PlanarImage.wrapRenderedImage(buffImg);
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:25,代码来源:TMAPoints.java

示例3: cellFeaturesBasic

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
@Test
public void cellFeaturesBasic() {
    BufferedImage bi = new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB);
    Color c1 = new Color(1, 2, 3);
    Color c2 = new Color(4, 8, 16);
    bi.setRGB(10, 10, c2.getRGB());
    bi.setRGB(8, 8, c1.getRGB());
    bi.setRGB(12, 12, c1.getRGB());

    TiledImagePainter tip = new TiledImagePainter(PlanarImage.wrapRenderedImage(bi), "test");
    RecognitionFrame rf = new RecognitionFrame(tip);
    Shape shape = new RectangleExt(9, 9, 3, 3);

    ObjectFeatureBuilderTiled cellFeatureBuilder = new ObjectFeatureBuilderTiled(null);
    double[] feats = cellFeatureBuilder.buildFeatures(shape, 1, rf, null, 3, 0, 0);
    assertEquals(4d, feats[1], delta);
    assertEquals(8d, feats[5], delta);
    assertEquals(16d, feats[9], delta);
    assertEquals(1d, feats[23], delta); // class

    System.out.println(Arrays.toString(feats));


}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:25,代码来源:TestCellFeaturesBasic.java

示例4: setup

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
@Before
public void setup() {

    sourceImages1 = new RenderedImage[]{
            ConstantDescriptor.create(10.0f, 10.0f, new Float[]{2.0f}, null),
            ConstantDescriptor.create(10.0f, 10.0f, new Float[]{3.0f}, null),
            ConstantDescriptor.create(10.0f, 10.0f, new Float[]{5.0f}, null),
            ConstantDescriptor.create(10.0f, 10.0f, new Float[]{7.0f}, null)
    };
    sourceImages2 = new RenderedImage[]{
            ConstantDescriptor.create(10.0f, 10.0f, new Float[]{7.0f}, null),
            ConstantDescriptor.create(10.0f, 10.0f, new Float[]{5.0f}, null),
            ConstantDescriptor.create(10.0f, 10.0f, new Float[]{3.0f}, null),
            ConstantDescriptor.create(10.0f, 10.0f, new Float[]{2.0f}, null)
    };

    alphaImages = new PlanarImage[]{
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{1.0f}, null)),
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{2.0f}, null)),
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{3.0f}, null)),
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{4.0f}, null))
    };


}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:26,代码来源:S2tbxMosaicOpImageTest.java

示例5: testMosaicUpdate

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
@Test
public void testMosaicUpdate() {
    final RenderedOp firstImage = MosaicDescriptor.create(Arrays.copyOf(sourceImages1, 3),
                                                          MosaicDescriptor.MOSAIC_TYPE_OVERLAY,
                                                          Arrays.copyOf(alphaImages, 3), null, null, null, null);
    final PlanarImage[] alphaUpdateImages = {
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{6.0f}, null)),
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{4.0f}, null))
    };
    final RenderedImage[] sourceUpdateImages = {firstImage, sourceImages1[3]};
    final RenderedOp updatedImage = MosaicDescriptor.create(sourceUpdateImages,
                                                            MosaicDescriptor.MOSAIC_TYPE_OVERLAY,
                                                            alphaUpdateImages, null, null, null, null);

    final Raster data = updatedImage.getData();
    float sample = data.getSampleFloat(0, 0, 0);
    assertEquals(2.0f, sample, 0.0f);
    sample = data.getSampleFloat(5, 5, 0);
    assertEquals(2.0f, sample, 0.0f);
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:21,代码来源:S2tbxMosaicOpImageTest.java

示例6: testMosaicUpdateWithNewSourceImages

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
@Test
public void testMosaicUpdateWithNewSourceImages() {
    final RenderedOp firstImage = MosaicDescriptor.create(Arrays.copyOf(sourceImages2, 3),
            MosaicDescriptor.MOSAIC_TYPE_OVERLAY,
            Arrays.copyOf(alphaImages, 3), null, null, null, null);
    final PlanarImage[] alphaUpdateImages = {
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{6.0f}, null)),
            PlanarImage.wrapRenderedImage(ConstantDescriptor.create(10.0f, 10.0f, new Float[]{4.0f}, null))
    };
    final RenderedImage[] sourceUpdateImages = {firstImage, sourceImages2[3]};
    final RenderedOp updatedImage = MosaicDescriptor.create(sourceUpdateImages,
            MosaicDescriptor.MOSAIC_TYPE_OVERLAY,
            alphaUpdateImages, null, null, null, null);

    final Raster data = updatedImage.getData();
    float sample = data.getSampleFloat(0, 0, 0);
    assertEquals(7.0f, sample, 0.0f);
    sample = data.getSampleFloat(5, 5, 0);
    assertEquals(7.0f, sample, 0.0f);
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:21,代码来源:S2tbxMosaicOpImageTest.java

示例7: createFloatPlanarImage

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public static PlanarImage createFloatPlanarImage(float[] src, int width, int height){
    int[] bandOffsets = {0};

    SampleModel sampleModel = new PixelInterleavedSampleModel(TYPE_FLOAT, width, height, 1, width, bandOffsets);
    ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_GRAY);
    ColorModel colorModel = new ComponentColorModel(colorSpace, false, false, Transparency.TRANSLUCENT, TYPE_FLOAT);
    PlanarImage opImage;
    DataBuffer buffer = new DataBufferFloat(width * height);

    // Wrap it in a writable raster
    WritableRaster raster = Raster.createWritableRaster(sampleModel, buffer, null);
    raster.setPixels(0, 0, width, height, src);

    // Create an image with this raster
    BufferedImage image = new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), null);
    opImage = PlanarImage.wrapRenderedImage(image);
    return opImage;
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:19,代码来源:S2ResamplerUtils.java

示例8: doInBackground

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
@Override
protected Image doInBackground() throws Exception {
    RenderedImage sourceImage = FileLoadDescriptor.create(imageFilePath, null, true, null);
    int width = sourceImage.getWidth();
    int height = sourceImage.getHeight();

    float scale = (float) (targetDimension.getWidth() / width);
    scale = (float) Math.min(scale, targetDimension.getHeight() / height);
    if (scale > 1) {
        scale = 1.0f;
    }

    Interpolation interpolation = Interpolation.getInstance(Interpolation.INTERP_NEAREST);
    RenderedImage scaledImage = ScaleDescriptor.create(sourceImage,
                                                       scale, scale,
                                                       0.0f, 0.0f,
                                                       interpolation, null);
    PlanarImage planarImage = PlanarImage.wrapRenderedImage(scaledImage);
    BufferedImage bufferedImage = planarImage.getAsBufferedImage();
    planarImage.dispose();
    return bufferedImage;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:23,代码来源:ImageFileAssistantPage1.java

示例9: makeROIImage

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private PlanarImage makeROIImage(RecognitionFrame rf) {
    PlanarImage img = rf.bimg.getImage();
    if (getRfROISize() <= 5000 * 5000L) {
        if (rf.getROI() != null) {
            roi = rf.getROI().getScaledInstance(100d, new Point(0, 0));
        }
        if (roi != null) {
            BufferedImage bi = rf.bimg.getImage().getAsBufferedImage(roi.getBounds(), rf.bimg.getImage().getColorModel());
            img = PlanarImage.wrapRenderedImage(bi);
            roiOffsX = Math.max(roi.getBounds().x, 0);
            roiOffsY = Math.max(roi.getBounds().y, 0);
        }
    }
    return img;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:16,代码来源:NerveDetectionWorker.java

示例10: makeROIImage

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private PlanarImage makeROIImage(RecognitionFrame rf) {
    PlanarImage img = rf.bimg.getImage();
    if (getSize() <= 5000 * 5000L) {
        if (rf.getROI() != null) {
            roi = rf.getROI().getScaledInstance(100d, new Point(0, 0));
        }
        if (roi != null) {
            BufferedImage bi = rf.bimg.getImage().getAsBufferedImage(roi.getBounds(), rf.bimg.getImage().getColorModel());
            img = PlanarImage.wrapRenderedImage(bi);
            roiOffsX = Math.max(roi.getBounds().x, 0);
            roiOffsY = Math.max(roi.getBounds().y, 0);
        }
    }
    return img;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:16,代码来源:NerveDetectionWorkerMultiCore.java

示例11: findCirclesUEP

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private TMAPointsResult findCirclesUEP(PlanarImage image) {
    ImagePlus ip = new ImagePlus("TMAPoints", image.getAsBufferedImage());

    // blur: this fills small 'holes'
    GaussianBlur blur = new GaussianBlur();
    blur.blur(ip.getProcessor(), 2d);

    // Make Binary
    thresholder.applyThreshold(ip);

    // fill holes
    binary.setup("fill", null);
    binary.run(ip.getProcessor());

    // open
    binary.setup("open", null);
    binary.run(ip.getProcessor());

    // UEP
    edm.setup("points", null); // "points" for Ultimate points
    edm.run(ip.getProcessor());

    PlanarImage img = PlanarImage.wrapRenderedImage(ip.getBufferedImage());
    List<Point> pList = reportPoints(img, 1);
    double radius = guessRadius(pList);
    return new TMAPointsResult(pList, radius, ip.getBufferedImage());
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:28,代码来源:TMAPoints.java

示例12: main

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    OrbitUtils.getTag();
    BufferedImage bi = ImageIO.read(new File("d:/nuclei.jpg"));
    PlanarImage pi = PlanarImage.wrapRenderedImage(bi);
    CytoplasmaSegmentation seg = new CytoplasmaSegmentation();
    SegmentationResult res = seg.process(pi);
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:8,代码来源:CytoplasmaSegmentation.java

示例13: adjustBlur

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public static PlanarImage adjustBlur(PlanarImage srcImg, final int b) {
    final int width = srcImg.getWidth();
    final int height = srcImg.getHeight();
    final int[] src = srcImg.getData().getPixels(0, 0, width, height, new int[width * height * 3]);
    final int[] dest = new int[width * height * 3];

    for (int l = 0; l < b; l++) {
        if (l == 0) {
            int dum;
            for (int i = 0; i < src.length - 3; i += 3) {
                dum = src[i + 0];
                src[i + 0] = src[i + 2];
                src[i + 2] = dum;
            }
        } else {
            for (int i = 0; i < src.length - 3; i += 3) {
                src[i + 0] = dest[i + 0];
                src[i + 1] = dest[i + 1];
                src[i + 2] = dest[i + 2];
            }
        }
        for (int i = width * 3 + 3; i < src.length - 3 - width * 3; i += 3) {
            dest[i + 0] = (src[i + 0] + src[i + 0 + 3] + src[i + 0 - 3] + src[i + 0 - width * 3] + src[i + 0 + 3 - width * 3] + src[i + 0 - 3 - width * 3] + src[i + 0 + width * 3] + src[i + 0 + 3 + width * 3] + src[i + 0 - 3 + width * 3]) / 9;
            dest[i + 1] = (src[i + 1] + src[i + 1 + 3] + src[i + 1 - 3] + src[i + 1 - width * 3] + src[i + 1 + 3 - width * 3] + src[i + 1 - 3 - width * 3] + src[i + 1 + width * 3] + src[i + 1 + 3 + width * 3] + src[i + 1 - 3 + width * 3]) / 9;
            dest[i + 2] = (src[i + 2] + src[i + 2 + 3] + src[i + 2 - 3] + src[i + 2 - width * 3] + src[i + 2 + 3 - width * 3] + src[i + 2 - 3 - width * 3] + src[i + 2 + width * 3] + src[i + 2 + 3 + width * 3] + src[i + 2 - 3 + width * 3]) / 9;
        }
    }

    DataBufferByte db = new DataBufferByte(dest.length);
    for (int i = 0; i < dest.length; i++) {
        db.setElem(i, dest[i]);
    }
    WritableRaster raster = WritableRaster.createWritableRaster(srcImg.getSampleModel(), db, new Point(0, 0));
    BufferedImage bi = new BufferedImage(srcImg.getColorModel(), raster, srcImg.getColorModel().isAlphaPremultiplied(), null);
    return PlanarImage.wrapRenderedImage(bi);
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:37,代码来源:GBlur.java

示例14: main

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public static void main(String[] args) {
    BufferedImage img = new BufferedImage(4000,4000,BufferedImage.TYPE_INT_RGB);
    PlanarImage pi = PlanarImage.wrapRenderedImage(img);
    for (BufferedImage tileImg: new ImageTiler(pi,512,512)) {
        System.out.println(tileImg);
    }

}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:9,代码来源:ImageTiler.java

示例15: NDPIImageNative

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public NDPIImageNative(String filename, int level) throws Exception {
    super(filename, level, false);
    logger.trace("loading NDPI image using native ndpi library: "+filename+" ["+level+"]");
    BufferedImage bi = new BufferedImage(getTileWidth(), getTileHeight(), BufferedImage.TYPE_3BYTE_BGR);
    PlanarImage image = PlanarImage.wrapRenderedImage(bi);
    if (image.getSampleModel() != null && (!image.getSampleModel().equals(sampleModel))) {
        this.sampleModel = image.getSampleModel();
    }
    if (level >= getNumLevels())
        throw new OrbitImageServletException("level " + level + " >= numLevels (" + getNumLevels() + ")");
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:12,代码来源:NDPIImageNative.java


注:本文中的javax.media.jai.PlanarImage.wrapRenderedImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。