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


Java PlanarImage.tileXToX方法代码示例

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


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

示例1: detectSegmentations

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public List<Shape> detectSegmentations(int minSegmentationSize, PlanarImage sourceImage) {
    logger.trace("getSegmentations (minSegmentation=" + minSegmentationSize + ")");
    rf.initializeClassColors();
    //if (rf.getNegativeChannel() != null) rf.getNegativeChannel().initializeClassColors();
    if (sourceImage == null) return new ArrayList<Shape>(0);
    short[][] smap = new short[sourceImage.getWidth()][sourceImage.getHeight()];

    for (int x = 0; x < sourceImage.getWidth(); x++)
        for (int y = 0; y < sourceImage.getHeight(); y++)
            smap[x][y] = Short.MAX_VALUE;

    // init
    Point[] tileArr = sourceImage.getTileIndices(null);
    int c;
    for (Point tileNum : tileArr) {
        if (isCancelled()) break;
        final int b = 2;

        Raster raster = sourceImage.getTile(tileNum.x, tileNum.y);
        for (int x = sourceImage.tileXToX(tileNum.x) + b; x < Math.min(sourceImage.tileXToX(tileNum.x) + sourceImage.getTileWidth() - b, sourceImage.getWidth()); x++) {
            for (int y = sourceImage.tileYToY(tileNum.y) + b; y < Math.min(sourceImage.tileYToY(tileNum.y) + sourceImage.getTileHeight() - b, sourceImage.getHeight()); y++) {
                if (fullRoi != null && !(fullRoi.contains(x + roi.getBounds().x, y + roi.getBounds().y))) {
                    continue;
                }

                c = raster.getSample(x, y, 0) < 200 ? 0 : 1; // dark=foreground, white=background (only red channel is taken into account)
                if (c == 0) {  // not background, not assigned
                    smap[x][y] = 1; // 1
                } else {
                    smap[x][y] = 0; // 0
                }
            } //y
        } // x
    } // tileNum


    if (isCancelled()) return null;
    return findPolygons(smap, minSegmentationSize);
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:40,代码来源:NerveDetectionWorker.java

示例2: detectSegmentations

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public List<Shape> detectSegmentations(int minSegmentationSize, PlanarImage sourceImage, Shape roi) {
    logger.trace("getSegmentations (minSegmentation=" + minSegmentationSize + ")");
    if (sourceImage == null) return new ArrayList<Shape>(0);
    short[][] smap = new short[sourceImage.getWidth()][sourceImage.getHeight()];

    for (int x = 0; x < sourceImage.getWidth(); x++)
        for (int y = 0; y < sourceImage.getHeight(); y++)
            smap[x][y] = Short.MAX_VALUE;

    // init
    Point[] tileArr = sourceImage.getTileIndices(null);
    int c;
    for (Point tileNum : tileArr) {
        if (isCancelled()) break;
        final int b = 2;

        Raster raster = sourceImage.getTile(tileNum.x, tileNum.y);
        for (int x = sourceImage.tileXToX(tileNum.x) + b; x < Math.min(sourceImage.tileXToX(tileNum.x) + sourceImage.getTileWidth() - b, sourceImage.getWidth()); x++) {
            for (int y = sourceImage.tileYToY(tileNum.y) + b; y < Math.min(sourceImage.tileYToY(tileNum.y) + sourceImage.getTileHeight() - b, sourceImage.getHeight()); y++) {
                if (fullRoi != null && !(fullRoi.contains(x + roi.getBounds().x, y + roi.getBounds().y))) {
                    continue;
                }

                c = raster.getSample(x, y, 0) < 200 ? 0 : 1; // dark=foreground, white=background (only red channel is taken into account)
                if (c == 0) {  // not background, not assigned
                    smap[x][y] = 1; // 1
                } else {
                    smap[x][y] = 0; // 0
                }
            } //y
        } // x
    } // tileNum


    if (isCancelled()) return null;
    return findPolygons(smap, orderPoints, minSegmentationSize, roi);
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:38,代码来源:NerveDetectionWorkerMultiCore.java

示例3: RandomIterFallback

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public RandomIterFallback(RenderedImage im, Rectangle bounds) {
    this.im = im;

    Rectangle imBounds = new Rectangle(im.getMinX(), im.getMinY(),
                                       im.getWidth(), im.getHeight());
    this.boundsRect = imBounds.intersection(bounds);
    this.sampleModel = im.getSampleModel();

    int x = boundsRect.x;
    int y = boundsRect.y;
    int width = boundsRect.width;
    int height = boundsRect.height;

    this.boundsX = boundsRect.x;
    this.boundsY = boundsRect.y;
    this.xTiles = new int[width];
    this.yTiles = new int[height];

    int tileWidth = im.getTileWidth();
    int tileGridXOffset = im.getTileGridXOffset();
    int minTileX = PlanarImage.XToTileX(x, tileGridXOffset, tileWidth);
    int offsetX =
        x - PlanarImage.tileXToX(minTileX, tileGridXOffset, tileWidth);
    int tileX = minTileX;

    for (int i = 0; i < width; i++) {
        xTiles[i] = tileX;
        ++offsetX;
        if (offsetX == tileWidth) {
            ++tileX;
            offsetX = 0;
        }
    }

    int tileHeight = im.getTileHeight();
    int tileGridYOffset = im.getTileGridYOffset();
    int minTileY = PlanarImage.YToTileY(y, tileGridYOffset, tileHeight);
    int offsetY =
        y - PlanarImage.tileYToY(minTileY, tileGridYOffset, tileHeight);
    int tileY = minTileY;

    for (int i = 0; i < height; i++) {
        yTiles[i] = tileY;
        ++offsetY;
        if (offsetY == tileHeight) {
            ++tileY;
            offsetY = 0;
        }
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:51,代码来源:RandomIterFallback.java


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