From a15e72fdf8f33cc0b43e68f306ef4cacd29bc2e7 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Fri, 24 Nov 2023 10:51:06 -0800 Subject: [PATCH] feat: starting to add callback code for volume click events --- API/oursin/client.py | 5 +++++ API/oursin/volumes.py | 14 ++++++++++++++ Server/server.js | 3 +++ 3 files changed, 22 insertions(+) diff --git a/API/oursin/client.py b/API/oursin/client.py index 8bb8ca5a..4cf94a04 100644 --- a/API/oursin/client.py +++ b/API/oursin/client.py @@ -4,6 +4,7 @@ import asyncio from . import camera +from . import volumes class bcolors: WARNING = '\033[93m' @@ -42,6 +43,10 @@ def receive_camera_img_meta(data): @sio.on('CameraImg') def receive_camera_img(data): camera.on_camera_img(data) + +@sio.on('VolumeClick') +def receive_volume_click(data): + volumes.volume_click(data) # Helper functions def connected(): diff --git a/API/oursin/volumes.py b/API/oursin/volumes.py index cd5cd484..6dc05158 100644 --- a/API/oursin/volumes.py +++ b/API/oursin/volumes.py @@ -10,11 +10,25 @@ CHUNK_LIMIT = 1000000 +def volume_click(data): + print(data) + class Volume: """Volumetric dataset represented in a compressed format by using a colormap to translate uint8 x/y/z data into full RGB color. + + Volumes should be created in (AP, ML, DV) """ def __init__(self, volume_data, colormap = None): + """_summary_ + + Parameters + ---------- + volume_data : _type_ + _description_ + colormap : _type_, optional + _description_, by default None + """ global counter self.id = f'volume{counter}' counter += 1 diff --git a/Server/server.js b/Server/server.js index 9972a428..71df9f9e 100644 --- a/Server/server.js +++ b/Server/server.js @@ -81,6 +81,9 @@ io.on("connection", function (socket) { socket.on('CameraImg', function(data) { emitToSender(socket.id, 'CameraImg', data); }); + socket.on('VolumeClick', function(data) { + emitToSender(socket.id, 'VolumeClick', data); + }); // Receiver events socket.on('log', function(data) {