本文整理汇总了Java中loci.formats.meta.IMetadata类的典型用法代码示例。如果您正苦于以下问题:Java IMetadata类的具体用法?Java IMetadata怎么用?Java IMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMetadata类属于loci.formats.meta包,在下文中一共展示了IMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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);
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例9: retrieveSourceMetadata
import loci.formats.meta.IMetadata; //导入依赖的package包/类
private static IMetadata retrieveSourceMetadata(VirtualSlide sourceSlide)
{
if(sourceSlide instanceof BioformatsVirtualSlide)
{
return ((BioformatsVirtualSlide)sourceSlide).getBioformatsMetadata();
}
return null;
}
示例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;
}
示例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;
}
}
示例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);
}
示例13: getBioformatsMetadata
import loci.formats.meta.IMetadata; //导入依赖的package包/类
public IMetadata getBioformatsMetadata()
{
return mMetadata;
}
示例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;
}
示例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);
}