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


Java PlanarImage.getTileWidth方法代码示例

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


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

示例1: toPlanarImage

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
/**
 * Creats a planar image based on an ImagePlus. The originalImage is just used for dimensions and tileSize (could be replaced by its int values).
 *
 * @param ip
 * @param originalImage
 * @param fg
 * @param bg
 * @return
 */
public static PlanarImage toPlanarImage(ImagePlus ip, PlanarImage originalImage, Color fg, Color bg) {
    TiledImageWriter imageWriter = new TiledImageWriter(originalImage.getWidth(), originalImage.getHeight(), originalImage.getTileWidth(), originalImage.getTileHeight());

    // resImg
    Point[] tileArr = imageWriter.getImage().getTileIndices(null);
    int[] p = new int[4];
    int[] bgArr = new int[]{bg.getRed(), bg.getGreen(), bg.getBlue(), 255};
    int[] fgArr = new int[]{fg.getRed(), fg.getGreen(), fg.getBlue(), 255};
    for (Point tileNum : tileArr) {
        WritableRaster writeRaster = imageWriter.getImage().getWritableTile(tileNum.x, tileNum.y);
        for (int x = imageWriter.getImage().tileXToX(tileNum.x); x < Math.min(imageWriter.getImage().tileXToX(tileNum.x) + imageWriter.getImage().getTileWidth(), imageWriter.getImage().getWidth()); x++)
            for (int y = imageWriter.getImage().tileYToY(tileNum.y); y < Math.min(imageWriter.getImage().tileYToY(tileNum.y) + imageWriter.getImage().getTileHeight(), imageWriter.getImage().getHeight()); y++) {
                p = ip.getPixel(x, y);
                if (p[0] != 0) p = fgArr;
                else p = bgArr;
                writeRaster.setPixel(x, y, p);  // since it is not a gray-scale image, we just use the red channel
            } // x,y
        imageWriter.getImage().releaseWritableTile(tileNum.x, tileNum.y);
    } // tileNum

    return imageWriter.getImage();
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:32,代码来源:IJUtils.java

示例2: TiledImageWriter

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public TiledImageWriter(PlanarImage inputImage, int xOffs, int yOffs) {
    this.width = inputImage.getWidth();
    this.height = inputImage.getHeight();
    this.tileWidth = inputImage.getTileWidth();
    this.tileHeight = inputImage.getTileHeight();
    colorModel = new ComponentColorModel(
            ColorSpace.getInstance(ColorSpace.CS_sRGB),
            new int[]{8, 8, 8, 8}, true, false,
            Transparency.TRANSLUCENT,
            DataBuffer.TYPE_BYTE);
    sampleModel = colorModel.createCompatibleSampleModel(tileWidth, tileHeight);
    image = new DiskMemImageOrbit(xOffs, yOffs, width, height, 0, 0, sampleModel, colorModel);
    ((DiskMemImageOrbit) image).setUseCommonCache(true);

    TiledImagePainter painter = new TiledImagePainter(inputImage, "");
    Graphics2D g2d = image.createGraphics();
    try { // 03.05.2010 Manuel (exception with JRE 1.5, with JRE 1.6 fine)
        painter.drawImage(g2d, xOffs, yOffs, width, height, 100d, -1);
    } catch (Throwable e) {
        //System.out.println("TiledImageWriter Error",e);
        //e.printStackTrace();
    }
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:24,代码来源:TiledImageWriter.java

示例3: OrbitTiledImagePlanarImage

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public OrbitTiledImagePlanarImage(PlanarImage image) throws Exception {
        super("");
        this.image = image;
        this.width = image.getWidth();
        this.height = image.getHeight();
        this.tileWidth = image.getTileWidth();
        this.tileHeight = image.getTileHeight();
        this.tileGridXOffset = image.getTileGridXOffset();
        this.tileGridYOffset = image.getTileGridYOffset();
        this.minX = image.getMinX();
        this.minY = image.getMinY();
        this.numBands = image.getNumBands();

        this.colorModel = image.getColorModel();
        this.sampleModel = image.getSampleModel();

//		if (numBands==1) this.colorModel = grayColorModel; else
//		{
//			this.colorModel = rgbColorModel;
//		}

//		this.colorModel = rgbColorModel; // an OrbitTiledImage is always a RGB image
//		this.sampleModel = colorModel.createCompatibleSampleModel(tileWidth, tileHeight);

        // bugfix 20.04.2012 Manuel: colorModel is now always defined by input image (overview image problem)
        this.colorModel = image.getColorModel();
        this.sampleModel = image.getSampleModel();
        this.filename = "PlanarImage " + image.hashCode();
        // better set useCache always to false here???
    }
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:31,代码来源:OrbitTiledImagePlanarImage.java

示例4: getRenderingHints

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
/**
 * Defines RenderingHints for JAI create operations (otherwise JAI will use defaultTileSize tiling)
 *
 * @param image
 * @return
 */
public static RenderingHints getRenderingHints(PlanarImage image) {
    ImageLayout layout = new ImageLayout(image.getMinX(), image.getMinY(), image.getWidth(), image.getHeight(), image.getTileGridXOffset(), image.getTileGridYOffset(), image.getTileWidth(), image.getTileHeight(), image.getSampleModel(), image.getColorModel());
    RenderingHints renderingHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
    return renderingHints;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:12,代码来源:ManipulationUtils.java


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