Identifying microscopy instruments

Hi,

I want to group datasets by instruments in omero. For that, I try to retrieve instrument specific information from the images original metadata, and try to populate corresponding entries in the omero metadata, and ideally assigning a single Instrument object to all the datasets from the same machine.

I got a set of files from diverse instruments on the same platform and here is what I found so far:


objective_names = {
    "leica-sted": 'Image|ATLConfocalSettingDefinition|ObjectiveName', # lif
    "zeiss-510": 'Recording Objective #1', # lsm + mdb
    "lsm-780": 'Recording Objective #1', # lsm
    "metamorph": 'Ti Objective', # nd
    "nikon": "sObjective",  #nd2
    "zeiss-880": "Information|Instrument|Objective|Manufacturer|Model #1", # czi
    "zen-apotome": "Information|Instrument|Objective|Name #1", # czi
}

magic_numbers = {
    "lsm-780": "MagicNumber",
    "zeiss-510": "MagicNumber",
}

objective_serial = {
    "leica-sted": 'Image|ATLConfocalSettingDefinition|ObjectiveNumber',
    "nikon": 'wsObjectiveCode',
    # Check for the objective with same name in
    # 'HardwareSetting|Configuration|Device|Objective|Name #2'
    "zen-apotome": 'HardwareSetting|Configuration|Device|Objective|UniqueName #2'
}

microscope_name = {
    "leica-sted": 'Image|ATLConfocalSettingDefinition|MicroscopeModel',
    "nikon": 'Microscope',
    "zeiss-880": 'Information|Instrument|Microscope|System #1',
    "zen-apotome": 'Information|Instrument|Microscope|Name'
}


system_number = {
    "leica-sted": 'Image|ATLConfocalSettingDefinition|SystemSerialNumber'
}


My feeling is that it is difficult to identify an instrument in a reliable way by ‘just’ parsing the metadata (so this must be why BioFormats don’t even try :wink: ).

I’ll try to populate this post with more info as I go on in my enquiery

Questions

  • Does someone know if #Zeiss MagicNumber is instrument specific?
  • Did someone already do that kind of stuff?

Speculation

I’m now thinking that I should try to group my images by some text similarity measure / bar-coding strategy …

Any hint or insight is welcome,

Have a nice day!

Guillaume

Hi @glyg,

Wow. Quite the topic you’ve opened! :wink: I should start off by saying your use-case is certainly something that discussions like Metadata for OME Next Generation File Format (NGFF) - #26 by Caterina have in mind, so :thumbsup:

With more effort, Bio-Formats could likely figure out more, it’s true. Always a question of cost.

It may though be something that aicsimageio is already accessing, making use of libczi.
~Josh

cc: @heeler @sebi06 @Caterina
Tags add: #industry #zeiss

With more effort, Bio-Formats could likely figure out more, it’s true. Always a question of cost.

Just to be clear, my intent was not to critisize the work by Bio-Formats, I really think this is a generally untractable problem! Getting the pixel values in the correct order is already quite the accomplishement!

I’ll look into aicsimageio again, thanks :slight_smile:

This is what I’ve learned from the formats etc.

  1. If the magic number you are referring to is the binary value at the top of the image file then no it isn’t instrument unique, only manufacturer unique. We use it to confirm the file type.
  2. aicsimageio does expose the full metadata from Zeiss files (both the main metadata blob and the subblock specific metadata (stored separately in the file)

Sadly my best guess is that there isn’t really such a thing as a “microscope identifier” you can find the name and the lightsources but not one identifier that sums all those up
here’s the instrument section of an example file to illustrate what I mean

    <Instrument>
        <Microscopes>
          <Microscope Id="Microscope:1" Name="Axio Observer.Z1 / 7">
            <Type>Inverted</Type>
          </Microscope>
        </Microscopes>
        <LightSources>
          <LightSource Id="LightSource:1" Name="CSU Laserline 2">
            <LightSourceType>
              <Laser>
                <Wavelength>488</Wavelength>
              </Laser>
            </LightSourceType>
          </LightSource>
          <LightSource Id="LightSource:2" Name="Other Lamp"/>
          <LightSource Id="LightSource:3" Name="CSU Laserline 3">
            <LightSourceType>
              <Laser>
                <Wavelength>561</Wavelength>
              </Laser>
            </LightSourceType>
          </LightSource>
          <LightSource Id="LightSource:4" Name="Other Lamp"/>
          <LightSource Id="LightSource:5" Name="Other Lamp"/>
        </LightSources>
        <Detectors>
          <Detector Id="Detector:Camera 2 (Left)" Name="Camera 2 (Left)">
            <Manufacturer>
              <Model>HDCamC11440-22C</Model>
            </Manufacturer>
            <Adapter>
              <Manufacturer>
                <Model>1.2x EMCCD Camera Adapter</Model>
              </Manufacturer>
            </Adapter>
          </Detector>
        </Detectors>
        <Objectives>
          <Objective Id="Objective:1" Name="Plan-Apochromat 20x/0.8 M27">
            <LensNA>0.8</LensNA>
            <NominalMagnification>20</NominalMagnification>
            <WorkingDistance>610</WorkingDistance>
            <PupilGeometry>Circular</PupilGeometry>
            <ImmersionRefractiveIndex>1.000293</ImmersionRefractiveIndex>
            <Immersion>Air</Immersion>
            <Manufacturer>
              <Model>Plan-Apochromat 20x/0.8 M27</Model>
            </Manufacturer>
          </Objective>
        </Objectives>
        <TubeLenses>
          <TubeLens Id="TubeLens:1" Name="1.0x Tubelens extended">
            <Magnification>1</Magnification>
          </TubeLens>
        </TubeLenses>
     </Instrument>

So the metadata contains the list of pieces that make up the system but from my quick exploration no Serial Numbers for example.
Also the metadata can change at manufacturers whim so be warned of that.
I think what your trying to do will be challenging. You might be able to approximate it by taking the metadata instrument block and using it to generate a hash but I don’t know how reproducible that will be.

I hope this helps.

1 Like

Yes thank you that helps,

This is also my conclusion, that no unique id is given for an instrument on Zeiss files. The MagicNumber I was referring to is an entry in the original metadata for lsm file, which is not here anymore in CZI files

No offense taken, @glyg! :smile: Just clarifying for the funders.

From the OME-XML side of things, this could certainly be a UUID or similar if it were available, which is perhaps where we want to go using some form of identifier (e.g. RRID | Welcome..., etc.)

~J.

cc: @nitschro

Hi all,

this is an interesting discussion. But what is not really clear to me, what is the actual problem you are trying to solve (sorry if I missed it).

Is the question how can one unambigiously identify the instrument (used to acquire the image) by checking certain entries inside the image metadata?

From my experience a lot of people tpically store the images in a folder or database in a unique location per instrument. This is not 100% fool-proof, but If this is combined with a database it should work mostly fine. This is alo how we currently mostyl approach this with our database solution.

But I think you are correct, the CZI metadata contain no GUID etc. for a specific instrument but rather a collection of metadate entries. We use GUIDs to identify our machine-learning models, but otherwise “user-facing” files have no unique ID when created by the ZEN blue software.

Having this said in ZEN core there is a GxP module that allows to protect (checksums) whole workflows at least in a way that nobody can edit them.

For a CZI this would be the complete hardware settings, the actual experiment and other information. Find a few here below (shortend).

  • User: {‘Id’: 0}
  • Application: {‘Name’: ‘ZEN 3.1 (blue edition)’, ‘Version’: ‘3.1.0.0000’}
  • Document: {‘CreationDate’: ‘2016-02-12T10:41:02.5655647+01:00’, ‘UserName’: ‘user1’}
  • Instrument:
    • Microscopes: {‘Microscope’: {‘Type’: ‘Inverted’, ‘Id’: ‘Microscope:1’, ‘Name’: ‘Castor.Stand’}},
    • LightSources:
      • LightSource: [{‘LightSourceType’: {‘LightEmittingDiode’: None}, ‘Id’: ‘LightSource:1’, ‘Name’: 'LED-Module 567nm '}, {‘LightSourceType’: {‘LightEmittingDiode’: None}, ‘Id’: ‘LightSource:2’, ‘Name’: ‘LED-Module 470nm’}]}
  • Detectors’: {‘Detector’: {‘Manufacturer’: {‘Model’: ‘Axiocam506m’}, ‘Adapter’: {‘Manufacturer’: {‘Model’: ‘1x Camera Adapter’}}, ‘Id’: ‘Detector:Axiocam 506’, ‘Name’: ‘Axiocam 506’}}
  • Objectives’: {‘Objective’: {‘LensNA’: 1.2, ‘NominalMagnification’: 50, ‘WorkingDistance’: 800, ‘PupilGeometry’: ‘Circular’, ‘ImmersionRefractiveIndex’: 1.33, ‘Immersion’: ‘Water’, ‘Manufacturer’: {‘Model’: ‘Plan-Apochromat 50x/1.2’}, ‘Id’: ‘Objective:1’, ‘Name’: ‘Plan-Apochromat 50x/1.2’}}
  • TubeLenses:
    • TubeLens’: {‘Magnification’: 1, ‘Id’: ‘TubeLens:1’, ‘Name’: ‘Castor.Tubelens 1.0x’}}
  • FilterSets:
    • ‘FilterSet’: …

There are also

  • CustomAttributes
    • AudiTrail: … → what processing was done …

I hope this at least helps a bit. But I would be interested in the real use case and what you expectations towards a fileformat like CZI or a device actually are.

Best regards,

Sebi

1 Like

Thank you for your answer,

To give you a more precise use case: I have a legacy database of images, and would like to sort them by the instrument, with the goal of trying to asses image quality evolution through time. I have no a priori info on where the users stored each image (and it surely is not homogeneous).

I understand this tends to produce some kind of ship of Theseus problem, so maybe gathering the components rather than the “instrument” is a more robust way of achieving what I want… The hash for a given workflow surely sounds interesting, I’ll see wether this can be setup on the platform.

Best
Guillaume

1 Like