loci.formats.services.OMEXMLService Java Examples

The following examples show how to use loci.formats.services.OMEXMLService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MihcTest.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
        String fn = "D:\\pic\\Hamamatsu\\fl8\\6188205.ndpis";
        fn = "D:\\pic\\Hamamatsu\\fl5ome\\test3.ndpis";
        int tx = 0;
        int ty = 0;
        NDPISReaderOrbit reader = new NDPISReaderOrbit();
        reader.setFlattenedResolutions(false);
        BufferedImageReader bir = new BufferedImageReader(reader);
        MihcConfigData confData = new MihcConfigData();
        reader.setId(fn);
        double[] gains = NDPIUtils.getExposureTimesGain(reader);
        logger.info("gains: "+ Arrays.toString(gains));
        reader.close();
        MihcConfig mihcConfig = new MihcConfig(confData.channelNames4HT,confData.Asn4,confData.normGain4);
        mihcConfig.saveConfig("d:/conf.xml");
     //   MultiplexImageReader mir = new MultiplexImageReader(bir,conf.channelNames6, conf.filterNewXeon6, conf.normGain6, gains);
        MultiplexImageReader mir = new MultiplexImageReader(bir,mihcConfig,gains);

        ServiceFactory factory = new ServiceFactory();
        OMEXMLService service = factory.getInstance(OMEXMLService.class);
        IMetadata meta = service.createOMEXMLMetadata();
        mir.setMetadataStore(meta);

        mir.setId(fn);
        System.out.println("image dimensions: "+reader.getSizeX()+","+reader.getSizeY());
        System.out.println("channel name: "+meta.getChannelName(mir.getSeries(),0));

//        for (int c=0; c<reader.getSizeC(); c++) {
//            long startt = System.currentTimeMillis();
//            BufferedImage img = mir.openImage(c, 100, 300, 2000, 2000);
//            long usedt = System.currentTimeMillis()-startt;
//            System.out.println("used time for channel "+c+": "+usedt);
//        }
        BufferedImage img = mir.openImage(2, 1000, 1000, 1000, 1000);
        ImageIO.write(img,"png",new File("d:/test.png"));
        reader.close();
    }