[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Acquiring Dental RVG on Linux



Sonali Warunjikar <sonali.warunjikar@gmail.com> writes:

> I am keeping a sample image if anyone could try and reconstruct here:
> http://mayuresh.sdfeu.org/img.dat.gz

Thanks for posting this!  It looks like raw 12-bit little-endian data,
with byte ranges alternating between [0, 255] and [0, 15]; I get
plausible results with the below patch:

--- /home/amu/tmp/convert-rvg.py.orig   2020-12-31 14:54:26.867932219 -0500
+++ /home/amu/tmp/convert-rvg.py        2020-12-31 14:48:18.744750689 -0500
@@ -3,11 +3,11 @@
 import png 
 import struct
 
-with open(flnm,'rb') as fp: buf = [ 65535 - v[0] for v in struct.iter_unpack('>H',fp.read()) ]
+with open(flnm,'rb') as fp: buf = [ 4095 - v[0] for v in struct.iter_unpack('<H',fp.read()) ]
 
 width = 1168
 height = 1562
-depth = 16
+depth = 12
 arr = [ buf[i:i+width] for r in range(height) for i in [r*width] ]
 
 with open('see.png','wb') as fp: 

-- 
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
http://www.mit.edu/~amu/ | http://stuff.mit.edu/cgi/finger/?amu@monk.mit.edu


Reply to: