johndmcmaster / faxitron Goto Github PK
View Code? Open in Web Editor NEWFaxitron DX-50 x-ray utilities
Faxitron DX-50 x-ray utilities
Think it isn't working correctly near edges. Also performance could be significantly improved
Observation: when bad pixel replace is enabled on a mostly white image, the resulting equalized image is basically white. I suspect this is due to a hot pixel throwing off the dynamic range, but should confirm (maybe related to the corner issue)
When I use ImageMagick's dynamic algorithm (mine is not) it produces good images though. Ex: convert 2019-12-27_23_1.png ( +clone -equalize ) -average 2019-12-27_23_1_ei.png
Also consider switching to ImageMagick entirely if it produces nicer images in general
Above: no BPR, faxitron equalization
Above: no BPR, ImageMagick equalization
Hi John,
While I have been working on reversing the USB comms for a while on my MX-20 with DC12 sensor, came across your work. Am impressed how far you've already got! Besides the easily fixable deprecated numpy issues, it all works except serial comms doesn't want to turn on the tube. I checked my code and it's the same sequence !B
-> X
then C
-> P
. Need to check what is going on with that, but just wanted to say Thanks :)
p.s.: if you need any pcap dumps or something else to develop the code further, let me know.
When a sample is really thick, it signal becomes small and the workflow relies on the relatively high bit depth (native 14, averaged to 16) + histogram equalization to get decent images. However, its currently limited by, after averaging, the data is truncated to 16 bit during histogram equalization. To get the full sensor range, need to calibrate the sensor to higher precision. This may require hacks to get additional bits on image data, such as shifting up and/or creating a second image file with LSB
As of 1.20, Numpy deprecated np.float
, and in 1.24, Numpy dropped it entirely. Attempting to fix the problem with s/np.float/float/
resolves that problem, but then the normed
parameter is not a part of np.histogram
. Cutting the normed
parameter out of the call to histogram
then restores functionality.
As a temporary workaround, pip install "numpy<1.24"
can downgrade the Numpy installation to the last compatible version.
use os path join instead of /
Performance optimization
Looks like there is serial number, model, and firmware version. Parse these out and display them somewhere.
give a high level suggested workflow
I quickly looked at the USB bulk transfer protocol and made a quick guess as to where the image vs metadata is. It seems to work for me so I decided it was good enough. However, Alexander Hude
is doing some early testing and can't use it reliably as is. Specifically I think an assertion failed reporting more data than we expect
The current code is very basic:
pack2 = bulkRead(0x82, 0x4000)
assert len(pack2) == 2, len(pack2)
hexdump(pack2)
buff = bytearray()
while True:
pack = bulkRead(0x82, 0x4000)
if len(pack) == 6:
return pack2, buff
else:
buff += pack
And then I truncate the resulting buffer, taking off the last two bytes. The very first packet might have the number of packets or something of that sort.
I've managed to obtain a DX-50 with the DC3 option (Hamamatsu C9266-03).
USB VID: 0x0661
USB PID: 0x3400
dmesg output:
[440265.698953] usb 1-2.4: New USB device found, idVendor=0661, idProduct=3400, bcdDevice= 0.00
[440265.698955] usb 1-2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[440265.698957] usb 1-2.4: Product: HPK C9266-03
[440265.698958] usb 1-2.4: Manufacturer: HPK
Since it's not a DC5 or DC12, dump.py fails with the following:
Writing to dump/2021-07-14_03
Sensor
Traceback (most recent call last):
File "dump.py", line 68, in <module>
main()
File "dump.py", line 38, in main
h = ham.Hamamatsu(init=False)
File "/home/arthur/PiSync/faxitron/faxitron/ham.py", line 754, in __init__
self.dev = open_dev(self.usbcontext)
File "/home/arthur/PiSync/faxitron/faxitron/ham.py", line 743, in open_dev
raise Exception("Failed to find a device")
Exception: Failed to find a device
What changes are needed to add DC3 support? Is it just a matter of adding the USB PIDs to ham.py?
Submit multiple URB in parallel. Ham software submits 31 in parallel
should use dynamic temp file instead of hard code to avoid multiprocess issues
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.