<div dir="ltr"><div>Hi Melissa,<br><br></div><div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 12, 2014 at 3:44 AM, Melissa Linkert <span dir="ltr"><<a href="mailto:melissa@glencoesoftware.com" target="_blank">melissa@glencoesoftware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Enno,<br>
<span class=""><br>
> What I need to do is to retrieve the positions of the multipoints in an nd2<br>
> file in order to know how to stitch them together.<br>
> I have nd2 files with 120 multipoints, several time-points and 2-3 channels.<br>
> I usually only retrieve the positions of the first time-point, since each<br>
> multipoint should be at the same position at following times. In my first<br>
> e-mail I outlined how to retrieve positions using the entries from<br>
> r.getGlobalMetadata().<br>
> Now I tried the same using the commands you gave me:<br>
><br>
> r.setMetadataStore(loci.formats.MetadataTools.createOMEXMLMetadata());<br>
> r.setID();<br>
> metadata = r.getMetadataStore();<br>
> planeIndex=0;<br>
> for positionIndex=1:120<br>
> xPosition(i) = metadata.getPlanePositionX(positionIndex, planeIndex);<br>
> yPosition(i) = metadata.getPlanePositionY(positionIndex, planeIndex);<br>
> end<br>
><br>
> However, I do not get the expected positions. For clarity I attach plots of<br>
> the x and y positions retrieved with versions 5.0.3 and 5.0.4 and also the<br>
> expected plot retrieved via my old method with version 5.0.3 and another<br>
> plot with wrong positions retrieved with my old method and version 5.0.4.<br>
><br>
> I know that I should get a pattern like in the lower left plot that I<br>
> attached. Can you help me once more how to call the correct positions?<br>
<br>
</span>The only thing that you might try here is calling:<br>
<br>
xPosition(i) = metadata.getPlanePositionX(positionIndex - 1, planeIndex);<br>
yPosition(i) = metadata.getPlanePositionY(positionIndex - 1, planeIndex);<br></blockquote><div><br></div><div>Sorry for that. This was only a typo in the e-mail. In my test I started the index with 0. <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
as the 'metadata' object is assuming that the index values start at 0.<br>
Otherwise, that all seems correct for getting the positions for the<br>
first timepoint and channel. If changing that index doesn't fully solve<br>
the problem, then this is most likely a bug in the metadata population.<br>
In that case, it would be very much appreciated if you could upload one<br>
of the files to <a href="http://qa.openmicroscopy.org/qa/upload" target="_blank">http://qa.openmicroscopy.org/qa/upload</a>.<br></blockquote><div><br></div><div>I tested different nd2 files. With bioformats 5.0.4 I could actually retrieve the right positions, but only if there was only one z and time-point. For higher t, I got unexpected positions. I uploaded an example nd2 <a href="http://qa.openmicroscopy.org.uk/qa/feedback/9529/">http://qa.openmicroscopy.org.uk/qa/feedback/9529/</a> that was small enough (I was a bit too quick in clicking buttons and created an empty QA Bug 9528 that should be ignored). The error seems to depend on the actual number of time-points, too, since the pattern seemed to change depending on how many time-points I had exactly.<br></div><div>I attached a plot of the correct x,y positions of the uploaded nd2 file.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class=""><br>
> I understand that the positionIndex should be the index for differnt<br>
> multipoints, but how does the planeIndex look like for different<br>
> time-points and channels?<br>
<br>
</span>For subsequent timepoints and channels, planeIndex can be calculated:<br>
<br>
timepoint = 2; % the timepoint to select, starting from 0<br>
channel = 1; % the channel to select, starting from 0<br>
zSection = 0; % the Z section to select (probably not applicable)<br>
planeIndex = FormatTools.getIndex(r, zSection, channel, timepoint);<br>
<span class=""><br>
> The next bit is not as important to me, but still with regards to the PFS<br>
> status: PFS offset and state are not quite sufficient for me. During my<br>
> experiments the PFS often fails to correct to the proper position and<br>
> resultingly there can be different status returns indicating if the PFS was<br>
> switched off, still searching, not finding, or actually finding the correct<br>
> z-position (maybe there are even more status possibilities, from the top of<br>
> my head I know that 0,1,5 and 7 are possible values). With NIS elements I<br>
> can take a look at those status values for each image to see what went<br>
> wrong. It would be nice if this information was to be retrieved by<br>
> bioformats, too. Also, I often have differnt PFS offsets, e.g. at different<br>
> multipoints. Hence, a single PFS offset value for the entire experiment<br>
> does not tell me too much.<br>
<br>
</span>OK, thanks for clarifying. There is now a ticket on our issue tracking<br>
system for fully parsing PFS values:<br>
<br>
<a href="http://trac.openmicroscopy.org.uk/ome/ticket/12560" target="_blank">http://trac.openmicroscopy.org.uk/ome/ticket/12560</a><br>
<br>
If you would like to be automatically notified of updates to the ticket,<br>
<span class="im">please let us know.<br></span></blockquote><div>It would be nice to get notified. Also, I want to emphasize that Nikon seems to distinguish between the PFS state and status. I guess the former can be just true or false, but the latter carries more information (see my last e-mail). <br><br></div><div>Many thanks,<br>Enno<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="im">
<br>
Regards,<br>
-Melissa<br>
<br>
</span><div class=""><div class="h5">On Tue, Sep 09, 2014 at 01:46:31PM +0200, Enno R. Oldewurtel wrote:<br>
> Hi Melissa,<br>
><br>
> thank you for your reply. I managed to use the commands you recommended.<br>
> It, also, helped me to look at an m-file by Sebastien Besson (<br>
> <a href="https://gist.github.com/sbesson/6529406" target="_blank">https://gist.github.com/sbesson/6529406</a>) to learn how to use the commands.<br>
> However, I still have some problems. Maybe I still do not understand how to<br>
> call the right plane with the right index.<br>
><br>
><br>
> What I need to do is to retrieve the positions of the multipoints in an nd2<br>
> file in order to know how to stitch them together.<br>
> I have nd2 files with 120 multipoints, several time-points and 2-3 channels.<br>
> I usually only retrieve the positions of the first time-point, since each<br>
> multipoint should be at the same position at following times. In my first<br>
> e-mail I outlined how to retrieve positions using the entries from<br>
> r.getGlobalMetadata().<br>
> Now I tried the same using the commands you gave me:<br>
><br>
> r.setMetadataStore(loci.formats.MetadataTools.createOMEXMLMetadata());<br>
> r.setID();<br>
> metadata = r.getMetadataStore();<br>
> planeIndex=0;<br>
> for positionIndex=1:120<br>
> xPosition(i) = metadata.getPlanePositionX(positionIndex, planeIndex);<br>
> yPosition(i) = metadata.getPlanePositionY(positionIndex, planeIndex);<br>
> end<br>
><br>
> However, I do not get the expected positions. For clarity I attach plots of<br>
> the x and y positions retrieved with versions 5.0.3 and 5.0.4 and also the<br>
> expected plot retrieved via my old method with version 5.0.3 and another<br>
> plot with wrong positions retrieved with my old method and version 5.0.4.<br>
><br>
> I know that I should get a pattern like in the lower left plot that I<br>
> attached. Can you help me once more how to call the correct positions? I<br>
> understand that the positionIndex should be the index for differnt<br>
> multipoints, but how does the planeIndex look like for different<br>
> time-points and channels?<br>
><br>
> The next bit is not as important to me, but still with regards to the PFS<br>
> status: PFS offset and state are not quite sufficient for me. During my<br>
> experiments the PFS often fails to correct to the proper position and<br>
> resultingly there can be different status returns indicating if the PFS was<br>
> switched off, still searching, not finding, or actually finding the correct<br>
> z-position (maybe there are even more status possibilities, from the top of<br>
> my head I know that 0,1,5 and 7 are possible values). With NIS elements I<br>
> can take a look at those status values for each image to see what went<br>
> wrong. It would be nice if this information was to be retrieved by<br>
> bioformats, too. Also, I often have differnt PFS offsets, e.g. at different<br>
> multipoints. Hence, a single PFS offset value for the entire experiment<br>
> does not tell me too much.<br>
><br>
><br>
> Many thanks,<br>
> Enno<br>
><br>
><br>
> On Tue, Sep 9, 2014 at 12:23 AM, Melissa Linkert <<br>
> <a href="mailto:melissa@glencoesoftware.com">melissa@glencoesoftware.com</a>> wrote:<br>
><br>
> > Hi Enno,<br>
> ><br>
> > > I use bioformats.jar with Matlab to read in ND2 files. Previously I used<br>
> > a<br>
> > > 5.0.0-DEV version of loci_tools.<br>
> > > With bioformats I have some problems to retrieve meta data from ND2<br>
> > files.<br>
> > > With 5.0.3 I can successfully read x,y,z position data, but with 5.0.4 I<br>
> > > get some discrepancies.<br>
> > > With both bioformat versions I fail to get the time values of each image.<br>
> > > However, with loci_tools I was able to do this.<br>
> > ><br>
> > > Below is my current approach to read meta data from an ND2 file. Maybe<br>
> > > someone can point out to me how to do this differently, or how to fix the<br>
> > > code I use?<br>
> ><br>
> > The best way to retrieve the stage position and timestamp data is as<br>
> > follows:<br>
> ><br>
> > %%%<br>
> > % positionIndex selects which multipoint to use (starting from 0)<br>
> > % planeIndex selects the image in the chosen multipoint (starting from 0)<br>
> > metadata = r.getMetadataStore();<br>
> > xPosition = r.getPlanePositionX(positionIndex, planeIndex);<br>
> > timestamp = r.getPlaneDeltaT(positionIndex, planeIndex);<br>
> > acquisitionStart = r.getImageAcquisitionDate(positionIndex);<br>
> > %%%<br>
> ><br>
> > 'xPosition' will be the stage position along X; the Y and Z positions<br>
> > can be retrieved using similar calls to getPlanePositionY and<br>
> > getPlanePositionZ. 'timestamp' is the time in seconds from the<br>
> > beginning of acquisition ('acquisitionStart'). See also:<br>
> ><br>
> ><br>
> > <a href="http://downloads.openmicroscopy.org/bio-formats/5.0.4/api/ome/xml/meta/MetadataRetrieve.html" target="_blank">http://downloads.openmicroscopy.org/bio-formats/5.0.4/api/ome/xml/meta/MetadataRetrieve.html</a><br>
> ><br>
> > <a href="http://www.openmicroscopy.org/Schemas/Documentation/Generated/OME-2013-06/ome_xsd.html#Plane" target="_blank">http://www.openmicroscopy.org/Schemas/Documentation/Generated/OME-2013-06/ome_xsd.html#Plane</a><br>
> ><br>
> > getGlobalMetadata and getSeriesMetadata are provided for informational<br>
> > purposes, but are not necessarily guaranteed to have the same key/value<br>
> > mappings between releases.<br>
> ><br>
> > > Also, is it possible to retrieve the PFS status of each image plane from<br>
> > an<br>
> > > ND2 file?<br>
> ><br>
> > PFS status is not included in the OME data model; from the files we<br>
> > have, it looks like the "PFS, State" and "PFS, Offset" keys in the<br>
> > global metadata table will show the state and offset. If that doesn't<br>
> > work,<br>
> > though, please let us know.<br>
> ><br>
> > Regards,<br>
> > -Melissa<br>
> ><br>
> > On Thu, Sep 04, 2014 at 06:09:16PM +0200, Enno R. Oldewurtel wrote:<br>
> > > Dear all,<br>
> > ><br>
> > > I use bioformats.jar with Matlab to read in ND2 files. Previously I used<br>
> > a<br>
> > > 5.0.0-DEV version of loci_tools.<br>
> > > With bioformats I have some problems to retrieve meta data from ND2<br>
> > files.<br>
> > > With 5.0.3 I can successfully read x,y,z position data, but with 5.0.4 I<br>
> > > get some discrepancies.<br>
> > > With both bioformat versions I fail to get the time values of each image.<br>
> > > However, with loci_tools I was able to do this.<br>
> > ><br>
> > > Below is my current approach to read meta data from an ND2 file. Maybe<br>
> > > someone can point out to me how to do this differently, or how to fix the<br>
> > > code I use?<br>
> > > Also, is it possible to retrieve the PFS status of each image plane from<br>
> > an<br>
> > > ND2 file?<br>
> > ><br>
> > ><br>
> > > I used to retrieve e.g the x-position of a specific plane from an ND2<br>
> > file<br>
> > > in the following way:<br>
> > ><br>
> > > raw=r.getGlobalMetadata();<br>
> > > x=raw.get('X position for position #00083');<br>
> > > This is for an ND2 file with 82 timepoints, 2 channels and 120<br>
> > multipoints,<br>
> > > i.e. the highest index was #09840 (for some reason I had to assume<br>
> > > 82*120*2channels as the highest index for zero padding, starting from<br>
> > > #09841 to #19680 all values are identical)<br>
> > ><br>
> > > However, with bioformats 5.0.4 this gives me the x-value of the first<br>
> > > time-point instead of the 83rd. Similarly, in another experiment with 65<br>
> > > timepoints, the string 'X position for position #00066' gives me again<br>
> > the<br>
> > > value of the first time-point instead of the 66th.<br>
> > ><br>
> > > Is this a bug in the new 5.0.4 version? I think this happened to me<br>
> > before<br>
> > > with some loci_tools version, but in a later version my approach worked<br>
> > > again. For bioformats 5.0.3 I can retrieve the mentioned x positions just<br>
> > > fine.<br>
> > ><br>
> > > I also need to retrieve the time data for each image. I used to work with<br>
> > > loci_tools (daily built from 6th September 2013) with<br>
> > > rawSeries=r.getSeriesMetadata();<br>
> > > t=rawSeries.get('timestamp #0001')<br>
> > > (less zero-padding was needed, as this time the highest index was<br>
> > > 82*120=9840, also getSeriesMetadata is used since getMetadata takes very<br>
> > > long to load)<br>
> > ><br>
> > > This worked fine, but since there were some bug fixes for ND2 files and<br>
> > > r.setID() runs significantly faster, I would like to stay with bioformats<br>
> > > instead of loci_tools.<br>
> > ><br>
> > ><br>
> > > Best regards,<br>
> > > Enno<br>
> > ><br>
> > ><br>
> > > --<br>
> > > Enno R. Oldewurtel<br>
> > > AG Prof. B. Maier / Biophysics Group<br>
> > > Biozentrum<br>
> > > Universitaet zu Koeln<br>
> > > Zuelpicher Str. 47b<br>
> > > 50674 Koeln<br>
> > ><br>
> > > <a href="mailto:enno.oldewurtel@uni-koeln.de">enno.oldewurtel@uni-koeln.de</a><br>
> > > Tel: <a href="tel:%2B49-221-470-8048" value="+492214708048">+49-221-470-8048</a><br>
> > > Fax: <a href="tel:%2B49-221-470-6230" value="+492214706230">+49-221-470-6230</a><br>
> > > <a href="http://www.biophysics.uni-koeln.de/" target="_blank">http://www.biophysics.uni-koeln.de/</a><br>
> ><br>
> > > _______________________________________________<br>
> > > ome-users mailing list<br>
> > > <a href="mailto:ome-users@lists.openmicroscopy.org.uk">ome-users@lists.openmicroscopy.org.uk</a><br>
> > > <a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users" target="_blank">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users</a><br>
> ><br>
> ><br>
><br>
><br>
> --<br>
> Enno R. Oldewurtel<br>
> AG Prof. B. Maier / Biophysics Group<br>
> Biozentrum<br>
> Universitaet zu Koeln<br>
> Zuelpicher Str. 47b<br>
> 50674 Koeln<br>
><br>
> <a href="mailto:enno.oldewurtel@uni-koeln.de">enno.oldewurtel@uni-koeln.de</a><br>
> Tel: <a href="tel:%2B49-221-470-8048" value="+492214708048">+49-221-470-8048</a><br>
> Fax: <a href="tel:%2B49-221-470-6230" value="+492214706230">+49-221-470-6230</a><br>
> <a href="http://www.biophysics.uni-koeln.de/" target="_blank">http://www.biophysics.uni-koeln.de/</a><br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Enno R. Oldewurtel<br>AG Prof. B. Maier / Biophysics Group<br>Biozentrum<br>Universitaet zu Koeln<br>Zuelpicher Str. 47b<br>50674 Koeln<br><br><a href="mailto:enno.oldewurtel@uni-koeln.de" target="_blank">enno.oldewurtel@uni-koeln.de</a><br>Tel: +49-221-470-8048<br>Fax: +49-221-470-6230<br><a href="http://www.biophysics.uni-koeln.de/" target="_blank">http://www.biophysics.uni-koeln.de/</a>
</div></div>