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

Java IMetadata类代码示例

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

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



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

示例1: load

import loci.formats.meta.IMetadata; //导入依赖的package包/类
/**
 * @param filePath Path of the file to open.
 * 
 * @throws VirtualSlideLoadException When virtual slide could not be loaded because file does not exist or is in unsupported format.
 */
@Override
public VirtualSlide load(Path filePath) throws VirtualSlideLoadException, UncheckedInterruptedException
{
	ParameterValidator.throwIfNull(filePath, "filePath");
	
	IMetadata  metadata   = MetadataTools.createOMEXMLMetadata();
	ReaderPool readerPool = new ReaderPool(() -> initReader(filePath, metadata));
	
	try
	{
		BioformatsVirtualSlide newSlide = new BioformatsVirtualSlide(metadata, getFileFormat(readerPool));

		loadImages(newSlide, readerPool);
		
		return newSlide;
	}
	catch(Exception e)
	{
		readerPool.close();
		throw e;
	}
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:28,代码来源:BioformatsLoader.java


示例2: addLowerResolutionTag

import loci.formats.meta.IMetadata; //导入依赖的package包/类
/**
 * @return The Tag ID.
 */
private static String addLowerResolutionTag(IMetadata metadata)
{
	int lowerResolutionTagIndex = getLowerResolutionTagIndex(metadata);
	if(lowerResolutionTagIndex == -1)
	{
		lowerResolutionTagIndex = getTagAnnocationCount(metadata);
	}

	metadata.setTagAnnotationID(MetadataTools.createLSID("TagAnnotation", lowerResolutionTagIndex), lowerResolutionTagIndex);
	metadata.setTagAnnotationValue(LOWER_RESOLUTION_IMAGE_TAG_VALUE, lowerResolutionTagIndex);
	metadata.setTagAnnotationDescription("Indicates that an image referencing this tag is a lower resolution version of a previous one." ,
	                                     lowerResolutionTagIndex);
	
	return metadata.getTagAnnotationID(lowerResolutionTagIndex);
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:19,代码来源:MetadataConstructor.java


示例3: removeEntriesForRemovedImages

import loci.formats.meta.IMetadata; //导入依赖的package包/类
private static void removeEntriesForRemovedImages(IMetadata metadata, int imageCount)
{
	OMEXMLMetadataRoot metadataRoot = (OMEXMLMetadataRoot)metadata.getRoot();
	
	List<Image> imagesToRemove = new ArrayList<>();

	for(int i = imageCount; i < metadata.getImageCount() ;++i)
	{
		imagesToRemove.add(metadataRoot.getImage(i));
	}
	
	for(Image imageToRemove : imagesToRemove)
	{
		metadataRoot.removeImage(imageToRemove);
	}
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:17,代码来源:MetadataConstructor.java


示例4: save

import loci.formats.meta.IMetadata; //导入依赖的package包/类
public void save(VirtualSlide slide, Path destinationPath, SaveProgressReporter progress) throws IOException, UncheckedInterruptedException
{	
	ParameterValidator.throwIfNull(slide, "slide");
	ParameterValidator.throwIfNull(destinationPath, "destinationPath");
	ParameterValidator.throwIfNull(progress, "progress");
	
	Path tempFilePath = Files.createTempFile(destinationPath.getParent(), null, null);

	try
	{
		IMetadata metadata = MetadataConstructor.constructMetadata(slide);
		
		savePixelsTo(slide, tempFilePath, metadata, progress);
		
		// Needs to close the slide if saving to the same file as original under Windows
		slide.close();
		
		Files.move(tempFilePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
	}
	catch(Exception e)
	{
		Files.delete(tempFilePath);
		throw e;
	}
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:26,代码来源:OmeTiffSavingService.java


示例5: getSeriesResolutionCount

import loci.formats.meta.IMetadata; //导入依赖的package包/类
private List<Integer> getSeriesResolutionCount(IMetadata metadata)
{
	String lowerResolutionTagID = getLowerResolutionTagID(metadata);
	
	List<Integer> seriesResolutionCount = new ArrayList<>();
	for(int i = 0; i < metadata.getImageCount() ;++i)
	{
		if(isLowerResolution(metadata, i, lowerResolutionTagID))
		{
			int currentResolutionCount = seriesResolutionCount.get(seriesResolutionCount.size() - 1);
			
			seriesResolutionCount.set(seriesResolutionCount.size() - 1, currentResolutionCount + 1);
		}
		else
		{
			seriesResolutionCount.add(1);
		}
	}
	return seriesResolutionCount;
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:21,代码来源:OmeTiffLoader.java


示例6: isLowerResolution

import loci.formats.meta.IMetadata; //导入依赖的package包/类
private boolean isLowerResolution(IMetadata metadata, int imageIndex, String lowerResolutionTagID)
{
	if(lowerResolutionTagID == null)
		return false;
	
	for(int annotationIndex = 0; annotationIndex < metadata.getImageAnnotationRefCount(imageIndex) ;++annotationIndex)
	{
		String annotationID = metadata.getImageAnnotationRef(imageIndex, annotationIndex);
        
		if(annotationID.equals(lowerResolutionTagID))
		{
			return true;
		}
	}
	
	return false;
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:18,代码来源:OmeTiffLoader.java


示例7: main

import loci.formats.meta.IMetadata; //导入依赖的package包/类
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();
    }
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:38,代码来源:MihcTest.java


示例8: BioformatsVirtualSlide

import loci.formats.meta.IMetadata; //导入依赖的package包/类
public BioformatsVirtualSlide(IMetadata metadata, String format)
{
	ParameterValidator.throwIfNull(metadata, "metadata");
	ParameterValidator.throwIfNull(format, "format");
	
	mMetadata = metadata;
	mFormat   = format;
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:9,代码来源:BioformatsVirtualSlide.java


示例9: retrieveSourceMetadata

import loci.formats.meta.IMetadata; //导入依赖的package包/类
private static IMetadata retrieveSourceMetadata(VirtualSlide sourceSlide)
{
	if(sourceSlide instanceof BioformatsVirtualSlide)
	{
		return ((BioformatsVirtualSlide)sourceSlide).getBioformatsMetadata();
	}
	
	return null;
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:10,代码来源:MetadataConstructor.java


示例10: getLowerResolutionTagIndex

import loci.formats.meta.IMetadata; //导入依赖的package包/类
/**
 * Gets the index of tag representing that given image is a lower resolution.
 * 
 * @return The index of tag or -1 if there is no lower resolution tag in the metadata.
 */
public static int getLowerResolutionTagIndex(IMetadata metadata)
{
	for(int tagAnnotationIndex = 0; tagAnnotationIndex < getTagAnnocationCount(metadata) ;++tagAnnotationIndex)
	{
		if(metadata.getTagAnnotationValue(tagAnnotationIndex).equals(LOWER_RESOLUTION_IMAGE_TAG_VALUE))
		{
			return tagAnnotationIndex;
		}
	}	
	
	return -1;
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:18,代码来源:MetadataConstructor.java


示例11: getTagAnnocationCount

import loci.formats.meta.IMetadata; //导入依赖的package包/类
private static int getTagAnnocationCount(IMetadata metadata)
{
	try
	{
		return metadata.getTagAnnotationCount();
	}
	catch(NullPointerException e)
	{
		// getTagAnnotationCount() throws NullPointerException() when there are no tags...
		return 0;
	}
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:13,代码来源:MetadataConstructor.java


示例12: mergeRGBChannels

import loci.formats.meta.IMetadata; //导入依赖的package包/类
/**
 * Checks if it is not already RGB, sizeC==3 and rgbChannelCount==1
 * Deprecated (does not work for all images). Use OmeroReaderOrbit.isRGBImage() instead.
 */
@Deprecated
private boolean mergeRGBChannels(boolean isRGB, int sizeC, int rgbChannelCount,  IMetadata meta) {
    return  (!isRGB) && (sizeC==3) && (rgbChannelCount==1);
}
 
开发者ID:mstritt,项目名称:image-provider-omero,代码行数:9,代码来源:OrbitImageBioformatsOmero.java


示例13: getBioformatsMetadata

import loci.formats.meta.IMetadata; //导入依赖的package包/类
public IMetadata getBioformatsMetadata()
{
	return mMetadata;
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:5,代码来源:BioformatsVirtualSlide.java


示例14: constructMetadata

import loci.formats.meta.IMetadata; //导入依赖的package包/类
/**
 * Constructs OME-XML metadata for a virtual slide.
 * 
 * If the slide already contains OME-XML metadata, any metadata entries unused by the application are preserved in their original form.
 */
public static IMetadata constructMetadata(VirtualSlide slide)
{
	IMetadata metadata = MetadataTools.createOMEXMLMetadata();
	
	IMetadata sourceMetadata = retrieveSourceMetadata(slide);
	if(sourceMetadata != null)
	{
		MetadataConverter.convertMetadata(sourceMetadata, metadata);
	}

	String lowerResolutionTagID = addLowerResolutionTag(metadata);
	
	int seriesIndex = 0;
	
	for(VirtualSlideImage image : slide.getImageList())
	{
		for(int resIndex = image.getResolutionCount() - 1; resIndex >= 0 ;--resIndex)
		{
			copyImageMetadata(sourceMetadata, image, metadata, seriesIndex);
			
			metadata.setUUID(UUID.randomUUID().toString());
			metadata.setImageName(image.getName(), seriesIndex);
			metadata.setImageID(MetadataTools.createLSID("Image", seriesIndex), seriesIndex);

			metadata.setPixelsID(MetadataTools.createLSID("Pixels", seriesIndex), seriesIndex);
			metadata.setPixelsBigEndian(false, seriesIndex);
			metadata.setPixelsInterleaved(true, seriesIndex);
			metadata.setPixelsSignificantBits(new PositiveInteger(8), seriesIndex);
			metadata.setPixelsType(PixelType.UINT8, seriesIndex);
			metadata.setPixelsDimensionOrder(DimensionOrder.XYTZC, seriesIndex);
			
			metadata.setPixelsSizeX(new PositiveInteger(image.getImageSize(resIndex).width),  seriesIndex);
			metadata.setPixelsSizeY(new PositiveInteger(image.getImageSize(resIndex).height), seriesIndex);
			metadata.setPixelsSizeC(new PositiveInteger(image.getChannelCount() * (image.isRGB() ?  3 : 1)), seriesIndex);
			metadata.setPixelsSizeZ(new PositiveInteger(image.getZPlaneCount()), seriesIndex);
			metadata.setPixelsSizeT(new PositiveInteger(image.getTimePointCount()), seriesIndex);
			
			for(int channelIndex = 0; channelIndex < image.getChannelCount() ;++channelIndex)
			{
				metadata.setChannelID(MetadataTools.createLSID("Channel", seriesIndex, channelIndex), seriesIndex, channelIndex);
				metadata.setChannelSamplesPerPixel(new PositiveInteger(image.isRGB() ? 3 : 1), seriesIndex, channelIndex);
			}
			
			if(resIndex != image.getResolutionCount() - 1)
			{
				int resLevel = image.getResolutionCount() - 1 - resIndex;
				
				metadata.setImageName(String.format("%s res level %d", image.getName(), resLevel), seriesIndex);
				metadata.setImageAnnotationRef(lowerResolutionTagID, seriesIndex, metadata.getImageAnnotationRefCount(seriesIndex) + 1);
			}
			
			seriesIndex++;
		}
	}
	
	removeEntriesForRemovedImages(metadata, seriesIndex);

	return metadata;
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:65,代码来源:MetadataConstructor.java


示例15: copyImageMetadata

import loci.formats.meta.IMetadata; //导入依赖的package包/类
/**
 * Copies metadata of an image.
 * 
 * Required to preserve original image metadata in the case of image reordering.
 */
private static void copyImageMetadata(IMetadata sourceMetadata, VirtualSlideImage source, IMetadata destinationMetadata, int destinationIndex)
{
	if(!(source instanceof BioformatsVirtualSlideImage))
		return;
	
	OMEXMLMetadataRoot sourceMetadataRoot = (OMEXMLMetadataRoot)sourceMetadata.getRoot();
	
	Image sourceImage      = sourceMetadataRoot.getImage(((BioformatsVirtualSlideImage)source).getSeriesIndex());
	Image destinationImage = new Image();
	
	destinationImage.setAcquisitionDate(sourceImage.getAcquisitionDate());
	destinationImage.setDescription(sourceImage.getDescription());
	destinationImage.setID(sourceImage.getID());
	destinationImage.setName(sourceImage.getName());
	
	if(sourceImage.getImagingEnvironment() != null)
	{
		destinationImage.setImagingEnvironment(new ImagingEnvironment(sourceImage.getImagingEnvironment()));
	}
	
	if(sourceImage.getObjectiveSettings() != null)
	{
		destinationImage.setObjectiveSettings(new ObjectiveSettings(sourceImage.getObjectiveSettings()));
	}
	
	if(sourceImage.getPixels() != null)
	{
		destinationImage.setPixels(new Pixels(sourceImage.getPixels()));
	}
	
	if(sourceImage.getStageLabel() != null)
	{
		destinationImage.setStageLabel(new StageLabel(sourceImage.getStageLabel()));
	}
	
	destinationImage.linkExperiment(sourceImage.getLinkedExperiment());
	destinationImage.linkExperimenter(sourceImage.getLinkedExperimenter());
	destinationImage.linkExperimenterGroup(sourceImage.getLinkedExperimenterGroup());
	destinationImage.linkInstrument(sourceImage.getLinkedInstrument());
	
	for(Annotation linkedAnnotation : sourceImage.copyLinkedAnnotationList())
	{
		destinationImage.linkAnnotation(linkedAnnotation);
	}
	
	for(Dataset linkedDataset : sourceImage.copyLinkedDatasetList())
	{
		destinationImage.linkDataset(linkedDataset);
	}
	
	for(MicrobeamManipulation linkedMicrobeamManipulation : sourceImage.copyLinkedMicrobeamManipulationList())
	{
		destinationImage.linkMicrobeamManipulation(linkedMicrobeamManipulation);
	}
	
	for(ROI linkedROI : sourceImage.copyLinkedROIList())
	{
		destinationImage.linkROI(linkedROI);
	}
	
	for(WellSample linkedWellSample : sourceImage.copyLinkedWellSampleList())
	{
		destinationImage.linkWellSample(linkedWellSample);
	}
	
	OMEXMLMetadataRoot destinationMetadataRoot = (OMEXMLMetadataRoot)destinationMetadata.getRoot();
	
	while(destinationIndex >= destinationMetadataRoot.sizeOfImageList())
	{
		destinationMetadataRoot.addImage(destinationImage);
	}
	
	destinationMetadataRoot.setImage(destinationIndex, destinationImage);
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:80,代码来源:MetadataConstructor.java


示例16: savePixelsTo

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


示例17: getLowerResolutionTagID

import loci.formats.meta.IMetadata; //导入依赖的package包/类
private String getLowerResolutionTagID(IMetadata metadata)
{
	int lowerResolutionTagIndex = MetadataConstructor.getLowerResolutionTagIndex(metadata);
	
	return (lowerResolutionTagIndex != -1) ? metadata.getTagAnnotationID(lowerResolutionTagIndex) : null;
}
 
开发者ID:Strachu,项目名称:VirtualSlideViewer,代码行数:7,代码来源:OmeTiffLoader.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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