Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode leica barcode #155

Closed
malaterre opened this issue Mar 19, 2015 · 8 comments
Closed

Decode leica barcode #155

malaterre opened this issue Mar 19, 2015 · 8 comments
Assignees
Milestone

Comments

@malaterre
Copy link
Contributor

@malaterre malaterre commented Mar 19, 2015

It would be nice if the barcode from leica (*.scn) would be decoded (much easier to read).

Eg:

$ tiffinfo Leica-1.scn| grep barcode
MDQwNTA2MjlD
$ echo MDQwNTA2MjlD | base64 -d
04050629C%

The following line would need to be adapted:

// Get barcode as stored in 2010/10/01 namespace
collection->barcode = _openslide_xml_xpath_get_string(ctx, "/d:scn/d:collection/d:barcode/text()");

Thanks !

@bgilbert bgilbert added the defect label Mar 20, 2015
@bgilbert bgilbert self-assigned this Mar 20, 2015
@bgilbert
Copy link
Member

@bgilbert bgilbert commented Mar 20, 2015

Argh, I hadn't realized the barcode was a Base64-encoded string. Thanks for the report.

Fixing this will break compatibility with applications using that property. The alternatives are worse (adding leica.decoded-barcode, or documenting the property as Base64-encoded), but perhaps we need to make it easier for applications to implement compatibility workarounds for particular versions of OpenSlide.

Also, update the website to document that older versions Base64-encode the property.

@malaterre
Copy link
Contributor Author

@malaterre malaterre commented Mar 20, 2015

I personnally like the leica.decoded-barcode solution, what if tomorrow a vendor start storing a barcode as QR code. It would make sense for openslide to provide both the barcode and the decoded one.

my 2cts

@bgilbert
Copy link
Member

@bgilbert bgilbert commented Mar 22, 2015

I'm not sure I understand your point. If the QR code is stored as pixels, we would expose it in the label associated image, as we do now for several formats. If the contents of the QR code are stored, we would expose them as a string or numeric property. How would a Base64-encoded property help anyone?

In any event, leica.barcode is a vendor-specific property, so we don't need to be concerned with other vendors here.

@bgilbert
Copy link
Member

@bgilbert bgilbert commented Mar 22, 2015

Also, you said:

The following line would need to be adapted:

// Get barcode as stored in 2010/10/01 namespace
collection->barcode = _openslide_xml_xpath_get_string(ctx, "/d:scn/d:collection/d:barcode/text()");

Do you have evidence that the 2010/03/10 namespace doesn't also Base64-encode the barcode?

@malaterre
Copy link
Contributor Author

@malaterre malaterre commented Mar 23, 2015

Without specifications or actual dataset I cannot answer. I simply assumed that barcode was encoded in base64 (which proved correct so far for the 2010 ns one).

@malaterre
Copy link
Contributor Author

@malaterre malaterre commented Mar 23, 2015

The terminology I used for decoded was an opaque transformation from the stored representation to a human readable representation (eg. QR code string -> QR decoded string, or base64 -> decoded string). It is very vague and mostly academic debate since it was only a (poor) example to find a solution to the leica.barcode vs leica.decoded-barcode initial issue.

@bgilbert
Copy link
Member

@bgilbert bgilbert commented Mar 24, 2015

OK, thanks for the clarifications.

@bgilbert
Copy link
Member

@bgilbert bgilbert commented Mar 29, 2015

Fixed for 2010/10/01 namespace only. The 2010/03/10 namespace puts the barcode in a different place and I don't have any evidence on whether it is also Base64-encoded, so I haven't changed how those slides are handled. If anyone has a 2010/03/10 slide with a barcode and can verify whether or not the barcode attribute is Base64-encoded, please comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.