gpt4 book ai didi

java - 批处理、解析和转换 .1sc 文件中的元数据

转载 作者:太空宇宙 更新时间:2023-11-04 06:46:18 25 4
gpt4 key购买 nike

TLDR:休息后提问。

我希望转换和存储大量 (3TB) *.1sc 图像(Bio-Rad,Quantity One)中的信息。除了实际图像之外,该文件还包含有关图像拍摄地点/方式的大量信息(元数据)。所有这些接缝都以 Intel Hex 格式保存(或者至少它们都以十六进制的“稳定文件版本 2.0 Intel 格式”打开)。

ImageJ 插件 Bioformats可以处理图像,并包含 MetadataTools 中的功能。为了仅捕获批量图像,我使用 batchTiffconvert 取得了巨大成功。插入。对于这种格式,ImageJ 中可用的元数据似乎是不完整的,但我不确定如何使用 MetadataTools (任何好的指南引用资料将不胜感激,目前正在浏览 API )。

我真正的问题并不是解析十六进制来找到我要找的东西。我失败的地方实际上是将十六进制转换成有意义的东西。示例:

.1sc hex example from VS2013

我可以解析 scan_area 的十六进制,但无法将 00 10 00 16 00 EC B5 86 00 转换为有意义的内容。

从与 similar DM3 question 相同的方向接近这一点,我能够制作一个 XML 文件,但即使我写出了整个 XML 文件,许多元数据也没有包含在内(它有诸如日期戳之类的东西,这很好)。我认为这是因为传递给 GelReader.Java 的信息所致来自BioRadReader.Java 。特别是本节:

if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {
String units = firstIFD.getIFDStringValue(MD_FILE_UNITS);
String lab = firstIFD.getIFDStringValue(MD_LAB_NAME);

addGlobalMeta("Scale factor", scale);
addGlobalMeta("Lab name", lab);
addGlobalMeta("Sample info", info);
addGlobalMeta("Date prepared", prepDate);
addGlobalMeta("Time prepared", prepTime);
addGlobalMeta("File units", units);
addGlobalMeta("Data format",
fmt == SQUARE_ROOT ? "square root" : "linear");
}

因为所有 Bio-Rad 脚本中设置的 MetadataLevel 均为 MetadataLevel.MINIMUM。我尝试在这里添加我想要的附加元数据,但同样无法有效地进行转换/解码。

<小时/>

是否可以使用此系统检索更多元数据?如果可以,我是否在正确的代码部分工作?生物格式的来源相当大,我什至不会假装很好地掌握了它(尽管我正在努力)。我只是遇到了专有格式问题吗?谁能告诉我如何转换十六进制值或指向更多解释它的资源?

最佳答案

首先:请注意,上面链接的来源实际上都不对应于 Bio-Formats 的 .1sc 文件格式阅读器。您想要BioRadGelReader .

Bio-Formats 库解析三种类型的元数据。来自 About Bio-Formats页面:

There are three types of metadata in Bio-Formats, which we call core metadata, original metadata, and OME metadata.

  1. Core metadata only includes things necessary to understand the basic structure of the pixels: image resolution; number of focal planes, time points, channels, and other dimensional axes; byte order; dimension order; color arrangement (RGB, indexed color or separate channels); and thumbnail resolution.
  2. Original metadata is information specific to a particular file format. These fields are key/value pairs in the original format, with no guarantee of cross-format naming consistency or compatibility. Nomenclature often differs between formats, as each vendor is free to use their own terminology.
  3. OME metadata is information from #1 and #2 converted by Bio-Formats into the OME data model. Performing this conversion is the primary purpose of Bio-Formats. Bio-Formats uses its ability to convert proprietary metadata into OME-XML as part of its integration with the OME and OMERO servers—essentially, they are able to populate their databases in a structured way because Bio-Formats sorts the metadata into the proper places. This conversion is nowhere near complete or bug free, but we are constantly working to improve it. We would greatly appreciate any and all input from users concerning missing or improperly converted metadata fields.

Bio-Formats command line tools能够转储给定数据集的所有原始元数据键/值对,以及转换后的OME-XML

就您而言,如果您想要的是数量而不是质量,您可能希望以某种方式记录所有原始元数据。 showinf 命令行工具会自动执行此操作(您实际上必须传递 -nometa 标志来抑制它)。

如果您查看原始元数据键/值对的完整列表,并且您查找的信息仍然不存在,那么我们必须进入下一个级别并改进 BioRadGelReader解析更多元数据。

不幸的是,检查源代码,看起来基本上没有任何内容被解析到该文件格式的原始元数据表中。它很可能是逆向工程,因为 Bio-Rad Gel format page说我们没有它的规范文档。

这意味着 Bio-Formats 开发人员和您一样对文件结构一无所知,并且会做与您相同的事情:盯着十六进制编辑器并尝试弄清楚事情。一些技巧包括:

  • 使用官方 Bio-Rad 软件查找元数据值,然后使用十六进制编辑器搜索各种编码的这些值。
  • 使用官方 Bio-Rad 软件编辑一个元数据值(如果可能),或者通过尽可能相似地进行多次采集(除了一个变量除外),然后比较输出文件,看看更改该值会产生什么影响。
  • 检查前几百个字节是否与容器格式的已知模式匹配,例如基于 Microsoft OLE 的数据、基于 TIFF 的数据或基于 HDF 的数据,因为许多格式会重复使用这些通用容器结构。

您还可以向 Bio-Rad 发送电子邮件,询问他们是否愿意发送规范,如果愿意,请使用它来改进文件格式阅读器,和/或将其转发给 Bio-Formats 开发人员。

关于java - 批处理、解析和转换 .1sc 文件中的元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23934761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com