Giter Site home page Giter Site logo

gxs700's Introduction

Open source Gendex GXS700 / Dexis Platinum USB x-ray sensor driver

Installation (python3)

Instructions for Ubuntu 16.04

sudo apt-get install -y git python3-pip python3-numpy fxload
sudo pip3 install libusb1 scipy
# Optional for WPS7 x-ray head support
# Not needed by the vast majority of users
sudo pip3 install pycurl
git clone https://github.com/JohnDMcMaster/gxs700.git
cd gxs700
sudo ./udev.sh
sudo python3 setup.py install

Now plug in your sensor

TODO: add info about optional fxload. TLDR wanted Windows support so didn't fully move to it

Installation (python2)

Alternatively if you have python2 you might get away with running an old release:

sudo pip install gxs700

I'll cut a new pip release after the py3 code stabalizes

Test

See if basic communications can be established:

gxs700-dump-dev

Now take a dark frame:

gxs700-main --force-trig

You should get files in directory "out". Sample output:

$ gxs700-main --force-trig
Preparing capture
Init state: 1
Init state: 1
Forcing trigger
New state 2 (scan 0)
scan 0 (state 2)
New state 4 (scan 571)
scan 1000 (state 4)
scan 2000 (state 4)
scan 3000 (state 4)
scan 4000 (state 4)
New state 8 (scan 4628)
Ready (state 8)
Transfer frame in 1.4 sec
Frame captured in 4.1 sec
Decoding image...
Writing out/2020-10-10_08/cap_00.png...
Saving meta...
Reading out/2020-10-10_08 w/ 1 images
Processing out/2020-10-10_08
Avg min: 0, max: 6416
WARNING: default calibration dir cal/130631221 does not exist
Invert min: 59119, max: 65535
Save out/2020-10-10_08.png
Eq mode (GXS700_EQ_MODE) 0
Save out/2020-10-10_08_e.png
Eq min: 1, max: 65535
done

If you have a working x-ray source, run the following and then light it up with x-rays:

gxs700-main

Assuming your x-ray source is intense enough, it should trigger a capture.

See also

Hardware info here: https://nucwiki.org/wiki/index.php/Gendex_GXS700

There is some more software info here: https://nucwiki.org/wiki/index.php/GXS700_FOSS

Although its a bit out of date

gxs700's People

Contributors

johndmcmaster avatar natsfr avatar pvachon avatar spirit532 avatar stdlogicvector avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gxs700's Issues

Connects in windows, issues during capture after "Ready"

Setup: Windows 10, Asus Laptop
Environment: Pycharm 2023 1.2, Python3, all python dependencies installed, specifically 'libusb' 1.0.27 and 'libusb1' 3.1.0
Windows Driver: Using 'Zadig' set Driver to WinUSB (v6.1.7600.16385), also attempted libusb-win32(v1.2.7.3) and libusbK(v3.1.0.0)
Dongle: Its the ebay $70 black dexis.

Running Dump-dev runs great and returns the following,

"C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\Scripts\python.exe" "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\dump_dev.py" 
Waiting for device to come up


Found device (post-FW): Gendex GXS700LG (post enumeration)
Bus 001 Device 010: ID 5328:2030
Up after 1.8 sec
Init state: 1
S/N (flash): 103831081
S/N (EEPROM): None
WARNING: S/N mismatch
  S/N guess: black Dexis (size 2)
Writing to dump/103831081

Versions
MCU:     0.5.10
FPGA:    0.3.6
FGPA WG: 0.4.5

FPGA signature: 0x1234
State: 1
Error: 0
Trigger params: b'000301f4'
Int time: 700
Img ctr: b'7e00000017000000'
Sensor dimensions: 1344w x 1850h

Dumping RAM
Dumping EEPROM
Dumping flash
Dumping register space

Process finished with exit code 0

Problem lies with capturing, constantly getting libusb issues. Printout of main.py with arg --force-trig below,

"C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\Scripts\python.exe" "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\main.py" --force-trig 
Preparing capture
Waiting for device to come up


Found device (post-FW): Gendex GXS700LG (post enumeration)
Bus 001 Device 012: ID 5328:2030
Up after 1.8 sec
Init state: 1
Init state: 1
Forcing trigger
New state 2 (scan 0)
scan 0 (state 2)
New state 4 (scan 574)
scan 1000 (state 4)
scan 2000 (state 4)
scan 3000 (state 4)
Traceback (most recent call last):
  File "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\main.py", line 95, in <module>
    main()
  File "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\main.py", line 68, in main
    raw_main.run(
  File "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\gxs700\raw_main.py", line 63, in run
    gxs.cap_binv(imgn, cb, force_trig=force_trig, xr=xr)
  File "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\gxs700\usbint.py", line 877, in cap_binv
    imgb = self._cap_bin(scan_cb=scan_cb, force_trig=force_trig, xr=xr)
  File "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\gxs700\usbint.py", line 856, in _cap_bin
    return self._cap_frame()
  File "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\gxs700\usbint.py", line 746, in _cap_frame
    ret = self._cap_frame_bulk()
  File "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\gxs700\usbint.py", line 781, in _cap_frame_bulk
    trans.submit()
  File "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\lib\site-packages\usb1\__init__.py", line 747, in submit
    raiseUSBError(result)
  File "C:\Users\Owner\Documents\PyCharmProjects\GSX700 XRAY Imager\lib\site-packages\usb1\__init__.py", line 119, in raiseUSBError
    raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
usb1.USBErrorNotFound: LIBUSB_ERROR_NOT_FOUND [-5]
New state 8 (scan 3778)
Ready (state 8)

Process finished with exit code 1

Remove pycurl dependency?

WPS support caused this to be imported, but evidently its not on Ubuntu by default. Consider making it optional or at least add to instructions to install it

Investigate normed=True warning

/usr/local/lib/python3.5/dist-packages/gxs700-2.0.0-py3.5.egg/gxs700/im_util.py:122: VisibleDeprecationWarning: Passing normed=True on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.

Unexpected Buffersize on small Sensor

I have a Size 1 (small) GXS-700) which returns an unexpected buffer size when trying to force-capture an image (haven't tried auto triggering). The returned size varies (e.g. 11426325, 11392746, 11426492, 11380779, ...).

Here is the dump info:

Waiting for device to come up


Found device (post-FW): Gendex GXS700SM (post enumeration)
Bus 002 Device 005: ID 5328:2020
Up after 1.9 sec
Init state: 1
S/N (flash): 1093330312
S/N (EEPROM): 1093330312
  S/N guess: blue Gendex (size 1)
Writing to dump/1093330312

Versions
MCU:     0.5.10
FPGA:    0.4.4
FGPA WG: 0.4.5

FPGA signature: 0x1234
State: 1
Error: 0
Trigger params: b'000301f4'
Int time: 700
Img ctr: b'5000000050000000'
Sensor dimensions: 1040w x 1552h

Dumping RAM
Dumping EEPROM
Dumping flash
Dumping register space

And here is the output from the capture:

Preparing capture
Init state: 1
Init state: 1
Forcing trigger
New state 2 (scan 0)
scan 0 (state 2)
New state 4 (scan 836)
Ready (state 4)
Traceback (most recent call last):
  File "/home/konstantin/Code/Python/xray/gxs700/main.py", line 78, in <module>
    main()
  File "/home/konstantin/Code/Python/xray/gxs700/main.py", line 55, in main
    raw_main.run(
  File "/home/konstantin/Code/Python/xray/gxs700/gxs700/raw_main.py", line 63, in run
    gxs.cap_binv(imgn, cb, force_trig=force_trig, xr=xr)
  File "/home/konstantin/Code/Python/xray/gxs700/gxs700/usbint.py", line 877, in cap_binv
    imgb = self._cap_bin(scan_cb=scan_cb, force_trig=force_trig, xr=xr)
  File "/home/konstantin/Code/Python/xray/gxs700/gxs700/usbint.py", line 856, in _cap_bin
    return self._cap_frame()
  File "/home/konstantin/Code/Python/xray/gxs700/gxs700/usbint.py", line 743, in _cap_frame
    ret = self._cap_frame_inter()
  File "/home/konstantin/Code/Python/xray/gxs700/gxs700/usbint.py", line 812, in _cap_frame_inter
    raise Exception("Unexpected buffer size. Want %d, got %d" %
Exception: Unexpected buffer size. Want 3228160, got 11436827

I also tried capturing an image under windows with original driver and VixWin. The testimage generator returns an image, but autoexposure crashes the program. Here is the log output:

[3/12/2021 21:39:36] *************************************: 0
[3/12/2021 21:39:36] GXS-700 Driver Initialization Success: 0
[3/12/2021 21:39:36] Number of GXS-700 Sensors Found: 1
[3/12/2021 21:39:36] Found Sensor-(SN): 1093330312
[3/12/2021 21:39:36] Number of GXS-700 Sensors Found: 1
[3/12/2021 21:39:37] Sensor Armed Successfully: 1093330312
[3/12/2021 21:39:37] Number of GXS-700 Sensors Armed: 1
[3/12/2021 21:39:37] GXS-700 Sensor Armed: 1093330312
[3/12/2021 21:39:48] Simulation Mode Turned On: 0
[3/12/2021 21:39:49] Number of GXS-700 Sensors Armed: 1
[3/12/2021 21:39:49] GXS-700 Sensor Armed: 1093330312
[3/12/2021 21:39:50] GXS-700 Sensor X-Ray Detected: 0
[3/12/2021 21:39:50] Watchdog Timer Started: 0
[3/12/2021 21:39:50] Image Ready Message Received From SN: 0
[3/12/2021 21:39:50] Sensor Armed Successfully: 0
[3/12/2021 21:39:50] Successfully Received 16-bit Image: 0
[3/12/2021 21:39:50] GXS-700 Sensor Image Transfer Done: 0
[3/12/2021 21:39:50] Watchdog Timer Stopped: 0
[3/12/2021 21:39:50] Sensor Disarmed: 0
[3/12/2021 21:39:50] Simulation Mode Turned Off: 0
[3/12/2021 21:39:50] Number of GXS-700 Sensors Found: 1
[3/12/2021 21:39:50] Found Sensor-(SN): 1093330312
[3/12/2021 21:39:51] Number of GXS-700 Sensors Found: 1
[3/12/2021 21:39:51] Sensor Armed Successfully: 1093330312
[3/12/2021 21:39:51] Number of GXS-700 Sensors Armed: 1
[3/12/2021 21:39:51] GXS-700 Sensor Armed: 0
[3/12/2021 21:39:51] GXS-700 Sensor Unarmed: 0
[3/12/2021 21:39:51] Number of GXS-700 Sensors Armed: 1
[3/12/2021 21:39:51] GXS-700 Sensor Armed: 0
[3/12/2021 21:42:58] GXS-700 Sensor X-Ray Detected: 1093330312
[3/12/2021 21:42:58] Watchdog Timer Started: 0
[3/12/2021 21:42:59] Image Ready Message Received From SN: 1093330312
[3/12/2021 21:42:59] Failed To Receive 16-bit Image: 30
[3/12/2021 21:43:9] Watchdog Timer Reset: 0
[3/12/2021 21:43:14] GXS-700 Driver Initialization: 0
[3/12/2021 21:43:14] GXS-700 Driver Initialization Success: 0
[3/12/2021 21:43:14] Premature X-Ray Detected.: 0
[3/12/2021 21:43:19] GXS-700 Sensor Unplugged: 0

Could this just be a problem with the data reception? Maybe something wrong with the USB-parameters? Or might the firmware be broken and flashing an intact image would fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.