nd2reader icon indicating copy to clipboard operation
nd2reader copied to clipboard

Missing metadata

Open zorba-the-geek opened this issue 6 years ago • 3 comments

Hi,

I'm prob a bit dense here, but I am wondering why some metadata is missing with this reader as opposed to https://github.com/soft-matter/pims_nd2

The other reader provides a 'metadata_text' with info related to camera model and microscope settings. It is using the nikon sdk. I am trying to figure out the raw_metadata module and if a label_map is required to get the extra metadata.

zorba-the-geek avatar Feb 28 '19 17:02 zorba-the-geek

I'm not sure which metadata exactly you're after. You can access the raw_metadata object like this: reader.parser._raw_metadata where reader is your ND2Reader object.

The RawMetadata object has a property called image_text_info which might contain what you are looking for. For an example file, reader.parser._raw_metadata.image_text_info returns:

{
  b'SLxImageTextInfo': {
    b'TextInfoItem_0': b'',
    b'TextInfoItem_1': b'',
    b'TextInfoItem_2': b'',
    b'TextInfoItem_3': b'',
    b'TextInfoItem_4': b'',
    b'TextInfoItem_5': b'Metadata:\r\nDimensions: T(597)\r\nCamera Name: DS-Qi1Mc-U3  12 bit\r\nNumerical Aperture: 1.2\r\nRefractive Index: 1.333\r\n Name: R BF 60xWI-1x\r\n Component Count: 1\r\n Modality: Widefield Fluorescence\r\n Camera Settings:   \r\n  Format: 1280x1024 no binning\r\n  Exposure: 5.4 ms\r\n  AnalogGain: 2.00\r\n  CoolingMode: -5 deg\r\n  AEQuantilTypes: Relative\r\n  AETargetIntensities: 95\r\n  AEQuantilPromile: 1.00\r\n  AEQuantilPixels: 100\r\n  EnableLiveAccel: 0\r\n\r\n Microscope Settings:   Microscope: Ti Microscope\r\n  Nikon Ti, FilterChanger(Turret1): 2\r\n  Nikon Ti, Illuminator(Illuminator-DIA): Remote Switch On\r\n  Nikon Ti, Illuminator(Illuminator-DIA): On\r\n  Nikon Ti, Illuminator(Illuminator-DIA) Voltage: 5.0\r\n  LightPath: R100\r\n  PFS-S, state: On\r\n  PFS-S, offset: 6166\r\n  PFS-S, mirror: Inserted\r\n  Zoom: 1.00x\r\nTime Loop: 597\r\n- Equidistant (Period 200 ms)',
    b'TextInfoItem_6': b'DS-Qi1Mc-U3  12 bit\r\n\r\nFormat: 1280x1024 no binning\r\nExposure: 5.4 ms\r\nAnalogGain: 2.00\r\nCoolingMode: -5 deg\r\nAEQuantilTypes: Relative\r\nAETargetIntensities: 95\r\nAEQuantilPromile: 1.00\r\nAEQuantilPixels: 100\r\nEnableLiveAccel: 0\r\n',
    b'TextInfoItem_7': b'',
    b'TextInfoItem_8': b'',
    b'TextInfoItem_9': b'10/01/2019  10:02:07',
    b'TextInfoItem_10': b'',
    b'TextInfoItem_11': b'',
    b'TextInfoItem_12': b'',
    b'TextInfoItem_13': b'Plan Apo VC 60x WI DIC N2'
  }
}

So your information could be in either TextInfoItem_5 or TextInfoItem_6.

There is currently no parser function that parses these items into something a bit more usable but if you have time to submit a pull request, I'm happy to merge something that parses this information and adds it to the metadata object.

rbnvrw avatar Mar 07 '19 10:03 rbnvrw

Thanks for the response, and yea is exactly what I was looking for. Didn't spot image_text_info. Thanks for the information!

If I figure out a decent way of turning it into a dict I'll push it up, but I don't have too many different types of nd2 files.

zorba-the-geek avatar Mar 08 '19 19:03 zorba-the-geek

@zorba-the-geek did you have any luck?

rbnvrw avatar Jul 02 '20 09:07 rbnvrw