How to extract bitmap images from .slide file generated by a CytoVision Platform
1
0
Entering edit mode
3.5 years ago
gcocce • 0

I need help to extract images from a file ( .slide ) generated by a cytovision platform. This file contains several images from a medula sample.

I am currently experimenting with convolutional neural networks to classify images and I would like to work with these images to classify them into two categories whether there is a metaphase in the imager or not.

Each .slide file seems to contain several images of 16kb. If we explore the file with FileAlyzer we can see this:

If we see the entire file as a bitmap

If we look at the hex content

In the hex content view we see what it seems to be the image header and the start of the image data.

If we select the image data and create a file then we can see the file in FileAlyzer like this:

Bitmap of image data as a file

I need help to extract original images and save them to a separates files. I don't know the format (tiff, bmp, jpeg) they have and I don't know which data I should use to write the images headers if possible.

This is the hex content we can find at the beginning of the file it includes, file header, and the first image header and a little portion of this image data:

07 01 00 00 70 72 75 65 62 61 31 30 2D 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70 72 75 65 62 61 31 30 2D 34 5F 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 07 00 00 00 09 53 49 4E 20 43 55 42 52 45 01 00 00 00 00 6A BF 46 00 EA CE 46 00 C0 A2 44 00 65 6C 47 00 00 00 00 00 00 00 00 01 00 00 00 01 01 01 00 00 00 0B 53 63 61 6E 20 41 72 65 61 20 31 15 01 00 00 0B 53 63 61 6E 20 41 72 65 61 20 31 00 01 00 00 0A 00 00 00 01 01 03 42 4D 31 00 00 03 47 53 4C 00 01 00 00 00 00 00 00 00 00 00 00 E0 1D 52 C0 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 01 50 00 00 00 90 01 00 00 03 00 00 00 0B 01 00 00 00 00 00 00 00 00 00 00 F2 03 00 00 82 59 00 00 E5 55 00 00 7C B8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F0 3F 00 00 00 00 00 00 F0 3F 00 00 00 00 00 00 24 40 00 00 00 00 00 00 59 40 0B 4D 65 64 75 6C 61 20 4F 73 65 61 00 00 00 00 00 00 00 00 70 72 75 65 62 61 31 30 2D 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70 72 75 65 62 61 31 30 2D 34 5F 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BC 01 00 00 07 01 00 00 A0 AA 83 44 A9 BD 40 47 80 DD 81 C3 00 00 00 00 00 00 00 00 5D 00 00 00 4E 00 00 00 5D 00 00 00 4E 00 00 00 80 00 00 00 80 00 00 00 AC 1C 5A 64 3B DF E7 3F AC 1C 5A 64 3B DF E7 3F 00 00 00 00 00 00 00 00 00 40 00 00 01 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF 05 41 32 36 2F 32 07 01 00 00 11 00 00 00 03 42 4D 31 00 00 00 00 00 40 8F 40 05 00 9E 5F 98 D7 47 60 A1 40 01 04 4D 65 74 31 00 00 00 00 00 40 8F 40 05 00 64 31 2E 29 B5 46 DC 40 01 04 4D 65 74 32 00 00 00 00 00 40 8F 40 05 00 87 7D 26 70 88 C0 C5 40 01 04 4D 65 74 33 00 00 00 00 00 40 8F 40 05 00 C8 97 53 05 BB 0D 0F 41 01 04 54 65 78 31 00 00 00 00 00 00 D0 40 05 00 00 00 00 00 00 40 5C 40 07 04 54 65 78 32 00 00 00 00 00 00 D0 40 05 00 00 00 00 00 00 00 44 40 07 04 54 65 78 33 00 00 00 00 00 00 D0 40 05 00 00 00 00 00 00 90 76 40 07 04 54 65 78 34 00 00 00 00 00 00 D0 40 05 00 00 00 00 00 00 F4 CD 40 07 0A 43 68 72 6F 6D 73 41 72 65 61 00 00 00 00 00 4C BD 40 05 00 F3 76 84 D3 82 85 74 40 07 08 42 6F 75 6E 64 61 72 79 00 00 00 00 00 88 B3 40 05 00 D9 CE F7 53 E3 AD 7E 40 07 04 41 72 65 61 00 00 00 00 00 88 B3 40 05 00 20 EF 55 2B 13 0B 85 40 07 07 4F 62 6A 65 63 74 73 00 00 00 00 00 00 69 40 05 00 00 00 00 00 00 00 18 40 03 04 43 69 72 63 00 00 00 00 00 40 8F 40 05 00 9D E5 51 0E 5C 34 65 40 03 03 42 47 52 00 00 00 00 00 40 8F 40 05 00 7D 0C CE C7 E0 AC 86 40 03 04 54 65 78 35 00 00 00 00 00 00 D0 40 05 00 00 00 00 00 00 00 53 40 07 04 41 52 41 54 00 00 00 00 00 40 8F 40 05 00 86 89 F7 23 A7 79 7E 40 07 05 43 6C 61 73 73 00 00 00 00 00 00 F0 3F 05 00 00 00 00 00 00 00 F0 BF 00 01 00 00 00 01 00 00 00 00 40 00 00 3D 3B 3E 43 44 41 3E 3F 41 45 40 41 3F 41 3E 3D 42 3E 3E 3B 39 3C 40 3F 41 42 3B 41 40 3F 41 3E 41 41 42 3E 43 44 3F 39 40 3F 3E 3E 3E 40 41 41 3C 3E 41 39 40 40 40 41 38 3D 3C 3F 3A 3C 40 41 39 3C 3B 3F 3E 44 3F 40 41 46 44 43 41 3B 3C 39 3B 3E 42 3F 3F 3C 3E 3E 41 3C 3D 3C 40 3C 3B 3E 39 3D 34 3F 3B 3E 41 3D 40 3E 3F 3A 38 39 3E 36 35 37 36 39 3D 3B 41 37 37 39 3C 37 36 39 35 3D 43 3C 43 49 4D 48 48 41 3F 41 3F 40 40 3E 3C 3E 41 40 41 41 3F 3D 3F 42 3D 3B 3D 3D 41 3C 3F 3F 42 44 43 41 3D 46 3E 44 3D 3D 3B 3B 3C 3B 3F 3E 3D 3C 40 3E 3B 3D 40 3D 48 38 3D 42 41 40 41 3B 3B 42 3E 3D 39 3D 43 46 42 41 40 42 3B 38 36 3C 3D 3F 3B 3B 3C 38 3B 3E 41 3F 3F 3E 41 3F 3E 3E 3F 41 40 3C 3D 3B 38 39 38 3E 3D 3B 34 3C 3C 36 3B 37 3A 39 3E 42 3B 37 3B 3B 3A 3F 36 3A 3C 3B 42 43 40 47 49 47 47 41 3F 3C 3E 44 42 3E 42 3B 3D 40 40 3B 43 42 42 3D 41 41 3F 40 44 3E 3E 3E 43 3E 41 3D 3F 44 3E 3F 39 3E 42 3F 3F 3D 40 3F 43 3E 3F 3E 3F 3D 3C 39 3E 3E 3E 47 3E 3C 3C 37 3E 38 41 43 41 46 3F 44 41 41 3C 3E 40 41 39 3D 3C 3D 41 3B 3E 3B 43 40 3A 41 3E 41 42 3B 3D 3F 3C 3C 3D 3D 39 3E 3C 36 3C 3B 3E 3B 38 39 37 36 3E 37 39 32 3B 36 38 3D 3F 39 38 35 36 37 3B 38 3E 44 42 3F 40 45 48 41 3F 3F 3E 3C 3E 44 43 3D 3E 40 41 42 44 43 3F 43 41 44 44 3B 40 3F 3C 41 43 40 3F 3D 3E 3D 41 41 3F 43 3E 41 3B 3C 3E 43 3F 3F 3B 3D 3C 41 3E 42 3C 41 3F 44 44 43 42 38 3F 3F 42 46 44 44 44 42 3E 41 41 3D 3D 3C 3B 3F 3C 3A 3B 3C 38 3C 3C 38 3F 3B 38 40 43 3F 3F 3A 3C 41 3F 3A 3F 3E 39 3B 3E 39 3D 38 3C 3D 3C 3F 42 39 38 3D 37 36 3D 39 39 3A 38 38 37 33 37 33 41 44 46 40 44 41 3E 3C 42 40 3D 3F 40 41 3D 46 3C 3B 40 41 3F 3F 41 40 3B 3C 41 41 44 41 3F 3F 3E 3F 3B 3D 44 41 44 41 41 41 3E 3F 40 40 45 42 49 41 43 44 43 41 42 3F 3C 3B 3E 42 41 41 3B 40 37 41 41 42 4F 4A 43 43 42 44 3F 3E 3C 3F 3C 3D 3D 42 41 3F 3B 3C 3D 3D 3B 3B 3D 3F 37 3C 3F 3B 3D 3B 3E 40 3B 3E 3F 3D 3C 3B 3A 36 3C 43 3D 3A 39 39 37 36 34 36 33 37 39 39 3A 34 39 33 39 38 3F 41 43 3F 3E 41 41 43 47 46 3F 43 3F 3D 42 42 41 3E 3F 3E 42 3E 3F 44 42 3E 43 42 41 44 43 41 41 3F 3F 43 44 44 3F 42 42 42 3C 3C 41 41 43 46 42 40 43 3F 42 44 41 41 42 3D 3D 43 3D 3C 3C 3E 3D 41 41 4F 4D 4C 43 3F 3C 40 38 3E 43 3E 3F 3E 38 3F 43 3C 3C 3B 40 40 3F 3F 37 39 3F 3C 3B 3E 41 3F 40 3C 3F 3E 3D 3C 38 36 39 37 39 3A 3B 36 39 35 34 37 3C 3D 3E 35 36 37 37 37 36 36 35 30 3D 41 41 43 3B 44 3F 42 41 44 3E 42 43 42 3F 3D 3B 3C 3E 44 42 3F 45 48 43 45 40 43 41 40 3D 3D 3F 41 43 47 45 41 3E 40 3E 40 3E 3F 41 4F 4D 46 3E 3F 41 44 3F

If we look at it as ANSI text we found:

 prueba10-4 prueba10-4_2 **** SIN CUBRE j? ? "D elG   Scan Area 1 Scan Area 1 
BM1 GSL  ?  P ?   ??Ù ? |? ?? ?? $@ Y@ Medula Osea prueba10-4 prueba10-4_2 ?  *A?@G]? ] N ] N ?Zd;???Zd;?? @  ????A26/2  BM1 @? ??G?Met1 @? d1.)??Met2 @? ?&p?bMet3 @? ?S?ATex1 ? @\@Tex2 ? D@Tex3 ? ?@Tex4 ? ?? ChromsArea L? ???t@Boundary ?@ ???~@Area ?@ ? bObjects i@ @Circ @? ?Q\4e@BGR @? } ??@Tex5 ? S@ARAT @? Ð??~@Class ?? ??  @ =;>CDA>?AE@A?A>=B>>;9<@?AB;A@?A>AAB>CD?9@?>>>@AA<>A9@@@A8=D?@AFDCA;<9;>B??<>>A<=<@<;>9=4?;>A=@>?:89>65769=;A779<7695=C<cimhha?a?@@&gt;&lt;&gt;a@aa?=?b=;==a<??bdca=f>D==;;<;?>=<@>;=@=H8=BA@A;;B>=9=CFBA@B;86<=?;;<8;>A??>A?>>?A@<=;898>=;4<<6;7:9>B;7;;:?6:<;BC@GIGGA?<>DB>B;=@@;CBB=AA?@D>>>C>A=?D>?9>B??=@?C>?>?=<9>>>G><<7>8ACAF?DAA<>@A9=<=A;>;C@:A>AB;=?<<==9><6<;>;8976>792;68=?98567;8>DB?@EHA??><>DC=>@ABDC?CADD;@?<ac@?=&gt;=aa?c>A;<>C??;=B<a?dd< p=""> slide image cytogenetic bitmap • 1.3k views ADD COMMENT 0 Entering edit mode 3.5 years ago Looks like it might be DIB or BMP, from the header. If you know which byte this image starts within the slide file (the offset) at and how many bytes you need to get the image (the length), you could run something like this to extract the BMP file: $ offset=1234
$length=98765$ dd bs=1 skip=${offset} count=${length} if=input.slide of=output.bmp


You'd replace offset and length with desired values.

To get the offset, you might run a Python script to find the header:

#!/usr/bin/env python
import sys
import bitstring
stream = bitstring.ConstBitStream(filename='input.slide')
found = stream.find('0x424d', bytealigned=True)
if found:
sys.stdout.write("the first 0x424d byte offset is at [%d]\n" % (found[0]))


This assumes there isn't a pair of bytes within the slide's own header that would match, which would result in a false offset. If there is any documentation about the slide header format, that would probably be useful for reliably getting the correct offset.

If you know your image is always 16kb in size, for example, then that would be a length of 16*1024, or 16384.

Once you have a BMP file, you could use ImageMagick convert` to change it into other formats, like PNG or GIF, etc. or whatever format you need for downstream classification work.

Looks like you might be running Windows. All this stuff would work on Linux or OS X platforms, but I don't know much about PowerShell. You might run Cygwin or an instance of Linux in Virtualbox to do this work.