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


Java SCIFIOConfig类代码示例

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


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

示例1: readFile

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
private static void readFile(final File file) throws FormatException,
	IOException
{
	final SCIFIO scifio = new SCIFIO();
	final Format format =
		scifio.format().getFormat(file.getAbsolutePath(),
			new SCIFIOConfig().checkerSetOpen(true));
	System.out.println("file = " + file);
	System.out.println("format = " + format.getFormatName());
	final Parser parser = format.createParser();
	final Metadata meta = parser.parse(file);
	for (int i = 0; i < meta.getImageCount(); i++) {
		System.out.println("image #" + i + " dimensions:");
		for (int a = 0; a < meta.get(i).getAxes().size(); a++) {
			final AxisType axisType = meta.get(i).getAxis(a).type();
			final long axisLength = meta.get(i).getAxisLength(a);
			System.out.println("\t" + axisLength + " : " + axisType);
		}
	}
}
 
开发者ID:scifio,项目名称:scifio-bf-compat,代码行数:21,代码来源:ReadFile.java

示例2: SCIFIOConfig

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
/**
 * @param reader - An initialized {@link Reader} to use for reading image
 *          data.
 * @param type - The {@link Type} T of the output {@link ImgPlus}, which must
 *          match the typing of the {@link ImgFactory}.
 * @param config - {@link SCIFIOConfig} to use when opening this dataset
 * @return - the {@link ImgPlus} or null
 * @throws ImgIOException if there is a problem reading the image data.
 */
public <T extends RealType<T> & NativeType<T>> List<SCIFIOImgPlus<T>>
	openImgs(final Reader reader, final T type, SCIFIOConfig config)
		throws ImgIOException
{
	if (config == null) {
		config = new SCIFIOConfig().imgOpenerSetComputeMinMax(true);
	}
	final ImgFactoryHeuristic heuristic = getHeuristic(config);

	ImgFactory<T> imgFactory;
	try {
		imgFactory =
			heuristic.createFactory(reader.getMetadata(), config
				.imgOpenerGetImgModes(), type);
	}
	catch (final IncompatibleTypeException e) {
		throw new ImgIOException(e);
	}

	return openImgs(reader, type, imgFactory, config);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:31,代码来源:ImgOpener.java

示例3: openPlane

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
@Override
public ByteArrayPlane openPlane(final int imageIndex,
	final long planeIndex, final ByteArrayPlane plane, final long[] planeMin,
	final long[] planeMax, final SCIFIOConfig config) throws FormatException,
	IOException
{
	final Metadata meta = getMetadata();
	final byte[] buf = plane.getBytes();
	FormatTools.checkPlaneForReading(meta, imageIndex, planeIndex,
		buf.length, planeMin, planeMax);

	final String file =
		meta.getPositions().get(imageIndex).getFile(meta, imageIndex,
			planeIndex);

	if (file != null && new Location(getContext(), file).exists()) {
		tiffReader.setSource(file, config);
		return tiffReader.openPlane(imageIndex, 0, plane, planeMin, planeMax);
	}
	log().warn(
		"File for image #" + planeIndex + " (" + file + ") is missing.");
	return plane;
}
 
开发者ID:scifio,项目名称:scifio,代码行数:24,代码来源:MicromanagerFormat.java

示例4: convert

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
/**
 * As {@link #convert(Reader, Writer, String)}, with configuration options.
 *
 * @param input the pre-initialized Reader used for reading data.
 * @param output the uninitialized Writer used for writing data.
 * @param outputFile the full path name of the output file to be created.
 * @param config {@link SCIFIOConfig} to use for the reading and writing.
 * @throws FormatException if there is a general problem reading from or
 *           writing to one of the files.
 * @throws IOException if there is an I/O-related error.
 */
public static void convert(final Reader input, final Writer output,
	final String outputFile, final SCIFIOConfig config) throws FormatException,
	IOException
{

	Plane p = null;

	for (int i = 0; i < input.getImageCount(); i++) {
		for (int j = 0; j < input.getPlaneCount(i); j++) {
			p = input.openPlane(i, j, config);
			output.savePlane(i, j, p);
		}
	}

	input.close();
	output.close();
}
 
开发者ID:scifio,项目名称:scifio,代码行数:29,代码来源:FormatTools.java

示例5: testOpenImageRange

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
/**
 * Tests that opening datasets with multiple images, via
 * {@link SCIFIOConfig#imgOpenerGetRange()}, is working as intended.
 *
 * @throws ImgIOException
 */
@Test
public void testOpenImageRange() throws ImgIOException {
	final String id = "testImg&images=5&lengths=512,512&axes=X,Y.fake";

	// Open images 0 and 3
	final List<SCIFIOImgPlus<?>> imgs =
		new MultiImgOpener().openImgs(id, new SCIFIOConfig()
			.imgOpenerSetRange("0,3"));

	// Check the size
	assertEquals(2, imgs.size());

	// Check the adjusted dimensions
	assertEquals(imgs.get(0).dimension(0), imgs.get(1).dimension(0) + 30);
	assertEquals(imgs.get(0).dimension(1), imgs.get(1).dimension(1) + 30);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:23,代码来源:ImgOpenerTest.java

示例6: openPlane

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
@Override
public BufferedImagePlane openPlane(final int imageIndex,
	final long planeIndex, final BufferedImagePlane plane,
	final long[] planeMin, final long[] planeMax, final SCIFIOConfig config)
	throws FormatException, IOException
{
	final MNGImageInfo info =
		getMetadata().getDatasetInfo().imageInfo.get(imageIndex);
	final long offset = info.offsets.get((int) planeIndex);
	getStream().seek(offset);
	final long end = info.lengths.get((int) planeIndex);
	BufferedImage img = readImage(getMetadata(), end);

	// reconstruct the image to use an appropriate raster
	// ImageIO often returns images that cannot be scaled because a
	// BytePackedRaster is used
	img =
		AWTImageTools.getSubimage(img, getMetadata().get(imageIndex)
			.isLittleEndian(), planeMin, planeMax);

	plane.setData(img);
	return plane;
}
 
开发者ID:scifio,项目名称:scifio,代码行数:24,代码来源:MNGFormat.java

示例7: isFormat

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
@Override
public boolean isFormat(String name, final SCIFIOConfig config) {
	if (super.isFormat(name, config)) return true;
	if (!config.checkerIsOpen()) return false;

	// look for a matching .nhdr file
	Location header = new Location(getContext(), name + ".nhdr");
	if (header.exists()) {
		return true;
	}

	if (name.contains(".")) {
		name = name.substring(0, name.lastIndexOf("."));
	}

	header = new Location(getContext(), name + ".nhdr");
	return header.exists();
}
 
开发者ID:scifio,项目名称:scifio,代码行数:19,代码来源:NRRDFormat.java

示例8: run

import io.scif.config.SCIFIOConfig; //导入依赖的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

示例9: openPlane

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
@Override
public P openPlane(final int imageIndex, final long planeIndex,
	final long[] planeMin, final long[] planeMax, final SCIFIOConfig config)
	throws FormatException, IOException
{
	P plane = null;

	try {
		plane = createPlane(planeMin, planeMax);
	}
	catch (final IllegalArgumentException e) {
		throw new FormatException(
			"Image plane too large. Only 2GB of data can "
				+ "be extracted at one time. You can workaround the problem by opening "
				+ "the plane in tiles; for further details, see: "
				+ "http://www.openmicroscopy.org/site/support/faq/bio-formats/"
				+ "i-see-an-outofmemory-or-negativearraysize-error-message-when-"
				+ "attempting-to-open-an-svs-or-jpeg-2000-file.-what-does-this-mean",
			e);
	}

	return openPlane(imageIndex, planeIndex, plane, planeMin, planeMax, config);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:24,代码来源:AbstractReader.java

示例10: testImgPlusIntegrity

import io.scif.config.SCIFIOConfig; //导入依赖的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

示例11: getCurrentFile

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
@Override
protected void
	setSourceHelper(final String source, final SCIFIOConfig config)
{
	final String oldFile = getCurrentFile();
	if (!source.equals(oldFile) ||
		metaCheck() &&
		(((DimensionSwapperMetadata) getMetadata()).getOutputOrder() == null || ((DimensionSwapperMetadata) getMetadata())
			.getOutputOrder().length != getImageCount()))
	{
		@SuppressWarnings("unchecked")
		final List<AxisType>[] axisTypeList = new ArrayList[getImageCount()];
		((DimensionSwapperMetadata) getMetadata()).setOutputOrder(axisTypeList);

		// NB: Create our own copy of the Metadata,
		// which we can manipulate safely.
		// TODO should be a copy method
		if (metaCheck()) ((DimensionSwapperMetadata) getMetadata())
			.wrap(getParent().getMetadata());
	}
}
 
开发者ID:scifio,项目名称:scifio,代码行数:22,代码来源:DimensionSwapper.java

示例12: openAll

import io.scif.config.SCIFIOConfig; //导入依赖的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

示例13: parse

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
@Override
public M parse(final File file, final SCIFIOConfig config)
	throws IOException, FormatException
{
	@SuppressWarnings("unchecked")
	final M meta = (M) getFormat().createMetadata();
	return parse(file, meta, config);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:9,代码来源:AbstractParser.java

示例14: openImg

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
/**
 * @deprecated
 * @see #openImg(String, ImgFactory, SCIFIOConfig)
 */
@Deprecated
@SuppressWarnings("rawtypes")
public static SCIFIOImgPlus<?> openImg(final String source,
	final ImgFactory imgFactory, final SCIFIOConfig config)
{
	return openImgs(source, imgFactory, config).get(0);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:12,代码来源:IO.java

示例15: openPlane

import io.scif.config.SCIFIOConfig; //导入依赖的package包/类
@Override
public Plane openPlane(final int imageIndex, final long planeIndex,
	final long[] offsets, final long[] lengths) throws FormatException,
	IOException
{
	return openPlane(imageIndex, planeIndex, offsets, lengths,
		new SCIFIOConfig());
}
 
开发者ID:scifio,项目名称:scifio,代码行数:9,代码来源:MinMaxFilter.java


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