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


Java ImgMode类代码示例

本文整理汇总了Java中io.scif.config.SCIFIOConfig.ImgMode的典型用法代码示例。如果您正苦于以下问题:Java ImgMode类的具体用法?Java ImgMode怎么用?Java ImgMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testImgPlusIntegrity

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
/**
 * Write an image to memory using the {@link ImgSaver} and verify that the
 * given {@link ImgPlus} is not corrupted during the process.
 */
@Test
public void testImgPlusIntegrity() throws ImgIOException,
	IncompatibleTypeException
{
	final ImgOpener o = new ImgOpener(ctx);
	final ImgSaver s = new ImgSaver(ctx);
	final SCIFIOConfig config = new SCIFIOConfig().imgOpenerSetImgModes(
		ImgMode.PLANAR);
	final ByteArrayHandle bah = new ByteArrayHandle();
	locationService.mapFile(out, bah);

	final SCIFIOImgPlus<?> openImg = o.openImgs(id, config).get(0);
	final String source = openImg.getSource();
	s.saveImg(out, openImg);
	assertEquals(source, openImg.getSource());
}
 
开发者ID:scifio,项目名称:scifio,代码行数:21,代码来源:ImgSaverTest.java

示例2: run

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
@Override
public void run() {
	final String omeroSource =
		"server=" + getServer() + //
		"&port=" + getPort() + //
		"&user=" + getUser() + //
		"&password=" + getPassword() + //
		"&imageID=" + imageID + //
		".omero";

	// Force on-demand loading of planes, instead of loading them all up front.
	final SCIFIOConfig config = new SCIFIOConfig();
	config.imgOpenerSetImgModes(ImgMode.CELL);

	try {
		dataset = datasetIOService.open(omeroSource, config);
	}
	catch (IOException exc) {
		log.error(exc);
	}
}
 
开发者ID:imagej,项目名称:imagej-omero,代码行数:22,代码来源:OpenImageFromOMERO.java

示例3: open

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
@Override
public Dataset open(final String source) throws IOException {
	final SCIFIOConfig config = new SCIFIOConfig();
	config.imgOpenerSetIndex(0);
	// skip min/max computation
	config.imgOpenerSetComputeMinMax(false);
	// prefer planar array structure, for ImageJ1 and ImgSaver compatibility
	config.imgOpenerSetImgModes(ImgMode.PLANAR);
	return open(source, config);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:11,代码来源:DefaultDatasetIOService.java

示例4: openAll

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
@Override
public List<net.imagej.Dataset> openAll(String source)
        throws IOException
{
        final SCIFIOConfig config = new SCIFIOConfig();
        config.imgOpenerSetImgModes(ImgMode.PLANAR);
        return openAll(source, config);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:9,代码来源:DefaultDatasetIOService.java

示例5: testPlanarPlaneSaving

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
/**
 * Test that ImgSaver writes each plane of a multi-plane PlanarImg correctly
 */
@Test
public void testPlanarPlaneSaving() throws ImgIOException,
	IncompatibleTypeException
{
	final SCIFIOConfig config = new SCIFIOConfig().imgOpenerSetImgModes(
		ImgMode.PLANAR);

	testPlaneSavingForConfig(config);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:13,代码来源:ImgSaverTest.java

示例6: testCellPlaneSaving

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
/**
 * Test that ImgSaver writes each plane of a multi-plane CellImg correctly
 */
@Test
public void testCellPlaneSaving() throws ImgIOException,
	IncompatibleTypeException
{
	final SCIFIOConfig config = new SCIFIOConfig().imgOpenerSetImgModes(
		ImgMode.CELL);

	testPlaneSavingForConfig(config);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:13,代码来源:ImgSaverTest.java

示例7: testArrayPlaneSaving

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
/**
 * Test that ImgSaver writes each plane of a multi-plane ArrayImg correctly
 */
@Test
public void testArrayPlaneSaving() throws ImgIOException,
	IncompatibleTypeException
{
	final SCIFIOConfig config = new SCIFIOConfig().imgOpenerSetImgModes(
		ImgMode.ARRAY);

	testPlaneSavingForConfig(config);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:13,代码来源:ImgSaverTest.java

示例8: convertImg

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
private static void convertImg(final File file) throws Exception {
	final Context c = new Context();
	final SCIFIOConfig config =
		new SCIFIOConfig().imgOpenerSetImgModes(ImgMode.ARRAY);
	final ImgPlus<?> img =
		new ImgOpener(c).openImgs(file.getAbsolutePath(), config).get(0);

	final String outPath =
		file.getParent() + File.separator + "out_" + img.getName();
	new ImgSaver(c).saveImg(outPath, img);

	c.dispose();
}
 
开发者ID:scifio,项目名称:scifio,代码行数:14,代码来源:ConvertImg.java

示例9: openVirtual

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
/** @deprecated Use {@link io.scif.img.IO#openImg(String, ImgOptions)}. */
@Deprecated
public static<T extends RealType<T> & NativeType<T>> Img<T> openVirtual(final String pathOrUrl) throws ImgIOException, IncompatibleTypeException {
	return (Img<T>) new ImgOpener().openImg(pathOrUrl, new SCIFIOConfig().imgOpenerSetImgModes( ImgMode.CELL ));
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:6,代码来源:ImgLib.java

示例10: createFactory

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
@Override
	public <T extends NativeType<T>> ImgFactory<T> createFactory(
		final Metadata m, final ImgMode[] imgModes, final T type)
		throws IncompatibleTypeException
	{
		ImgFactory<T> tmpFactory = null;

		// Max size of a plane of a PlanarImg, or total dataset for ArrayImg.
		// 2GB.
		final long maxSize = ArrayUtils.safeMultiply64(2, 1024, 1024, 1024);

		final long availableMem =
			(long) (MemoryTools.totalAvailableMemory() * MEMORY_THRESHOLD);
		long datasetSize = m.getDatasetSize();

		// check for overflow
		if (datasetSize <= 0) datasetSize = Long.MAX_VALUE;

		// divide by 1024 to compare to max_size and avoid overflow
		final long planeSize =
			m.get(0).getAxisLength(Axes.X) * m.get(0).getAxisLength(Axes.Y) *
				FormatTools.getBytesPerPixel(m.get(0).getPixelType());

		final boolean fitsInMemory = availableMem > datasetSize;

		boolean decided = false;
		int modeIndex = 0;

		// loop over ImgOptions in preferred order
		while (!decided) {

			// get the current mode, or AUTO if we've exhausted the list of
			// modes
			final ImgMode mode =
				modeIndex >= imgModes.length ? ImgMode.AUTO : imgModes[modeIndex++];

			if (mode.equals(ImgMode.AUTO)) {
				if (!fitsInMemory) tmpFactory = new SCIFIOCellImgFactory<>();
				else if (datasetSize < maxSize) tmpFactory = new ArrayImgFactory<>();
				else tmpFactory = new PlanarImgFactory<>();

				// FIXME: no CellImgFactory right now.. isn't guaranteed to
				// handle all
				// images well (e.g. RGB)
//        else if (planeSize < maxSize) tmpFactory = new PlanarImgFactory<T>();
//        else tmpFactory = new CellImgFactory<T>();

				decided = true;
			}
			else if (mode.equals(ImgMode.ARRAY) && datasetSize < maxSize &&
				fitsInMemory)
			{
				tmpFactory = new ArrayImgFactory<>();
				decided = true;
			}
			else if (mode.equals(ImgMode.PLANAR) && planeSize < maxSize &&
				fitsInMemory)
			{
				tmpFactory = new PlanarImgFactory<>();
				decided = true;
			}
			else if (mode.equals(ImgMode.CELL)) {
				// FIXME: no CellImgFactory right now.. isn't guaranteed to
				// handle all
				// images well (e.g. RGB)
//        if (fitsInMemory) tmpFactory = new CellImgFactory<T>();
//        else tmpFactory = new SCIFIOCellImgFactory<T>();
				tmpFactory = new SCIFIOCellImgFactory<>();

				decided = true;
			}
		}

		return tmpFactory.imgFactory(type);
	}
 
开发者ID:scifio,项目名称:scifio,代码行数:76,代码来源:DefaultImgFactoryHeuristic.java

示例11: createFactory

import io.scif.config.SCIFIOConfig.ImgMode; //导入依赖的package包/类
/**
 * @param m Metadata describing the image
 * @param imgModes An ordered list of ImgModes. Each should be investigated in
 *          the order they appear.
 * @return An ImgFactory implementation capable of creating appropriate Imgs.
 * @throws IncompatibleTypeException If an ImgFactory of type T can't be
 *           created matching the type described by the Metadata.
 */
<T extends NativeType<T>> ImgFactory<T> createFactory(final Metadata m,
	ImgMode[] imgModes, T t) throws IncompatibleTypeException;
 
开发者ID:scifio,项目名称:scifio,代码行数:11,代码来源:ImgFactoryHeuristic.java


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