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


Java Opener.setSilentMode方法代码示例

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


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

示例1: loadImage

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Load image.
 *
 * @return the image plus
 */
public ImagePlus loadImage()
{
	if (!hasImage())
		return null;

	Opener opener = new Opener();
	opener.setSilentMode(true);

	// The tifPath may be a system resource or it may be a file 
	File file = new File(tifPath);
	if (file.exists())
	{
		// Load directly from a file path
		return opener.openImage(tifPath);
	}

	// IJ has support for loading TIFs from an InputStream
	Class<ConfigurationTemplate> resourceClass = ConfigurationTemplate.class;
	InputStream inputStream = resourceClass.getResourceAsStream(tifPath);
	if (inputStream != null)
	{
		return opener.openTiff(inputStream, Utils.removeExtension(file.getName()));
	}

	return null;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:32,代码来源:ConfigurationTemplate.java

示例2: loadImageProcessor

import ij.io.Opener; //导入方法依赖的package包/类
public static ImageProcessor loadImageProcessor(final String url)
        throws IllegalArgumentException {

    // openers keep state about the file being opened, so we need to create a new opener for each load
    final Opener opener = new Opener();
    opener.setSilentMode(true);

    final ImagePlus imagePlus = opener.openURL(url);
    if (imagePlus == null) {
        throw new IllegalArgumentException("failed to create imagePlus instance for '" + url + "'");
    }

    return imagePlus.getProcessor();
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:15,代码来源:MipmapClient.java

示例3: openImage

import ij.io.Opener; //导入方法依赖的package包/类
public static ImagePlus openImage(String directory, String filename)
{
	if (filename == null)
		return null;
	Opener opener = new Opener();
	opener.setSilentMode(true);
	// TODO - Add support for loading custom channel, slice and frame using a filename suffix, e.g. [cCzZtT]
	// If the suffix exists, remove it, load the image then extract the specified slices.
	return opener.openImage(directory, filename);
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:11,代码来源:FindFoci.java

示例4: loadImageProcessor

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * The core method used to load image processor instances that is called when cache misses occur.
 *
 * @param  url               url for the image.
 * @param  downSampleLevels  number of levels to further down sample the image.
 * @param  isMask            indicates whether this image is a mask.
 * @param  convertTo16Bit    indicates whether the loaded image processor should be converted to 16-bit.
 *
 * @return a newly loaded image processor to be cached.
 *
 * @throws IllegalArgumentException
 *   if the image cannot be loaded.
 */
protected ImageProcessor loadImageProcessor(final String url,
                                            final int downSampleLevels,
                                            final boolean isMask,
                                            final boolean convertTo16Bit)
        throws IllegalArgumentException {

    if (LOG.isDebugEnabled()) {
        LOG.debug("loadImageProcessor: entry, url={}, downSampleLevels={}, convertTo16Bit={}", url, downSampleLevels,convertTo16Bit);
    }

    ImageProcessor imageProcessor = null;

    // if we need to down sample, see if source image is already cached before trying to load it
    if (downSampleLevels > 0) {
        imageProcessor = cache.getIfPresent(new CacheKey(url, 0, isMask,convertTo16Bit));
    }

    // load the image as needed
    if (imageProcessor == null) {

        // TODO: use Bio Formats to load strange formats

        // openers keep state about the file being opened, so we need to create a new opener for each load
        final Opener opener = new S3Opener();
        opener.setSilentMode(true);

        final ImagePlus imagePlus = opener.openURL(url);
        if (imagePlus == null) {
            throw new IllegalArgumentException("failed to create imagePlus instance for '" + url + "'");
        }

        imageProcessor = imagePlus.getProcessor();

        // Force images to 16-bit, to allow for testing of mixed 8-bit and 16-bit mipmap levels.
        if ((! isMask) && (imageProcessor.getBitDepth() == 8) && convertTo16Bit) {
            imageProcessor = imageProcessor.convertToShort(false);
            imageProcessor.multiply(256.0);
        }

        // if we're going to down sample and we're supposed to cache originals, do so here
        if (cacheOriginalsForDownSampledImages && (downSampleLevels > 0)) {

            if (LOG.isDebugEnabled()) {
                LOG.debug("loadImageProcessor: caching level 0 for {}", url);
            }

            cache.put(new CacheKey(url, 0, isMask,convertTo16Bit), imageProcessor);
        }

    }

    // down sample the image as needed
    if (downSampleLevels > 0) {
        // NOTE: The down sample methods return a safe copy and leave the source imageProcessor unmodified,
        //       so we don't need to duplicate a cached source instance before down sampling.
        imageProcessor = Downsampler.downsampleImageProcessor(imageProcessor,
                                                              downSampleLevels);
    }

    return imageProcessor;
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:75,代码来源:ImageProcessorCache.java


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