Extracting bar code label and overview image from MRXS slide
Benjamin Gilbert
bgilbert at cs.cmu.edu
Thu Jul 31 23:57:43 EDT 2014
On 07/31/2014 09:33 AM, Tom N. wrote:
> I explored my MRXS slides and found 3 associated gray scale images
> embedded (they are called "label", "macro" and "thumbnail") and could
> extract them to JPG format with vips --associated. These images are
> exactly the same as I could extract them using the manufacturer's
> viewer. However, the one extracted using vips is slightly red and not
> gray as the one extracted using Windows based program from the
> manufacturer. See attached comparison of one example.
Hi Tom,
Label images in MIRAX slides have historically been grayscale images
stored as RGB JPEGs. It seems your newer scanner is recording the label
image in color.
The difference between your label_ORIGINAL and label_VIPS samples is
that the red and blue channels are swapped. Since OpenSlide doesn't do
anything special with the color channels during JPEG decoding, and since
the label has traditionally been grayscale, I wonder if this is actually
a bug in the vendor's software.
Here's what you can do to check:
1. Grab the parse-mirax script from the OpenSlide repository:
https://raw.githubusercontent.com/openslide/openslide/master/misc/parse-mirax.py
2. Run it on your slide file:
python parse-mirax.py CMU-1.mrxs
It will produce lots of output, including the location of the label image:
label:
Nonhier record: 3
File: Data0003.dat
Position: 296
Length: 56490
Format: JPEG
3. Extract the label image using this information, e.g.:
dd if=CMU-1/Data0003.dat bs=1 skip=296 count=56490 of=label.jpg
4. Compare label.jpg to your two sample images. If it matches
label_ORIGINAL, we have an OpenSlide or VIPS bug. If it matches
label_VIPS, there's a bug (or at least a "creative interpretation") in
the vendor's viewer. In that case, we might choose to be bug-compatible
with the vendor if there's a good reason to do so.
It's possible that the vendor's viewer is intentionally channel-swapping
because the scanner software is also channel-swapping. If you feel
extra-motivated, you could scan a slide with some red or blue ink on the
label and see which interpretation is true to life.
Please let us know what you find. Is this discrepancy causing you
problems, or is it just something you happened to notice?
--Benjamin Gilbert
More information about the openslide-users
mailing list