Show 3D reconstruction rendered by Slicer in a web browser

I have my Slicer app run background on WIN10 , How can I activate Slicer app to show 3D reconstruction by a message sends from browser

I would donate 200$ to Slicer for soving this problems, because it puzzled me a very long time.

this problem means a lot to me , any one can solve this , I would pay for solution > 200 $

Customization is required, but basically you can activate Slicer’s WebServer and connect to it from a browser by accessing the localhost port.

https://slicer.readthedocs.io/en/latest/user_guide/modules/webserver.html?highlight=webserver

2 Likes

message from web-app PACS/HIS, with a chrome plugin, was sent to windows app like “”" kview:////info=studyuid=1.2.826.0.1.3680043.2.461.13073401.3329453282#userid=9999#pacssvrip=172.16.0.59#pacssvrport=7008#pacssvrip1=#pacssvrport1=#security=1 “”", I wander if I can modify message to activate Slicer to get 3D reconstruction like this, thank you very much

Yes, this should be no problem at all.

  1. You need to associate kview:// protocol with Slicer in your operating system. Then when you click on the link the operating system will automatically launch Slicer.
  2. When Slicer is launched with a URL then the Slicer application object emits the urlReceived signal that your custom script can interpret (similarly how it is done in DICOM module), for example it can retrieve the selected study based on the information in the URL, render the image, and make it available via the WebServer API.

I hope someone will show up here who can put this all together for you.

1 Like

thank you for answering. In our hospital, we use chrome browser to read dicom pic, and we can put a button on html , direct to Slicer, by sending message “https:// protocol with Slicer”? can any one help me for remote controll? I would pay for the help. this means a lot to our hospital.

thank you, but I can’t find WebServer module in 3D Slicaer , my version is 5.0.2

thank you , I foud the version 5.10 is ok

https protocol is associated with your web browser (so if you open an https URL then the operating system launches the default web browser; and if you click the link in the web browser then of course it will just open the link within the browser). Therefore, you need to use a custom protocol, such as slicer and the URL would look something like this:

slicer://viewer/?studyUID=2.16.840.1.113669.632.20.121711.10000158860&access_token=k0zR6WAPpNbVguQ8gGUHp6&dicomweb_endpoint=http%3A%2F%2Fdemo.kheops.online%2Fapi&dicomweb_uri_endpoint=%20http%3A%2F%2Fdemo.kheops.online%2Fapi%2Fwado
1 Like

I find another way to solve the problem, WebServer is ok, and use ‘localhost:2016/slicer/exec’ post to exec python with the operation I need. but I have not find the way to get dicom by patient name and studyId, could you please tell me how to exec this operation by python scripts, not just paste a script_repo, to judge all kind of opeartions, thank you very much!

Specially, post /slicer/exec, how can I make the Volume Rendering opeartion executed automatically?

You can send any slicer python code (e.g. any of the code from the script repository or other python code) to the slicer/exec endpoint. This makes it very powerful, so be sure you have total control over what gets posted there (you may wish to wrap this in a security layer like a proxy).

But assuming you have that under control, then from what I can tell from your earlier posts you would need to take the information from the posted URL, like the study uid and pacs info, probably together with other pre-defined info like the pacs ip address, and download the study on to the local disk and import it through the dicom database. From there you can load and render using the rest of the slicer api. It’s not a huge job but there’s some programming you need to learn.

Thank you for replying me in detail sincerely, and I am coing python to your open source program. sorry to disturbe again for some questions while in programing I found .

  1. can Web Server start automatically in .slicerrc.py by python code (I have reading you code in webserver.py, and I have no idea )
  2. add node from dicom database, using function " DICOMUtils.loadByInstanceUID(insUid) " failed with the error code " DICOM Plugin failed: tuple index out of range ", deatiled info added in below.
  3. can only just display 3d view full screen with rendering tools, not other frame or view is need

error info:
File “H:\Program Files (x86)\Slicer 5.1.0-2022-06-21\lib\Slicer-5.1\qt-scripted-modules\DICOMLib\DICOMUtils.py”, line 744, in getLoadablesFromFileLists
loadablesByPlugin[plugin] = plugin.examineForImport(fileLists)
File “H:/Program Files (x86)/Slicer 5.1.0-2022-06-21/bin/…/lib/Slicer-5.1/qt-scripted-modules/DICOMScalarVolumePlugin.py”, line 151, in examineForImport
loadablesForFiles = self.examineFiles(files)
File “H:/Program Files (x86)/Slicer 5.1.0-2022-06-21/bin/…/lib/Slicer-5.1/qt-scripted-modules/DICOMScalarVolumePlugin.py”, line 175, in examineFiles
seriesUID = slicer.dicomDatabase.fileValue(files[0],self.tags[‘seriesUID’])
IndexError: tuple index out of range
DICOM Plugin failed: tuple index out of range
Traceback (most recent call last):
File “H:\Program Files (x86)\Slicer 5.1.0-2022-06-21\lib\Slicer-5.1\qt-scripted-modules\DICOMLib\DICOMUtils.py”, line 748, in getLoadablesFromFileLists
loadablesByPlugin[plugin] = plugin.examine(fileLists)
File “H:/Program Files (x86)/Slicer 5.1.0-2022-06-21/bin/…/lib/Slicer-5.1/qt-scripted-modules/MultiVolumeImporterPlugin.py”, line 119, in examine
loadables += self.examineFilesIPPAcqTime(files)
File “H:/Program Files (x86)/Slicer 5.1.0-2022-06-21/bin/…/lib/Slicer-5.1/qt-scripted-modules/MultiVolumeImporterPlugin.py”, line 357, in examineFilesIPPAcqTime
desc = slicer.dicomDatabase.fileValue(files[0],self.tags[‘seriesDescription’]) # SeriesDescription
IndexError: tuple index out of range
DICOM Plugin failed: tuple index out of range
Traceback (most recent call last):
File “”, line 1, in
File “H:\Program Files (x86)\Slicer 5.1.0-2022-06-21\lib\Slicer-5.1\qt-scripted-modules\DICOMLib\DICOMUtils.py”, line 263, in loadByInstanceUID
return loadLoadables(filteredLoadablesByPlugin)
File “H:\Program Files (x86)\Slicer 5.1.0-2022-06-21\lib\Slicer-5.1\qt-scripted-modules\DICOMLib\DICOMUtils.py”, line 770, in loadLoadables
if loadable.selected:
AttributeError: ‘NoneType’ object has no attribute ‘selected’

I found another question in WebServer
if a patient has many studies, I want to load one of studies use study id as a node to watch, but source file DICOMUtils.py did not implement this. wish for your answering.

If you load a DICOM study via DICOMweb then you can specify the study UID:

slicer.app.openUrl("slicer://viewer/?studyUID=2.16.840.1.113669.632.20.121711.10000155501&access_token=eyJhbGciO...SC1NR0GA&dicomweb_endpoint=https%3A%2F%2Fdemo.kheops.online%2Fapi&dicomweb_uri_endpoint=https%3A%2F%2Fdemo.kheops.online%2Fapi%2Fwado"

If you load from a folder then you can load a specific study or series, the same way as it is done in loadPatientByUID:

I had read this code yet , does that mea I need to code this part ,and the push to you main repo? or will your team add this function in later version?

I had read this code yet , does that mea I need to code this part ,and the push to you main repo? or will your team add this function in later version?

You can do everything you describe in your own code. No need to add anything to our repository unless you develop some helper utilities that others might find useful.

You can look for slicerrc.py to find how to script the startup behavior of Slicer and can start/configure the WebServer module from there. You can also program the dicom module to retrieve / load data and can customize the rendering. @lassoan and I are busy this week with Project Week and may not have time to provide details, but if you join Project Week you can find people to discuss your use case and help.