We're Hiring!

Get TimeStamp for czi files

Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats
Please note:
Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats

If you are having trouble with image files, there is information about reporting bugs in the Bio-Formats documentation. Please send us the data and let us know what version of Bio-Formats you are using. For issues with your code, please provide a link to a public repository, ideally GitHub.

Get TimeStamp for czi files

Postby nhuebsch » Mon Dec 05, 2016 6:51 pm

Hi,

New to the forum so please forgive me if it's been posted elsewhere, but I'd like to use bfGetReader to open up time-series (X-Y-T) + have Matlab read-in the frame-rate.

Using bfGetReader and omeMeta I can easily identify correctly the physical X and Y units, but I am not able to get the syntax right to get the time-step units (I care more about the time between exposures than the actual exposure time for each frame). I've tried getPlaneDeltaT and other commands, and I either get an error, or a null value. I can use "SizeT" to get the number of time-steps, but haven't been able to extract the time between t-steps.

Thanks for your help!
nhuebsch
 
Posts: 7
Joined: Mon Dec 05, 2016 6:31 pm

Re: Get TimeStamp for czi files

Postby sbesson » Mon Dec 05, 2016 7:43 pm

Hi,

in most cases, the information you are looking for should be available via the Plane DeltaT metadata i.e. the timestamp for each plane, from which you can infer the time between 2 frames.

I ran the following code against a CZI file which populates this information. Note the MetadataRetrieve.getPlaneDeltaT takes 2 arguments: the index of the image and the index of the plane (both zero-based) and returns a time object from which you can extract the value and the unit:

Code: Select all
>> bfCheckJavaPath();

>> bfInitLogging();
>> r=bfGetReader('/path/to/WT_calc_after24h_stitch_2.czi');
Unknown IlluminationType value 'Fluorescence' will be stored as "Other"
>> nSeries = r.getSeriesCount();
>> m = r.getMetadataStore();
>> nImages = m.getImageCount()

nImages =
>> nPlanes = m.getPlaneCount(0)

nPlanes =

    24

>> t1 = m.getPlaneDeltaT(0,0)

t1 =

ome.units.quantity.Time: value[2.675153], unit[s] stored as java.lang.Double

>> t1 = m.getPlaneDeltaT(0,0).value

t1 =

2.675153

>> t2 = m.getPlaneDeltaT(0,2).value

t2 =

455.4420497


Does this return the information you are looking for in the context of your file?

Best,
Sebastien
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: Get TimeStamp for czi files

Postby nhuebsch » Mon Dec 05, 2016 8:16 pm

Yes this works! Thanks so much!

I'm able to extract the values needed using

"tx = double(t1) "
or by changing the initial call to read: " t2 = double(m.getPlaneDeltaT(0,2).value)"

Really appreciate the quick reply.

Thanks
nhuebsch
 
Posts: 7
Joined: Mon Dec 05, 2016 6:31 pm

Re: Get TimeStamp for czi files

Postby sbesson » Mon Dec 05, 2016 8:50 pm

No worries, glad to hear it worked.

You are right, the output of the `.value()` call returns a java Double object. To retrieve the value of the primitive type double which can be manipulated by MATLAB, assuming the object is not null, you can either use the method you described:

Code: Select all
t2 = double(m.getPlaneDeltaT(0,2).value());


or alternatively use the Java method:

Code: Select all
t2 = m.getPlaneDeltaT(0,2).value().doubleValue();


Best,
Sébastien
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm


Return to User Discussion [Legacy]

Who is online

Users browsing this forum: No registered users and 0 guests