From 84e06bb5dee0b4e3e0022039cd29953724b00489 Mon Sep 17 00:00:00 2001 From: Reza Asakereh Date: Tue, 16 Jan 2024 02:21:05 -0500 Subject: [PATCH] Windows compatibility issues fixed --- MedSAM/MedSAMLite/MedSAMLite.py | 4 ++-- server/server.py | 4 +++- server_essentials.zip | Bin 36888274 -> 36888276 bytes 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/MedSAM/MedSAMLite/MedSAMLite.py b/MedSAM/MedSAMLite/MedSAMLite.py index 2e4cc8b..f9e31a1 100644 --- a/MedSAM/MedSAMLite/MedSAMLite.py +++ b/MedSAM/MedSAMLite/MedSAMLite.py @@ -460,7 +460,7 @@ def install_dependencies(self, ctk_path): self.run_on_background(self.download_wrapper, (file_url, filename), 'Downloading additional files...') - self.server_dir = os.path.join(ctk_path.currentPath, 'server_essentials') + self.server_dir = os.path.join(ctk_path.currentPath + '/', 'server_essentials') dependencies = { 'PyTorch': 'torch==2.0.1 torchvision==0.15.2', @@ -545,7 +545,7 @@ def captureImage(self): self.img_sitk = sitk.ReadImage(self.img_path) self.image_data = slicer.util.arrayFromVolume(self.volume_node) ################ Only one node? - def sendImage(self, serverUrl='http://127.0.0.1:5555', numpyServerAddress=("0.0.0.0", 5556)): + def sendImage(self, serverUrl='http://127.0.0.1:5555', numpyServerAddress=("127.0.0.1", 5556)): if not self.server_ready: self.run_server() print('sending setImage request...') diff --git a/server/server.py b/server/server.py index 736f88c..a60fe9e 100644 --- a/server/server.py +++ b/server/server.py @@ -2,6 +2,7 @@ import sys import time import json +import os from tqdm import tqdm from fastapi import FastAPI, BackgroundTasks @@ -62,7 +63,8 @@ def medsam_inference(medsam_model, img_embed, box_1024, height, width): # settings and app states SAM_MODEL_TYPE = "vit_b" -MedSAM_CKPT_PATH = "/home/rasakereh/Desktop/wanglab/MedSam/slicer-plugin/MedSAM-Slicer/medsam_lite.pth" +PARENT_DIR = os.path.dirname(os.path.abspath(__file__)) +MedSAM_CKPT_PATH = os.path.join(PARENT_DIR , "medsam_lite.pth") MEDSAM_IMG_INPUT_SIZE = 1024 device = 'cpu'#torch.device("cuda:0" if torch.cuda.is_available() else "cpu") diff --git a/server_essentials.zip b/server_essentials.zip index 192e362fdb9ad4eca58228d368c8676c8672310a..a3cad2fee7913850def9f9c5377e427051a8553d 100644 GIT binary patch delta 8304 zcmZ|U2{={z`oM7(88c;UlbMXQZH`%)D$*n}Mk(l@p%Ii|r%)&60w;pGMwo+%gDF#h>M%bK3@b4)iIcINR6>+~@UX|h zWxhwZ*zz#3NB?|0p2Oo%05=me>ktbQ(>ys8Z=cuNWFFt~zwpY%z>saU*NIvm!Q5s6E&w8Zv&Y;JidqrQP&%xT^Rtst+ ztFlVLhSzC&U7wO$6NGoTv>r8X&Re<9vBr5sMvW`n+@~kn>+&JzD*AdS5jC@$g%lB$xQZn_zHi%_R;`(I<)pZn&>yEcnB#TcK1u3GWJe|sj1BvRK%mak|3o7rJHp@!UrPF-kawyY!_H!7Lk>0QtoKc`p00j z#F^f3-xdu&yL`3ly8SNC>C2X#Fp@0f9d2&>BM;7;_nkn0+*cW4?p#%c+aNlL@wKnGD%V^{=#>oG*qacZ-x|B`kf^8sQ&z$*ZrU z@>8+dk->{XQkCP{tgCttZSl;0dp~Aft%<1lT&-M#wz8RxF%et5wnF`YUGZa9`m^Ts zCQVioP7Yz37TsE%ZoJleR{Yr)Ez%u37zZQf}X-hgNJpO&9jQzx{mcf@crgjP6}1FOy6g(Rvp@S2_{A z^vp!Yw*4ZL?_c#@y*qb=>e5gy&TnsXC5?wK%X6f1PUrT4Z&P99@KjAAec6yt+YghX z#vHx6ofR(^Q^!7-E1#!KZk=qh*A#WR@;2Ybq{GNc^M2jQ;nSyP&TwaKR~>XQUco{e zpqG4Vvktc9(Ytu6$b}H++iJe#a!HsR|KhHvhniYEn(ICdS1lGaWwB-*kC0`3p#84% z+D_jTe$kU-Ev-8%?j17boh6s)I{BryaqZ3Un!OTKCuLZ?Th;eaP`luc07{B%{`7*w z4h`BjE!p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