reading Nanotec WSxM binary files

Can anyone give me advice on loading into Igor layered binary files created by Nanotec's AFM? The only way I seem to be able to read them is with Nanotec's software WSxM, but I want a way to load them directly into Igor.

Generally, I don't see many ways to load a binary image into Igor; I see a way to load a XY dataset as a matrix, or a general binary file as a 1D wave, but that's it.

I attached a binary file for reference, it has two images in it (note I added '.txt' so I could upload it). Information on the file format, apparently, is here:

http://www.nanotec.es/products/wsxm/file_structure.php

Thanks,

MJ Matthews
pristine.txt
I think I may have gotten a good part of the way there...

I opened your file in a text editor and noted that there is *LOTS* of ascii header information. I copied that header info, pasted it into a new file and saved it. There are 11220 bytes in the file, so my first guess at the header size is 11220. I used this command to load the binary part of the file into a wave:

GBLoadWave/T={80,4}/S=11220/W=1/B=1 "Macintosh HD:Users:johnweeks:Downloads:pristine.txt"

/T says to load 16-bit unsigned integers from the file. It is possible that it should be unsigned.
/S tells GBLoadWave to skip 11220 bytes at the start.
/W says there is just one array in the file
/B tells GBLoadWave that the file is in Intel byte order.

The result was a wave with reasonable-looking numbers and a bunch of zeroes at the start. I edited the zeroes out, and got a number of data points that is exactly the square of 512! So then I did this:
redimension/N=(512,512) wave0

to make the wave into a 512x512 matrix. The resulting image is attached in PNG format.

You could probably write a procedure using Open and FReadLine to read information from the ascii header.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
OK- it looks better if you load it as signed 16-bit integers:
GBLoadWave/T={16,4}/S=11220/W=1/B=1 "Macintosh HD:Users:johnweeks:Downloads:pristine.txt"

I also forgot to mention that the file path is, of course, unique to my machine... You don't have to type this in- I generated the command from the dialog you get when you choose Data->Load Waves->Load General Binary File.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com