Author Topic: .BIM File Format  (Read 3046 times)

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
.BIM File Format
« on: June 25, 2015, 05:26:17 PM »
If you saved images from your PFE run, the program will automatically create a .BIM file to store the pixel data in. The .BIM file will have the same name as your probe .MDB database file, just with a .BIM extension. I tried to store the pixel values in the MDB database file, but it is simply too slow.   :'(

However, the .BIM file is a simple binary stream file with the following format:

First 4 bytes:                image #1 x-dimension (pixels) as long integer
2nd 4 bytes:                  image #1 y-dimension (pixels) as long integer
Next x * y * 4 bytes:         image #1 data as long integers

Next 4 bytes:                 image #2 x-dimension (pixels) as long integer
Next 4 bytes:                 image #2 y-dimension (pixels) as long integer
Next x * y * 4 bytes:         image #2 data as long integers

etc.  The code is below for reading a specific image (e.g., "imagenum% is the image number to return).

' Calculate binary file start by counting existing image offsets
n& = 0
For i% = 1 To imagenum% - 1
n& = n& + CLng(4) * CLng(ImageIxs(i%)) * CLng(ImageIys%(i%)) + 8 ' add 8 bytes for ix and iy
Next i%
n& = n& + 1     ' first byte of old image

' Open binary image file
Open ProbeImageFile$ For Binary Access Read As #ProbeImageFileNumber%
Get #ProbeImageFileNumber%, n&, ix&
Get #ProbeImageFileNumber%, n& + 4, iy&
If ix& <> tImage.ImageIx% Then GoTo DataImageGetImageDataBadIx2
If iy& <> tImage.ImageIy% Then GoTo DataImageGetImageDataBadIy2

Get #ProbeImageFileNumber%, n& + 8, tImage.ImageData&
Close #ProbeImageFileNumber%
« Last Edit: April 19, 2016, 07:38:22 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"