Page 1 of 1

Leica File - Missing Tag

PostPosted: Mon Dec 10, 2012 9:26 am
by flo
Hi
I'm not sure if this is the right forum or if I should have posted it in the "Bio-Formats" forum (mods please feel free to move this thread).

We are using the OMERO (4.4.5) platform to manage our data. When we upload Leica files (*.lif) all metadata are displayed in the corresponding window, except the <User-Comment> tag. Since we use this tag to describe our experiment it would be great to see this data too. I'm not sure if this is a bio-format or OMERO "problem". Could you please give me a hint how-to / where-to fix it?

Thanks
Flo

Re: Leica File - Missing Tag

PostPosted: Mon Dec 10, 2012 11:25 am
by rleigh
Hi FLo,

Could you possibly upload an example file containing this metadata so that we can take a closer look at the problem? You can do this here: http://qa.openmicroscopy.org.uk/qa/upload/

Thanks,
Roger Leigh

Re: Leica File - Missing Tag

PostPosted: Wed Dec 12, 2012 10:20 am
by flo
Hi Roger,

I'm sorry for the delay in my reply.
I uploaded a test file. The ID is 4791.

Thanks,
Flo

Re: Leica File - Missing Tag

PostPosted: Wed Dec 12, 2012 10:56 am
by rleigh
Thanks, I've got the image and taken a look at it. It looks like this tag is indeed missing, probably because we're not reading it or storing it. I'll open a ticket for this issue on our bug tracker. Could you possibly let me know what you set the comment to on this image? It will help find it in the data in case it's not obvious.

Thanks,
Roger

Re: Leica File - Missing Tag

PostPosted: Wed Dec 12, 2012 2:46 pm
by flo
Thanks Roger!

The text is

test test test
entry entry entry
test test test

Re: Leica File - Missing Tag

PostPosted: Thu Dec 13, 2012 11:26 am
by rleigh
This is now fixed, pending testing and review here:

https://github.com/openmicroscopy/bioformats/pull/305

Re: Leica File - Missing Tag

PostPosted: Mon Jan 14, 2013 9:02 am
by flo
I am sorry for replying late.
Thank you for the quick fix!

Re: Leica File - Missing Tag

PostPosted: Tue Feb 05, 2013 8:08 am
by flo
Hi,

I don't know if it is a general problem or a Leica <User-Comment> metadata file problem. Since I think it is a Leica file problem I didn't open a new topic.

I upload a Leica file containing a <User-Comment> tag with multiple lines. When I try to export the <User-Comment> tag with an Omero script (.loadOriginalMetadata()) it only exports the first line of the tag, though when I download the metadata file (e.g. Omero.insight) everything is shown.

Could somebody please help me?

Thanks.

Re: Leica File - Missing Tag

PostPosted: Tue Feb 05, 2013 1:06 pm
by wmoore
Hi,

Assuming the file you've downloaded has

User-Comment[0]=Test test test test
Entry entry entry
Test test test test

you're doing something like this:

Code: Select all
image = conn.getObject("Image", imageId)
om = image.loadOriginalMetadata()
for keyValue in om[2]:
    if len(keyValue) > 1:
        print keyValue[0], keyValue[1]


you're losing the 2nd and 3rd lines because they will be keyValue tuples of one item: len(keyValue) == 1.

You'll need to look for these and append them to the previous comment:

Code: Select all
comments = []
for keyValue in om[2]:
    if len(keyValue) == 2:
        if keyValue[0].startswith("User-Comment"):
            comments.append(keyValue[1])
    else:
        line = "=".join(keyValue)        # in case line contained '='
        if (len(comments) > 0):
            comments[-1] = "%s\n%s" % (comments[-1], line)

for c in comments:
    print c


This should work, but it makes a couple of assumptions that may not be correct:
- None of your additional lines of comments have 1 '=' character in them
- No other Key-Value pairs are multi-line

Hope that helps,

Will.