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


Java ImageLayout.setColorModel方法代码示例

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


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

示例1: create

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
 * Wrap the src coverage in the dst layout. <BR>
 * The resulting RenderedImage will contain the data in src, and will be accessible via the grid specs of dst,
 * 
 * @param src the data coverage to be remapped on dst grid
 * @param dst the provider of the final grid
 * @param nodata the nodata value to set for cells not covered by src but included in dst. All bands will share the same nodata value.
 * @return an instance of Coverage2RenderedImageAdapter
 */
public static GridCoverage2DRIA create(final GridCoverage2D src, final GridCoverage2D dst,
        final double nodata) {

    // === Create Layout
    final ImageLayout imageLayout = new ImageLayout(dst.getRenderedImage());

    //
    // SampleModel and ColorModel are related to data itself, so we
    // copy them from the source

    imageLayout.setColorModel(src.getRenderedImage().getColorModel());
    imageLayout.setSampleModel(src.getRenderedImage().getSampleModel());

    // === BorderExtender
    //
    // We have yet to check for it usefulness: it might be more convenient
    // to check for region overlapping and return a nodata value by hand,
    // so to avoid problems with interpolation at source raster borders.
    //
    BorderExtender extender = new BorderExtenderConstant(new double[] { nodata });

    return new GridCoverage2DRIA(src, dst, vectorize(src.getRenderedImage()), imageLayout,
            null, false, extender, Interpolation.getInstance(Interpolation.INTERP_NEAREST),
            new double[] { nodata });
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:35,代码来源:GridCoverage2DRIA.java

示例2: makeTiledImage

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
private PlanarImage makeTiledImage(PlanarImage img, int tileWidth, int tileHeight) {
    ImageLayout tileLayout = new ImageLayout(img);
    tileLayout.setTileWidth(tileWidth);
    tileLayout.setTileHeight(tileHeight);
    tileLayout.setSampleModel(img.getColorModel().createCompatibleSampleModel(tileWidth,tileHeight));
    tileLayout.setColorModel(img.getColorModel());
    RenderingHints tileHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, tileLayout);
    ParameterBlock pb = new ParameterBlock();
    pb.addSource(img);
    PlanarImage pi = JAI.create("format", pb, tileHints);
    pi.getWidth();
    return pi;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:14,代码来源:ImageTiler.java

示例3: layoutHelper

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
 * Sets up the image layout information for this Op.
 * The minX, minY, width, and height are calculated based on
 * the source's dimension and padding values. Any of these
 * values specified in the layout parameter is ignored.
 * All other variables are taken from the layout parameter or
 * inherited from the source.
 */
private static ImageLayout layoutHelper(ImageLayout layout,
                                        RenderedImage source,
                                        int leftPad,
                                        int rightPad,
                                        int topPad,
                                        int bottomPad) {
    ImageLayout il = layout == null ?
        new ImageLayout() : (ImageLayout)layout.clone();

    // Set the image bounds according to the padding.
    il.setMinX(source.getMinX() - leftPad);
    il.setMinY(source.getMinY() - topPad);
    il.setWidth(source.getWidth() + leftPad + rightPad);
    il.setHeight(source.getHeight() + topPad + bottomPad);

    // Set tile grid offset to minimize the probability that a
    // tile's bounds does not intersect the source image bounds.
    if(!il.isValid(ImageLayout.TILE_GRID_X_OFFSET_MASK)) {
        il.setTileGridXOffset(il.getMinX(null));
    }

    if (!il.isValid(ImageLayout.TILE_GRID_Y_OFFSET_MASK)) {
        il.setTileGridYOffset(il.getMinY(null));
    }

    // Force inheritance of source image SampleModel and ColorModel.
    il.setSampleModel(source.getSampleModel());
    il.setColorModel(source.getColorModel());

    return il;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:40,代码来源:BorderOpImage.java

示例4: layoutHelper

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
    * Force the destination image to be single-banded.
    */
   private static ImageLayout layoutHelper(ImageLayout layout,
                                           RenderedImage source) {
       // Create or clone the layout.
       ImageLayout il = layout == null ?
    new ImageLayout() : (ImageLayout)layout.clone();

       // Force the destination and source origins and dimensions to coincide.
       il.setMinX(source.getMinX());
       il.setMinY(source.getMinY());
       il.setWidth(source.getWidth());
       il.setHeight(source.getHeight());

       // Get the SampleModel.
       SampleModel sm = il.getSampleModel(source);

       // Make sure that this OpImage is single-banded.
       if (sm.getNumBands() != 1) {
           sm =
               RasterFactory.createComponentSampleModel(sm,
                                                        sm.getTransferType(),
                                                        sm.getWidth(),
                                                        sm.getHeight(),
                                                        1);
    il.setSampleModel(sm);
       }

       il.setColorModel(null);

return il;
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:34,代码来源:ColorQuantizerOpImage.java

示例5: getImageLayout

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
@Override
public ImageLayout getImageLayout(String name) throws IOException
{
  log.fine("Getting JAI layout for: " + name);

  if (!checkName(name)) {
    throw new IllegalArgumentException("The specified coverage " + name + "is not found");
  }

  // get the pixel size of the base image
  try
  {
    MrsImageDataProvider dp = DataProviderFactory
        .getMrsImageDataProvider(name, DataProviderFactory.AccessMode.READ, providerProperties);
    MrsPyramidMetadata meta = dp.getMetadataReader().read();

    LongRectangle bounds = meta.getPixelBounds(meta.getMaxZoomLevel());

    ImageLayout layout = new ImageLayout();
    layout.setMinX(0);
    layout.setMinY(0);
    layout.setWidth((int)bounds.getWidth());
    layout.setHeight((int)bounds.getHeight());

    // only 1 tile!
    layout.setTileGridXOffset(0);
    layout.setTileGridYOffset(0);

    layout.setTileWidth((int)bounds.getWidth());
    layout.setTileHeight((int)bounds.getHeight());

    MrsImageReader r = dp.getMrsTileReader(meta.getMaxZoomLevel());

    final Iterator<MrGeoRaster> it = r.get();
    try
    {
      Raster raster = it.next().toRaster();

      layout.setColorModel(RasterUtils.createColorModel(raster));
      layout.setSampleModel(raster.getSampleModel());
    }
    finally
    {
      if (!r.canBeCached() && it instanceof Closeable)
      {
        ((Closeable) it).close();
        r.close();
      }
    }

    return layout;
  }
  catch (IOException e)
  {
    e.printStackTrace();
  }

  return null;

}
 
开发者ID:ngageoint,项目名称:mrgeo-geoserver-plugin,代码行数:61,代码来源:MrGeoReader.java


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