近红外连接库python版本
目的
外部设备通过该库连接近红外设备(第二代百导设备)完成打标功能以及获取测试数据
工具版本
设备版本
2.0.0及以上
python版本
- python:3.11.3
- pip: 19.0.3
- requests:2.21.0
- urllib3:1.24.3
- websockets:7.0
安装与启动方法
$pip install fnirs_v2_link
操作流程
选择病人信息(在近红外设备上操作)
选择方案列表里面的扩展任务(在近红外设备上操作)
校准(在近红外设备上操作)
点击“测查开始”(在近红外设备上操作)
开始测试(调start接口。在点击“测查开始”5S后调用才有效)
测试
结束测试(调stop接口)
接口说明
1、操作接口
具体见connection.py
class Connection:
def start(self):
"""
开始测试
:return:
"""
def stop(self):
"""
结束测试
:return:
"""
def mark(self, mark):
"""
科研mark
:return:
"""
2、数据接收
说明:使用websocket接收数据
见fnirs_v2_link.py
# orgin数据处理
class OriginDataProcessing(threading.Thread):
_ws = None
running = False
def __init__(self):
super(DataProcessing, self).__init__()
self.running = True
try:
self._ws = create_connection(Connection().WS_GETDATA_URL)
except Exception as e:
self._ws = None
print('服务端未开启!')
def run(self):
if self._ws is None:
return
print('开始数据处理!')
while self.running:
result = self._ws.recv() ##接收消息
if result is not None:
resultJson = json.loads(result)
# result = result.encode('utf-8')
# print(resultJson)
# 获取1通道690波长原始数据
print(resultJson["1"]["v690List"])
# print(resultJson)
# HB/HBO数据处理
class HBDataProcessing(threading.Thread):
_ws = None
running = False
def __init__(self):
super(HBDataProcessing, self).__init__()
self.running = True
try:
self._ws = create_connection(Connection().WS_GET_PAGE_DATA_URL)
except Exception as e:
self._ws = None
print('服务端未开启!')
def run(self):
if self._ws is None:
return
print('开始数据处理!')
while self.running:
result = self._ws.recv() ##接收消息
if result is not None:
resultJson = json.loads(result)
# result = result.encode('utf-8')
# print(resultJson)
# 获取1通道HB数据
print(resultJson["1"]["oxyList"])
3、数据格式
①orgin data数据格式
{
"1":{
"v690List":[],
"v830List":[]
},
"2":{
"v690List":[],
"v830List":[]
},
//...
"106":{
"v690List":[],
"v830List":[]
}
}
②HB/HBO data数据格式
{
"resultData":{
"1":{
"oxyList":[],
"deOxyList":[]
},
"2":{
"oxyList":[],
"deOxyList":[]
},
//...
"106":{
"oxyList":[],
"deOxyList":[]
}
},
}
使用示例
运行 fnirs_v2_link.py
注意事项
1、设备版本必须为2.0.0及以上
2、使用该库时,运行python代码的电脑必须与近红外设备在一个网段中,其中设备ip为192.168.8.1,python所在电脑ip为192.168.8.X
3、使用该库时,请先在设备上``选择患者、方案(外部方案),并进行校准,然后点击开始等待外部触发,见操作流程
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fnirs_v2_link-1.0.2.tar.gz
(11.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fnirs_v2_link-1.0.2.tar.gz.
File metadata
- Download URL: fnirs_v2_link-1.0.2.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/5.1.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f869bd07d5e37083c444794a328d75be6616d5f351461177b9280b5ec4d8af67
|
|
| MD5 |
e9494f3a14d407aea9e6373c1cc4594d
|
|
| BLAKE2b-256 |
aeef8e0a7fed3c101aabd48b33e3fe78dd29922e1c6873faa96e8e203b8c1bef
|
File details
Details for the file fnirs_v2_link-1.0.2-py3-none-any.whl.
File metadata
- Download URL: fnirs_v2_link-1.0.2-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/5.1.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc42301853acc8f472b04b8616d3af06f40f1b98490c6ea0bd6d638e72f55d63
|
|
| MD5 |
c380516cda74648ff783423564fa4e72
|
|
| BLAKE2b-256 |
da8f0fb23b7147fc51a944eb119f6fd79ebd21b3cad6ced072f754be3fe625cd
|