on.SIMcheck.1.1.source-code.dump_lut.py Maven / Gradle / Ivy
#!/usr/bin/env python
# dump an ImageJ binary LUT file as comma-separated
# LUT values
import sys
import struct
if len(sys.argv) != 2:
print "Usage: dump_lut.py some_lut.lut"
with open(sys.argv[1], "rb") as f:
sys.stdout.write("# RED\n")
byte = f.read(1)
nbytes = 0
while byte != b"":
# Do stuff with byte.
sys.stdout.write(str(struct.unpack('