accessi
Advanced tools
| import json | ||
| import base64 | ||
| import numpy as np | ||
| from typing import Literal | ||
| from datetime import datetime | ||
| from types import SimpleNamespace | ||
| from src import accessi as Access | ||
| def websocket_to_object(websocket_data): | ||
| data = json.dumps(Access.handle_websocket_message(websocket_data)) | ||
| return json.loads(data, object_hook=lambda d: SimpleNamespace(**d)) | ||
| def websocket_imagestream_to_image(websocket_data, bit_depth: Literal[8, 16] = 8): | ||
| """ | ||
| returns: | ||
| - image: either 8 or 16 bit image as numpy array | ||
| - metadata: the original image metadata | ||
| """ | ||
| image = None | ||
| metadata = None | ||
| image_data = websocket_to_object(websocket_data) | ||
| if "imageStream" in image_data: | ||
| image = base64_to_image(image_data[2], bit_depth) | ||
| metadata = image_data[2].value | ||
| return image, metadata | ||
| def base64_to_image(imagedata, bit_depth: Literal[8, 16] = 8): | ||
| image = np.frombuffer(base64.b64decode(imagedata.value.image.data), dtype=np.uint16) | ||
| image = np.reshape(image, (imagedata.value.image.dimensions.columns, | ||
| imagedata.value.image.dimensions.rows)) | ||
| if bit_depth == 8: | ||
| image = (image / image.max() * 255).astype(np.uint8) | ||
| elif bit_depth == 16: | ||
| image = image.astype(np.uint16) | ||
| return image |
+50
-1
| Metadata-Version: 2.1 | ||
| Name: accessi | ||
| Version: 0.0.6 | ||
| Version: 0.0.7 | ||
| Summary: Library for Siemens Access-i MR Scanner Interface to integrate and control the MR Scanner. | ||
@@ -19,2 +19,3 @@ Author-email: Martin Reinok <m.reinok@student.utwente.nl> | ||
| ## Install | ||
| This is the easiest way to use the install the library, if you do not need to modify it. | ||
| ``` | ||
@@ -33,3 +34,51 @@ pip install accessi | ||
| ### Usage examples | ||
| Here are some projects which have used this library: | ||
| - [Martin Reinok Thesis Software GitHub](https://github.com/martinreinok/master-thesis/tree/master/tracking-software) | ||
| ## Access-i Licence for real MR at TechMed (Also works with simulator) | ||
| ``` | ||
| name="UTwente", | ||
| start_date="20231102", | ||
| warn_date="20251002", | ||
| expire_date="20251102", | ||
| system_id="152379", | ||
| hash="uTwo2ohlQvMNHhfrzceCRzfRSLYDAw7zqojGjlP%2BCEmqPq1IxUoyx5hOGYbiO%2FEIyiaA4oFHFB2fwTctDbRWew%3D%3D", | ||
| informal_name="This name shows up on MR computer" | ||
| ``` | ||
| ### Connection and IP Addresses | ||
| The Access-i in TechMed is running on this IP address: | ||
| ``` | ||
| 10.89.184.9 | ||
| Access-i Version: v1 | ||
| ``` | ||
| Simulator IP: | ||
| ``` | ||
| 127.0.0.1 | ||
| Access-i Version: v2 | ||
| ``` | ||
| In order to connect, the client must have the following networking settings: | ||
| ``` | ||
| Client IP: 192.168.182.20 (Maybe something else works too, have not tried) | ||
| Subnet: 255.255.255.0 | ||
| Gateway: 192.168.182.1 | ||
| DNS1: 192.168.182.1 | ||
| ``` | ||
| ### Multiple network adapters on the same computer | ||
| To be able to use both, Access-i and WAN (external interent) at the same time, some configurations are necessary. These are only compatible with Windows for now. | ||
| Find out what is the interface number, which is connected to Access-i: | ||
| ``` | ||
| route print | ||
| ``` | ||
| Using the interface number, create a route: | ||
| ``` | ||
| route add 10.89.184.0 mask 255.255.255.0 192.168.182.20 if 8 -p | ||
| ``` | ||
| Here __if 8__ is the interface number in this particular case, __-p__ means persistant so it will stay after reboot. | ||
| ## Collaborating | ||
| The majority of Access-i functionality is not yet implemented here, if you need more functionality, any additions are accepted. |
+1
-1
| [project] | ||
| name = "accessi" | ||
| version = "0.0.6" | ||
| version = "0.0.7" | ||
| authors = [ | ||
@@ -5,0 +5,0 @@ { name="Martin Reinok", email="m.reinok@student.utwente.nl" }, |
+49
-0
@@ -5,2 +5,3 @@ # Siemens Access-i Interface library | ||
| ## Install | ||
| This is the easiest way to use the install the library, if you do not need to modify it. | ||
| ``` | ||
@@ -19,3 +20,51 @@ pip install accessi | ||
| ### Usage examples | ||
| Here are some projects which have used this library: | ||
| - [Martin Reinok Thesis Software GitHub](https://github.com/martinreinok/master-thesis/tree/master/tracking-software) | ||
| ## Access-i Licence for real MR at TechMed (Also works with simulator) | ||
| ``` | ||
| name="UTwente", | ||
| start_date="20231102", | ||
| warn_date="20251002", | ||
| expire_date="20251102", | ||
| system_id="152379", | ||
| hash="uTwo2ohlQvMNHhfrzceCRzfRSLYDAw7zqojGjlP%2BCEmqPq1IxUoyx5hOGYbiO%2FEIyiaA4oFHFB2fwTctDbRWew%3D%3D", | ||
| informal_name="This name shows up on MR computer" | ||
| ``` | ||
| ### Connection and IP Addresses | ||
| The Access-i in TechMed is running on this IP address: | ||
| ``` | ||
| 10.89.184.9 | ||
| Access-i Version: v1 | ||
| ``` | ||
| Simulator IP: | ||
| ``` | ||
| 127.0.0.1 | ||
| Access-i Version: v2 | ||
| ``` | ||
| In order to connect, the client must have the following networking settings: | ||
| ``` | ||
| Client IP: 192.168.182.20 (Maybe something else works too, have not tried) | ||
| Subnet: 255.255.255.0 | ||
| Gateway: 192.168.182.1 | ||
| DNS1: 192.168.182.1 | ||
| ``` | ||
| ### Multiple network adapters on the same computer | ||
| To be able to use both, Access-i and WAN (external interent) at the same time, some configurations are necessary. These are only compatible with Windows for now. | ||
| Find out what is the interface number, which is connected to Access-i: | ||
| ``` | ||
| route print | ||
| ``` | ||
| Using the interface number, create a route: | ||
| ``` | ||
| route add 10.89.184.0 mask 255.255.255.0 192.168.182.20 if 8 -p | ||
| ``` | ||
| Here __if 8__ is the interface number in this particular case, __-p__ means persistant so it will stay after reboot. | ||
| ## Collaborating | ||
| The majority of Access-i functionality is not yet implemented here, if you need more functionality, any additions are accepted. |
| Metadata-Version: 2.1 | ||
| Name: accessi | ||
| Version: 0.0.6 | ||
| Version: 0.0.7 | ||
| Summary: Library for Siemens Access-i MR Scanner Interface to integrate and control the MR Scanner. | ||
@@ -19,2 +19,3 @@ Author-email: Martin Reinok <m.reinok@student.utwente.nl> | ||
| ## Install | ||
| This is the easiest way to use the install the library, if you do not need to modify it. | ||
| ``` | ||
@@ -33,3 +34,51 @@ pip install accessi | ||
| ### Usage examples | ||
| Here are some projects which have used this library: | ||
| - [Martin Reinok Thesis Software GitHub](https://github.com/martinreinok/master-thesis/tree/master/tracking-software) | ||
| ## Access-i Licence for real MR at TechMed (Also works with simulator) | ||
| ``` | ||
| name="UTwente", | ||
| start_date="20231102", | ||
| warn_date="20251002", | ||
| expire_date="20251102", | ||
| system_id="152379", | ||
| hash="uTwo2ohlQvMNHhfrzceCRzfRSLYDAw7zqojGjlP%2BCEmqPq1IxUoyx5hOGYbiO%2FEIyiaA4oFHFB2fwTctDbRWew%3D%3D", | ||
| informal_name="This name shows up on MR computer" | ||
| ``` | ||
| ### Connection and IP Addresses | ||
| The Access-i in TechMed is running on this IP address: | ||
| ``` | ||
| 10.89.184.9 | ||
| Access-i Version: v1 | ||
| ``` | ||
| Simulator IP: | ||
| ``` | ||
| 127.0.0.1 | ||
| Access-i Version: v2 | ||
| ``` | ||
| In order to connect, the client must have the following networking settings: | ||
| ``` | ||
| Client IP: 192.168.182.20 (Maybe something else works too, have not tried) | ||
| Subnet: 255.255.255.0 | ||
| Gateway: 192.168.182.1 | ||
| DNS1: 192.168.182.1 | ||
| ``` | ||
| ### Multiple network adapters on the same computer | ||
| To be able to use both, Access-i and WAN (external interent) at the same time, some configurations are necessary. These are only compatible with Windows for now. | ||
| Find out what is the interface number, which is connected to Access-i: | ||
| ``` | ||
| route print | ||
| ``` | ||
| Using the interface number, create a route: | ||
| ``` | ||
| route add 10.89.184.0 mask 255.255.255.0 192.168.182.20 if 8 -p | ||
| ``` | ||
| Here __if 8__ is the interface number in this particular case, __-p__ means persistant so it will stay after reboot. | ||
| ## Collaborating | ||
| The majority of Access-i functionality is not yet implemented here, if you need more functionality, any additions are accepted. |
| LICENSE | ||
| README.md | ||
| pyproject.toml | ||
| src/DataConversion.py | ||
| src/__init__.py | ||
@@ -5,0 +6,0 @@ src/accessi.py |
@@ -0,2 +1,3 @@ | ||
| DataConversion | ||
| __init__ | ||
| accessi |
+9
-11
@@ -6,8 +6,7 @@ """ | ||
| import json | ||
| from asyncio import LifoQueue | ||
| import asyncio | ||
| import numpy as np | ||
| from src import accessi as Access | ||
| from types import SimpleNamespace | ||
| from src import accessi as Access | ||
| import threading | ||
| import asyncio | ||
| import time | ||
| from src import DataConversion | ||
@@ -193,8 +192,7 @@ Access.config.ip_address = "127.0.0.1" | ||
| image_data = await websocket.recv() | ||
| if '"imageStream"' in image_data: | ||
| image_data = json.dumps(Access.handle_websocket_message(image_data)) | ||
| image_data = json.loads(image_data, object_hook=lambda d: SimpleNamespace(**d)) | ||
| print(f"Websocket callback image dimensions: " | ||
| f"{image_data[2].value.image.dimensions.columns}," | ||
| f"{image_data[2].value.image.dimensions.rows} ") | ||
| image, metadata = DataConversion.websocket_imagestream_to_image(image_data, 8) | ||
| if image is not None: | ||
| print(f"Websocket callback image dimensions: {image.shape}, " | ||
| f"Image max value: {np.max(image)}, " | ||
| f"Image min value: {np.min(image)}") | ||
| break | ||
@@ -201,0 +199,0 @@ |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
53739
12.37%13
8.33%1039
2.97%