Decode leica barcode #155

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

Comments

Projects
None yet
2 participants
@malaterre
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@bgilbert

bgilbert Mar 20, 2015

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@malaterre

malaterre Mar 20, 2015

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@bgilbert

bgilbert Mar 22, 2015

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@bgilbert

bgilbert Mar 22, 2015

Member

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?

Member

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

This comment has been minimized.

Show comment
Hide comment
@malaterre

malaterre Mar 23, 2015

Contributor

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).

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@malaterre

malaterre Mar 23, 2015

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@bgilbert

bgilbert Mar 24, 2015

Member

OK, thanks for the clarifications.

Member

bgilbert commented Mar 24, 2015

OK, thanks for the clarifications.

@bgilbert

This comment has been minimized.

Show comment
Hide comment
@bgilbert

bgilbert Mar 29, 2015

Member

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.

Member

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