How can I extract Acquisition Time metadata with msec accuracy?

Your place to discuss general handling of images and the CZI file format
Post Reply
user-4073
Posts: 1
Joined: Thu Jan 01, 1970 1:00 am

How can I extract Acquisition Time metadata with msec accuracy?

Post by user-4073 »

Hello,
I would like to determine a way to extract the timestamp information from when an image is captured. Currently the timing information from the metadata file only has resolution of a second despite the computer clock where this information is sourced having far greater accuracy.For my application I require msec accuracy. The relative time annotation gives information with msec accuracy so the software must be generating a zero reference point and taking points with msec resolution from this point. Is there a way to get a msec accuracy readout of the time point the software is using as the zero point so we can use this as a reference point. Or the better option would be for the metadata Acquisition time to be msec resolution rather than sec resolution.
Any help with this matter would be greatly appreciated!
user-8
Posts: 63
Joined: Thu Jan 01, 1970 1:00 am

Post by user-8 »

Hi guys,

there is a way to do this in Fiji using a macro. It works for most CZI files.

Code: Select all

// Uses Bio-Formats to print the chosen file's plane timings to the Log.

run("Bio-Formats Macro Extensions");
id = File.openDialog("Choose a file");
print("Image path: " + id);
Ext.setId(id);

creationDate = "";
Ext.getImageCreationDate(creationDate);
print("Creation date: " + creationDate);

Ext.getDimensionOrder(dimOrder);
print("Dimension order: ",dimOrder);

Ext.getImageCount(imageCount);
print("Plane count: " + imageCount);
creationDate = "";

Ext.getSeriesCount(seriesCount);
for (s=0; s<seriesCount; s++) {
    Ext.setSeries(s);
    Ext.getSizeX(sizeX);
    Ext.getSizeY(sizeY);
    Ext.getSizeZ(sizeZ);
    Ext.getSizeC(sizeC);
    Ext.getSizeT(sizeT);
    print("Series #" + s + ": image resolution is " + sizeX + " x " + sizeY);
    print("Focal plane count = " + sizeZ);
    print("Channel count = " + sizeC);
    print("Time point count = " + sizeT);
}

deltaT = newArray(imageCount);
exposureTime = newArray(imageCount);
print("Plane deltas (seconds since experiment began):");
for (no=0; no<imageCount; no++) {
    
    Ext.getPlaneTimingDeltaT(deltaT[no], no);
    Ext.getPlaneTimingExposureTime(exposureTime[no], no);
    
    if (deltaT[no] == deltaT[no]) { // not NaN
        s = "\t" + (no + 1) + ": " + deltaT[no] + " s";
    
          if (exposureTime[no] == exposureTime[no]) { // not NaN
            s = s + " [exposed for " + exposureTime[no] + " s]";
          }
          
          print(s);
    }
}

print("Complete.");
Save the file as Plane_Timings.ijm

Cheers,

CZ6
user-6703
Posts: 1
Joined: Thu Jan 01, 1970 1:00 am

follow up

Post by user-6703 »

Hi there,

This script gives you the milliseconds after initiation of the experiment, but does not give the actual timestamp.

How does one acquire the true Timestamp, which you can access under the Graphics>>Frequent Annotations>>Acquisition Time tab in Zen.

Thank you,
Jacob
user-4
Posts: 398
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello Jacob,

maybe the following Code can belp you:

Code: Select all

image = Zen.Application.ActiveDocument

dateTime = image.Metadata.AcquisitionDateTimeLocal

print dateTime
Post Reply