I found the byte swap in in dec2image to take a very long time. You might consider this implementation:
def dec2image( data, h, w ):
dt = np.dtype('uint16')
dt = dt.newbyteorder('<')
img = np.frombuffer(data, dtype=dt)
img = np.reshape( img, (h, w) )
return img