Image Analysis Demo

Analysis Tools

Analysis Window

Python Code Example

Code to make a raw.txt file. Requires valid image variable (a 2D numpy array).
retdata = ''
wid = image.shape[1]
hei = image.shape[0]
bzero = image.min()
bscale = (image.max()-image.min())/(2.**16-1)
if bscale == 0:
    bscale = 1.0
retdata += "width = %d\n" % wid
retdata += "height = %d\n" % hei
retdata += "bzero = %e\n" % bzero
retdata += "bscale = %e\n" % bscale
retdata += "message = %s\n" % message
retdata += "encoding = %s\n" % "UInt16"
imgdata = ''
image = image.copy()
image.shape = wid*hei
image = (image-bzero)/bscale
image = numpy.array(numpy.round(image), dtype = numpy.uint16)
for i in range(wid*hei):
    imgdata += '%4X' % image[i]
retdata += "data = %s" % imgdata
outf=file('raw.txt','wt')
outf.write(retdata)
outf.close()