• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FormatException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getRealResolutionCount

import loci.formats.FormatException; //导入依赖的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


示例2: identify

import loci.formats.FormatException; //导入依赖的package包/类
@Override
public ImageInput identify(ImageInput ii) throws IOException {
    ImageReader reader = new ImageReader();
    try {
        reader.setId(ii.getFile().getAbsolutePath());
    } catch (FormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    int width = reader.getSizeX();
    int height = reader.getSizeY();
    String fmt = reader.getFormat();

    String mt = "";
    if (fmt.equalsIgnoreCase("Tagged Image File Format")) {
        mt = "image/tiff";
    } else if (fmt.equalsIgnoreCase("JPEG")) {
        mt = "image/jpeg";
    }

    logger.debug("BioFormats identify: width=" + width + " height=" + height + " format=" + fmt + " mimetype=" + mt);
    ii.setSize(new ImageSize(width, height));
    ii.setMimetype(mt);
    return ii;
}
 
开发者ID:robcast,项目名称:digilib,代码行数:26,代码来源:BioFormatsDocuImage.java


示例3: openImage

import loci.formats.FormatException; //导入依赖的package包/类
@Override
public BufferedImage openImage(int no, int x, int y, int w, int h) throws FormatException, IOException {
    int[] zct = getZCTCoords(no);
    int z = zct[0];
    int chan = zct[1];
    int t = zct[2];
    RectZT rect = new RectZT(x,y,w,h,z,t);
    if (currentRect==null || !currentRect.equals(rect)) {
        logger.trace("cache failed - loading");
        openUnmixedImages(no,x,y,w,h); // unmix all channels at once
    }
    return unmixedChannels[chan];
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:14,代码来源:MultiplexImageReader.java


示例4: getNumPagesInZVI

import loci.formats.FormatException; //导入依赖的package包/类
public static int getNumPagesInZVI(String filename) throws IOException, FormatException {

        ImageProcessorReader r = new ImageProcessorReader(
                new ChannelSeparator(new ZeissZVIReader())); // LociPrefs.makeImageReader()
        r.setId(filename);
        int num = r.getImageCount();
        //int width = r.getSizeX();
        //int height = r.getSizeY();
        // howto color conversion: http://trac.openmicroscopy.org.uk/ome/browser/bioformats.git/components/loci-plugins/utils/Read_Image.java
        r.close();
        return num;
    }
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:13,代码来源:TiffConverter.java


示例5: getNumPagesInLIF

import loci.formats.FormatException; //导入依赖的package包/类
public static int getNumPagesInLIF(String filename) throws IOException, FormatException {

        ImageProcessorReader r = new ImageProcessorReader(
                new ChannelSeparator(new LIFReader()));
        r.setId(filename);
        int num = r.getImageCount();
        r.close();
        return num;
    }
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:10,代码来源:TiffConverter.java


示例6: getZVIPage

import loci.formats.FormatException; //导入依赖的package包/类
public static PlanarImage getZVIPage(String filename, int num) throws IOException, FormatException {
    ImageProcessorReader r = new ImageProcessorReader(
            new ChannelSeparator(new ZeissZVIReader())); // LociPrefs.makeImageReader()
    r.setId(filename);
    ImageProcessor ip = r.openProcessors(num)[0]; // (page)[0]
    return PlanarImage.wrapRenderedImage(ip.getBufferedImage());
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:8,代码来源:TiffConverter.java


示例7: getLIFPage

import loci.formats.FormatException; //导入依赖的package包/类
public static PlanarImage getLIFPage(String filename, int num) throws IOException, FormatException {
    ImageProcessorReader r = new ImageProcessorReader(
            new ChannelSeparator(new LIFReader()));
    r.setId(filename);
    ImageProcessor ip = r.openProcessors(num)[0]; // (page)[0]
    return PlanarImage.wrapRenderedImage(ip.getBufferedImage());
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:8,代码来源:TiffConverter.java


示例8: testImageReaderInstantiation

import loci.formats.FormatException; //导入依赖的package包/类
@Test
public void testImageReaderInstantiation()
        throws URISyntaxException, FormatException, IOException {
    URL resource = this.getClass().getClassLoader().getResource(
            "org/cellprofiler/imageset/omexml.xml");
    Path path = Paths.get(resource.toURI());

    ImageReader reader = new ImageReader();
    try {
        reader.setId(path.toString());
        assertEquals(4, reader.getSeriesCount());
    } finally {
        reader.close();
    }
}
 
开发者ID:CellProfiler,项目名称:prokaryote,代码行数:16,代码来源:TestBioFormats.java


示例9: main

import loci.formats.FormatException; //导入依赖的package包/类
public static void main(String... args) throws IOException, FormatException {
	final String bucketName = "dpwr";
	final String key = "s3test/bus.tif";
	final Regions regions = Regions.US_EAST_1;

	final String id = AmazonS3Handle.makeId(bucketName, key, regions);

	final ImagePlus[] imps = BF.openImagePlus(id);
	new ImageJ();
	for (final ImagePlus imp : imps)
		imp.show();
}
 
开发者ID:dpwrussell,项目名称:bfs3,代码行数:13,代码来源:Main.java


示例10: waitForInput

import loci.formats.FormatException; //导入依赖的package包/类
/** Enters an input loop, waiting for commands, until EOF is reached. */
public boolean waitForInput() throws FormatException, IOException {
	in =
		new BufferedReader(new InputStreamReader(System.in, Constants.ENCODING));
	boolean ret = true;
	while (true) {
		final String line = in.readLine(); // blocks until a line is read
		if (line == null) break; // eof
		ret = ret && executeCommand(line);
	}
	in.close();
	return ret;
}
 
开发者ID:scifio,项目名称:scifio-itk-bridge,代码行数:14,代码来源:SCIFIOITKBridge.java


示例11: executeCommand

import loci.formats.FormatException; //导入依赖的package包/类
/**
 * Executes the given command line. The following commands are supported:
 * <ul>
 * <li>info - Dumps image metadata</li>
 * <li>read - Dumps image pixels</li>
 * <li>canRead - Tests whether the given file path can be parsed</li>
 * </ul>
 *
 * @throws FormatException
 */
public boolean executeCommand(final String commandLine) throws IOException,
	FormatException
{
	final String[] args = commandLine.split("\t");

	for (int i = 0; i < args.length; i++) {
		args[i] = args[i].trim();
	}

	return executeCommand(args);
}
 
开发者ID:scifio,项目名称:scifio-itk-bridge,代码行数:22,代码来源:SCIFIOITKBridge.java


示例12: createReader

import loci.formats.FormatException; //导入依赖的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


示例13: openUnmixedImages

import loci.formats.FormatException; //导入依赖的package包/类
public BufferedImage[] openUnmixedImages(int no, int x, int y, int w, int h) throws FormatException, IOException {
    int[] zct = getZCTCoords(no);
    int z = zct[0];
    int chan = zct[1];
    int t = zct[2];
    // load all channels for current rect
    BufferedImage[] channels = new BufferedImage[sizeC];
    for (int c=0; c<sizeC; c++) {
        int no2 = getIndex(z,c,t);
        channels[c] = super.openImage(no2,x,y,w,h);
    }

    BufferedImage ori = channels[0];
    BufferedImage[] bi = new BufferedImage[sizeC];
    WritableRaster[] raster = new WritableRaster[sizeC];
    for (int c=0; c<sizeC; c++) {
        if (!channelIndependent[c]) {
            bi[c] = new BufferedImage(ori.getColorModel(), ori.getRaster().createCompatibleWritableRaster(0, 0, w, h), ori.isAlphaPremultiplied(), null);
            raster[c] = bi[c].getRaster();
        } else {
            bi[c] = channels[c];   // original image, independent channel
            raster[c] = bi[c].getRaster();
        }
    }
    double[] measurements = new double[sizeDependend];
    double[] out = new double[sizeDependend];
    for (int ix=ori.getMinX(); ix<ori.getMinX()+ori.getWidth(); ix++)
        for (int iy=ori.getMinY(); iy<ori.getMinY()+ori.getHeight(); iy++) {
            for (int c=0; c<sizeDependend; c++) {
                measurements[c] = channels[channelMap[c]].getRaster().getSampleDouble(ix,iy,0); // only 1 banded rasters allowed here
            }
            fastMultiply(invMatrix,measurements,out);   // here the real unmixing takes place
            for (int c=0; c<sizeDependend; c++) {
                if (out[c]>255) out[c] = 255d;        // TODO: adjust for 16bit!!!
                if (out[c]<0) out[c] = 0d;
                raster[channelMap[c]].setSample(ix, iy, 0, out[c]);
            }
        }
    unmixedChannels = bi;
    currentRect = new RectZT(x,y,w,h,z,t);

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


示例14: main

import loci.formats.FormatException; //导入依赖的package包/类
public static void main(String[] args) throws IOException, FormatException {
    NDPISReaderOrbit r = new NDPISReaderOrbit();
    r.setId("D:\\pic\\Hamamatsu\\Scan_Manuel\\Staining-DAPI-Cy5.5-FITC-scan all channels fix.ndpis");
    System.out.println(Arrays.toString(getExposureTimesGain(r)));
    r.close();
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:7,代码来源:NDPIUtils.java


示例15: savePixelsTo

import loci.formats.FormatException; //导入依赖的package包/类
private void savePixelsTo(VirtualSlide slide, Path destinationPath, IMetadata metadata, SaveProgressReporter progress) throws IOException, UncheckedInterruptedException
{
	reportTotalBytesToSave(slide, progress);
	
	// TODO Maybe generating resolution pyramid from scratch would be good idea, especially when original image does not have one
	//      or it's too sparse, as in .svs in which shrink factor of each edge is 4 causing a lot more power required to view it than
	//      if it had shrink factor equal to 2.
	//      The downside is that the saving will be probably a lot longer.
	
	// TODO Copying without recompression when the source file and destination has the same tile size and the same compression method
	//      would be A LOT faster.
	//      It would be good especially when saving the file in place to not trigger full, long save when user only changes image name
	//      of file already in OME-TIFF format.
	//      The problem is that Bioformats does not allow to do it directly:
	//      - bypassing compression should be easy - just override IFD.getCompression()
	//      - reading compressed data in raw format is impossible with bioformats for all formats, but for OME-TIFF
	//        using TiffParser.getSample(IFD) and overriding IFD.getCompression() possibly can work
	//        - if not, you can still parse the IFDs with TiffParser and read the data directly
	
	AtomicLong totalBytesWritten = new AtomicLong(0);
	
	try(OMETiffWriter writer = new OMETiffWriter())
	{
  		writer.setBigTiff(true);
      writer.setInterleaved(true);
      writer.setValidBitsPerPixel(8);
      writer.setMetadataRetrieve(metadata);
      writer.setCompression(OMETiffWriter.COMPRESSION_JPEG);
      
		writer.setId(destinationPath.toString());
		
		int seriesIndex = 0;
		for(VirtualSlideImage image : slide.getImageList())
		{
			for(int resIndex = image.getResolutionCount() - 1; resIndex >= 0 ;--resIndex)
			{
				writer.setSeries(seriesIndex);

				for(int c = 0; c < image.getChannelCount() ;++c)
				{
					for(int z = 0; z < image.getZPlaneCount() ;++z)
					{
						for(int t = 0; t < image.getTimePointCount() ;++t)
						{
							saveImagePixels(writer, image, new ImageIndex(resIndex, c, z, t), progress, totalBytesWritten);
						}
					}
				}
     
				seriesIndex++;
			}
		}
	}
	catch(FormatException e)
	{
		throw new IOException(e);
	}
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:59,代码来源:OmeTiffSavingService.java


示例16: main

import loci.formats.FormatException; //导入依赖的package包/类
public static void main(final String[] args) throws FormatException,
	IOException
{
	DebugTools.enableLogging("OFF");
	if (!new SCIFIOITKBridge().executeCommand(args)) System.exit(1);
}
 
开发者ID:scifio,项目名称:scifio-itk-bridge,代码行数:7,代码来源:SCIFIOITKBridge.java


示例17: main

import loci.formats.FormatException; //导入依赖的package包/类
public static void main( String[] args ) throws IOException, FormatException
{
	LandmarkTableModel ltm = new LandmarkTableModel( Integer.parseInt( args[ 0 ] ) );
	ltm.load( new File( args[ 1 ] ) );

	ThinPlateR2LogRSplineKernelTransform xfm = ltm.getTransform();

	String srcName = args[ 2 ];
	String template = args[ 3 ];
	String dstName = args[ 4 ];

	ImagePlus impP = IJ.openImage( srcName );

	// read image properties from the header
	ImageReader reader = new ImageReader();
	reader.setId( template );

	String[] names = new String[]{ impP.getTitle(), "target_interval" };

	/* Load the first source */
	final ImagePlusLoader loaderP = new ImagePlusLoader( impP );
	final AbstractSpimData< ? >[] spimDataP = loaderP.loadAll( 0 );
	int numMovingChannels = loaderP.numChannels();

	final AbstractSpimData< ? >[] spimDataQ = new AbstractSpimData[]{ createSpimData( reader ) };
	
	BigWarpExporter< ? > exporter = BigWarpBatchTransformFOV.applyBigWarpHelper( spimDataP, spimDataQ, impP, ltm, Interpolation.NLINEAR );
	
	ImagePlus ipout = exporter.exportMovingImagePlus( false );

	IJ.save( ipout, dstName );

}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:34,代码来源:BigWarpBatchTransform.java


示例18: exit

import loci.formats.FormatException; //导入依赖的package包/类
/**
 * Cleans up, closing any active reader and writer streams, then terminates
 * the JVM using {@link System#exit(int)} with the given exit code.
 * 
 * @param val The exit code to use when quitting the Java process.
 * @throws FormatException Never thrown.
 * @throws IOException If something goes wrong closing the streams.
 */
public void exit(final int val) throws FormatException, IOException {
	if (reader != null) reader.close();
	if (writer != null) writer.close();
	if (in != null) in.close();
	System.exit(val);
}
 
开发者ID:scifio,项目名称:scifio-itk-bridge,代码行数:15,代码来源:SCIFIOITKBridge.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LayerArrow类代码示例发布时间:2022-05-22
下一篇:
Java FileSystemUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap