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


Java IFormatReader类代码示例

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


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

示例1: getTileIndices

import loci.formats.IFormatReader; //导入依赖的package包/类
public Point[] getTileIndices(IFormatReader reader, int tileWidth, int tileHeight) {
    Rectangle region = new Rectangle(0, 0, reader.getSizeX()+1, reader.getSizeY() + 1);
    int minTileX = XToTileX(region.x,0,tileWidth);
    int maxTileX = XToTileX(region.x + region.width - 1,0,tileWidth);
    int minTileY = this.YToTileY(region.y,0,tileHeight);
    int maxTileY = this.YToTileY(region.y + region.height - 1,0,tileHeight);
    Point[] tileIndices = new Point[(maxTileY - minTileY + 1) * (maxTileX - minTileX + 1)];
    int tileIndexOffset = 0;

    for(int ty = minTileY; ty <= maxTileY; ++ty) {
        for(int tx = minTileX; tx <= maxTileX; ++tx) {
            tileIndices[tileIndexOffset++] = new Point(tx, ty);
        }
    }

    return tileIndices;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:18,代码来源:Calibration.java

示例2: getRealResolutionCount

import loci.formats.IFormatReader; //导入依赖的package包/类
@Deprecated
private int getRealResolutionCount(IFormatReader imageReader) throws IOException, FormatException {
    ImageReader ir = new ImageReader();
    ir.setFlattenedResolutions(false);
    ir.setId(imageReader.getCurrentFile());
    ir.setSeries(imageReader.getSeries());
    int numRes = 1;
    for (int lev=imageReader.getResolutionCount()-1; lev>=0; lev--) {
        numRes = lev;
        ir.setResolution(lev);
        int thumbW = ir.getSizeX();
        int thumbH = ir.getSizeY();
        double diff = Math.abs((thumbW/(double)thumbH) - (imageReader.getSizeX()/(double)imageReader.getSizeY()));
        System.out.println("diff: "+diff);
        if (diff<0.001) break;
    }
    ir.close();
    return numRes;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:20,代码来源:OrbitImageBioformats.java

示例3: newImageReader

import loci.formats.IFormatReader; //导入依赖的package包/类
public static final IFormatReader newImageReader(final String id) {
	final IFormatReader reader = new ImageReader();
	
	try {
		reader.setId(id);
	} catch (final Exception exception) {
		throw unchecked(exception);
	}
	
	if ("portable gray map".equals(reader.getFormat().toLowerCase(Locale.ENGLISH))) {
		// XXX This fixes a defect in Bio-Formats PPM loading, but is it always OK?
		reader.getCoreMetadata()[0].interleaved = true;
	}
	
	reader.setSeries(0);
	
	return reader;
}
 
开发者ID:apgrgr,项目名称:SyntheticWSI,代码行数:19,代码来源:LociBackedImage.java

示例4: predefinedChannelsFor

import loci.formats.IFormatReader; //导入依赖的package包/类
public static final Channels predefinedChannelsFor(final IFormatReader lociImage) {
	if (lociImage.isIndexed()) {
		return PredefinedChannels.C3_U8;
	}
	
	switch (lociImage.getRGBChannelCount()) {
	case 1:
		switch (FormatTools.getBytesPerPixel(lociImage.getPixelType()) * lociImage.getRGBChannelCount()) {
		case 1:
			return 1 == lociImage.getBitsPerPixel() ?
					PredefinedChannels.C1_U1 : PredefinedChannels.C1_U8;
		case 2:
			return PredefinedChannels.C1_U16;
		default:
			return PredefinedChannels.C1_S32;
		}
	case 2:
		return PredefinedChannels.C2_U16;
	case 3:
		return PredefinedChannels.C3_U8;
	case 4:
		return PredefinedChannels.C4_U8;
	default:
		throw new IllegalArgumentException();
	}
}
 
开发者ID:apgrgr,项目名称:SyntheticWSI,代码行数:27,代码来源:LociBackedImage.java

示例5: openPlane

import loci.formats.IFormatReader; //导入依赖的package包/类
@Override
public ByteArrayPlane openPlane(final int imageIndex,
	final long planeIndex, final ByteArrayPlane plane, final long[] offsets,
	final long[] lengths, final SCIFIOConfig config) throws FormatException,
	IOException
{
	final IFormatReader reader = getMetadata().getReader();
	reader.setSeries(imageIndex);
	try {
		Metadata meta = getMetadata();
		final int xIndex = meta.get(imageIndex).getAxisIndex(Axes.X), yIndex =
			meta.get(imageIndex).getAxisIndex(Axes.Y);
		final int x = (int) offsets[xIndex], y = (int) offsets[yIndex], w =
			(int) lengths[xIndex], h = (int) lengths[yIndex];
		reader.openBytes((int)planeIndex, plane.getBytes(), x, y, w, h);

		plane.setColorTable(getMetadata().getColorTable(imageIndex, planeIndex));
	}
	catch (final loci.formats.FormatException e) {
		throw new FormatException(e);
	}

	return plane;
}
 
开发者ID:scifio,项目名称:scifio-bf-compat,代码行数:25,代码来源:BioFormatsFormat.java

示例6: cacheReaderClasses

import loci.formats.IFormatReader; //导入依赖的package包/类
/**
 * Compiles the list of Bio-Formats reader classes, excluding the
 * {@link #DO_NOT_CONVERT} blacklist.
 *
 * @return true if the reader class list was re-generated.
 */
private boolean cacheReaderClasses() {
	final Class<? extends IFormatReader>[] defaultClasses =
		ImageReader.getDefaultReaderClasses().getClasses();
	final int currentHash = Arrays.hashCode(defaultClasses);

	// If our classList is uninitialized, or the Bio-Formats classList has
	// changed, compute the current reader classes.
	if (readerClasses == null || cachedReaderHash != currentHash) {
		final ClassList<IFormatReader> targetClasses =
			new ClassList<IFormatReader>(IFormatReader.class);

		// add reader classes to the list, excluding the blacklist
		for (final Class<? extends IFormatReader> c : defaultClasses) {
			if (convert(c)) targetClasses.addClass(c);
		}
		readerClasses = targetClasses;
		cachedReaderHash = currentHash;

		return true;
	}
	return false;
}
 
开发者ID:scifio,项目名称:scifio-bf-compat,代码行数:29,代码来源:BioFormatsFormat.java

示例7: close

import loci.formats.IFormatReader; //导入依赖的package包/类
@Override
public void close() throws IOException {
    synchronized (allReaders) {
        for (IFormatReader r: allReaders) {
            try {
                r.close();
            } catch (Exception e) {
            }
        }
    }
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:12,代码来源:OrbitImageBioformats.java

示例8: configureReader

import loci.formats.IFormatReader; //导入依赖的package包/类
@Override
protected void configureReader(IFormatReader reader, int resIndex)
{
	int resolutionIndexInReader = super.getResolutionCount() - 1 - resIndex;
	
	reader.setSeries(super.getSeriesIndex() + resolutionIndexInReader);
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:8,代码来源:OmeTiffVirtualSlideImage.java

示例9: close

import loci.formats.IFormatReader; //导入依赖的package包/类
@Override
public void close()
{
	for(IFormatReader reader : super.borrowAllAvailableObjects())
	{
		try
		{
			reader.close();
		}
		catch(IOException e)
		{
			e.printStackTrace();
		}
	}
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:16,代码来源:ReaderPool.java

示例10: canLoad

import loci.formats.IFormatReader; //导入依赖的package包/类
@Override
public boolean canLoad(Path filePath)
{
	try(IFormatReader reader = new OMETiffReader())
	{
		return reader.isThisType(filePath.toString());
	}
	catch(IOException e)
	{
		return false;
	}
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:13,代码来源:OmeTiffLoader.java

示例11: loadImages

import loci.formats.IFormatReader; //导入依赖的package包/类
@Override
protected void loadImages(BioformatsVirtualSlide slide, ReaderPool readerPool) throws UncheckedInterruptedException
{
	IFormatReader reader = readerPool.borrow();
	try
	{	
		List<Integer> seriesResolutionCount = getSeriesResolutionCount(slide.getBioformatsMetadata());
		
		int readerSeriesIndex = 0;
		for(int seriesIndex = 0; seriesIndex < seriesResolutionCount.size(); seriesIndex++)
		{
			reader.setSeries(readerSeriesIndex);
			
			String imageName = slide.getBioformatsMetadata().getImageName(readerSeriesIndex);
			int    resCount  = seriesResolutionCount.get(seriesIndex);
			
			OmeTiffVirtualSlideImage image = new OmeTiffVirtualSlideImage(imageName, readerSeriesIndex, resCount, readerPool);
			
			computePaddingForEveryResolutionOfImage(image);
			
			slide.addImage(seriesIndex, image);
			
			readerSeriesIndex += seriesResolutionCount.get(seriesIndex);
		}
	}
	finally
	{
		readerPool.putBack(reader);
	}
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:31,代码来源:OmeTiffLoader.java

示例12: getReader

import loci.formats.IFormatReader; //导入依赖的package包/类
public final IFormatReader getReader() {
	if (this.reader == null) {
		this.setupReader();
	}
	
	return this.reader;
}
 
开发者ID:apgrgr,项目名称:SyntheticWSI,代码行数:8,代码来源:LociBackedImage.java

示例13: createReader

import loci.formats.IFormatReader; //导入依赖的package包/类
private IFormatReader createReader(final String filePath)
	throws FormatException, IOException
{
	if (readerPath != null && readerPath.equals(filePath)) {
		// just use the existing reader
		return reader;
	}

	if (reader != null) {
		reader.close();
	}
	System.err.println("Creating new reader for " + filePath);
	// initialize a fresh reader
	final ChannelFiller cf = new ChannelFiller(new ImageReader());
	cf.setFilled(true);
	reader = cf;
	readerPath = filePath;

	reader.setMetadataFiltered(true);
	reader.setOriginalMetadataPopulated(true);
	final MetadataStore store = MetadataTools.createOMEXMLMetadata();
	if (store == null) System.err.println("OME-Java library not found.");
	else reader.setMetadataStore(store);

	// avoid grouping all the .lsm when a .mdb is there
	reader.setGroupFiles(false);

	if (filePath != null) {
		reader.setId(filePath);
		reader.setSeries(0);
	}

	return reader;
}
 
开发者ID:scifio,项目名称:scifio-itk-bridge,代码行数:35,代码来源:SCIFIOITKBridge.java

示例14: convert

import loci.formats.IFormatReader; //导入依赖的package包/类
/** Returns false if this reader class already exists in SCIFIO. */
private boolean convert(final Class<? extends IFormatReader> c) {
	for (final String s : DO_NOT_CONVERT) {
		if (s.equals(c.getName())) return false;
	}
	return true;
}
 
开发者ID:scifio,项目名称:scifio-bf-compat,代码行数:8,代码来源:BioFormatsFormat.java

示例15: getIndex

import loci.formats.IFormatReader; //导入依赖的package包/类
private int getIndex(IFormatReader r, int channel) {
    int[] nos = r.getZCTCoords(0);
    int z = nos[0], t = nos[2];
    return r.getIndex(z,channel,t);
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:6,代码来源:OrbitImageBioformats.java


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