Is there anyway to use MONAI LABEL on a Macbook?

Operating system: MacOS Monterey
Slicer version: latest version (5.0)
Python version: 3.10.5

I’m a totally newbie, so my questions may sound a little dumb. Is there anyway to use MONAI LABEL on a Mac M1? Probably will need some really basic explanations. Tks

You can run the MONAILabel user interface in Slicer on a macbook. However, you need to connect to a MONAILabel server that runs on a GPU-equipped Linux or Windows system.

1 Like

Hmmmm… How I said earlier, I’m really newbie (Surgeon w almost no programming background trying to learn from scratch)… How exactly I do this? :sweat_smile:

When I try to use MONAILabel on Slicer without specifying any server, this message appears (this happens even when I try to connect home without any proxy):

Traceback (most recent call last):
File “/Applications/Slicer.app/Contents/Extensions-30822/MONAILabel/lib/Slicer-5.0/qt-scripted-modules/MONAILabel.py”, line 1030, in fetchInfo
info = self.logic.info()
File “/Applications/Slicer.app/Contents/Extensions-30822/MONAILabel/lib/Slicer-5.0/qt-scripted-modules/MONAILabel.py”, line 2121, in info
return MONAILabelClient(self.server_url, self.tmpdir, self.client_id).info()
File “/Applications/Slicer.app/Contents/Extensions-30822/MONAILabel/lib/Slicer-5.0/qt-scripted-modules/MONAILabelLib/client.py”, line 48, in info
status, response, _ = MONAILabelUtils.http_method(“GET”, self._server_url, selector)
File “/Applications/Slicer.app/Contents/Extensions-30822/MONAILabel/lib/Slicer-5.0/qt-scripted-modules/MONAILabelLib/client.py”, line 268, in http_method
conn.request(method, selector, body=body, headers=headers)
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/http/client.py”, line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/http/client.py”, line 1331, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/http/client.py”, line 1280, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/http/client.py”, line 1040, in _send_output
self.send(msg)
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/http/client.py”, line 980, in send
self.connect()
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/http/client.py”, line 946, in connect
self.sock = self._create_connection(
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/socket.py”, line 844, in create_connection
raise err
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/socket.py”, line 832, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

Sorry if is some really basic thing and thank you Andras!

You need to have access to a computer with a strong GPU (NVIDIA GPU with at least 16GB, preferably 24GB RAM) and run MONAILabel server on it. You can configure and run the server by using the commands described here. If the segmentation task is simple (for example, you need to segment large structure with simple shape and good contrast to surrounding structures) then you may use existing models developed for similar segmentations. However, if your segmentation task is not easy then most likely you need to experiment with network architecture and training parameters. This does not necessarily require programming background, but it could help if you can find someone who has some experience in deep learning to help you.

You might even find someone in the Slicer community who would be interested to collaborate. What is the clinical application - surgical planning? what procedure? What structures would you like to segment?

1 Like

Also @Celina_Hallal you may look at what @rbumm has been doing. He’s also a surgeon who has been working through MONAI Label and getting good results for his application.

2 Likes

Great, guys! Thanks a lot!

I’m trying to do better liver segmentations for surgical planning. I’ve been segmenting some cases manually. Most of the pre-trained models I’ve tried weren’t as good as I would need, mostly with surrounding structures like IVC, stomach, and spleen.

I’m a surgical resident from a Brazilian University with interest in Liver Surgery. Last year we had one difficult case that could benefit from a 3D model, and I found it was almost impossible to do it easily using the resources we had at our Radiology Dept…

Since then, I’ve been playing with some cases and studying a bit. Some of my attendings loved the idea, and I’m trying to do something with it for my conclusion thesis (Residency program thesis here in Br is not a big deal, generally we do something we can use later in M.S.c - things work a little different here).

My first idea was to do something like you and Yeo did in " Utility of 3D Reconstruction of 2D Liver Computed Tomography/ Magnetic Resonance Images as a Surgical Planning Tool for Residents in Liver Resection Surgery". But later we discussed and we wouldn’t have plenty of time to do that.

Besides, recently we had some trouble with our preoperative liver volumetry. So, my idea is to create an workflow to make parenchyma and vessel segmentation easier and more reliable (something a busy surgical resident that doesn’t even know what is “DICOM”, “Python” and “Neural networks” can do). I would train a model with a dataset, then try it with our pre and postoperative cases, both oncological and pre-LDLT.

But, as I said earlier, I’m a noob with little programming background (and most of my MD colleagues are way worse). So I may be wandering a bit… But, as they say, the best way to learn is doing it (and failing sometimes :sweat_smile: ). Tomorrow I will have a meeting with a guy from the medical physics at the hospital about my project and about using some of the Radiology Dept. computer as server.

Thank you a lot!!!

2 Likes

Thanks for providing more context, it sounds like a good project and it hopefully we can help out and answer any questions that come up in your work. Be sure to check out some of the other ongoing work related to liver segmentation and surgery planning. I’m sure additional testing and clinical input would be helpful.

https://projectweek.na-mic.org/PW37_2022_Virtual/Projects/SlicerLiver/

https://discourse.slicer.org/t/new-extension-development-plan-self-supervised-learning-and-liver-segmentation/23714

1 Like