Audit Trail Metadata

Your place to discuss general handling of images and the CZI file format
Post Reply
Dan Stevens
Posts: 7
Joined: Sat Aug 15, 2020 5:18 am

Audit Trail Metadata

Post by Dan Stevens »

Hello OAD Community,

Can anyone help me with accessing the "Custom Attributes" metadata of an image?

I am attempting to use image1.Metadata.GetMetadataStringWithPath() to call on this information. This works for other paths, but I cannot seem to pull any of this data under CustomAttributes.

I have an image subset that is generated out of a previous OAD script with image analysis as a cropped region, and the region location is present in the metadata at the location Metadata/CustomAttributes/SubsetString.

Any help would be appreciated.

Regards,

Dan
Dan Stevens
Posts: 7
Joined: Sat Aug 15, 2020 5:18 am

Re: Audit Trail Metadata

Post by Dan Stevens »

Hello Folks,

Here to answer my own question. The code below allows access to the Processing Audit Trail. The metadata needs to be extracted as a collection, which can then be accessed as a collection (dictionary?).

Code: Select all

image1 = Zen.Application.Documents.ActiveDocument
temp1 = image1.Metadata.GetMetadataWithPath("Metadata/CustomAttributes/")
print temp1["SubsetString"]
Regards,

Dan
Last edited by Dan Stevens on Tue Aug 18, 2020 7:26 am, edited 1 time in total.
Dan Stevens
Posts: 7
Joined: Sat Aug 15, 2020 5:18 am

Re: Audit Trail Metadata

Post by Dan Stevens »

Further reply,

The subset location is available directly from the meta data collection, as posted previously, but the remaining Audit Trail data is difficult to access. I believe it is in an XML collection, and I can't get any XML library commands to work in Zen environment.

I converted the Audit Trail to a string variable, and then searched the string for the information. At least the XML formatting makes this easy and reproducible.

Code: Select all

### This code finds the original file name of a subset image and opens that original file
auditMetaData = image1.Metadata.GetMetadataWithPath("Metadata/CustomAttributes/")
auditTrail = auditMetaData["AuditTrail"]  ## converts the AuditTrail to a string variable
inputStart = auditTrail.find("<Input>") + 7  ## finds the start of the <input> marker and adds 7 for the length of the marker
inputEnd = auditTrail.find("</Input>")
inputFilePath = auditTrail[inputStart:inputEnd]
originImage = Zen.Application.LoadImage(inputFilePath, False)
Zen.Application.Documents.Add(originImage)
Post Reply