nicofutur8
(Nicolás Fuentes Turpín)
June 10, 2025, 10:09am
1
Hello everyone,
I have created a plugin called “showPatientInfo” which shows certain metadata from a volume stored in DB and also shows if any user has connected.
The thing now is I would want to show this plugin via url action (slicer://) as you explained in docs.
I don’t know what command i need to use to load my plugin and also, if it can be done, i would like to send user’s and image’s uids through this “url command”, so that my plugin can receive those UIDs as input parameters.
Thanks in advance, every piece of help is appreciated.
Nico
pieper
(Steve Pieper (Isomics, Inc.))
June 10, 2025, 12:54pm
2
You need to make a module that connects to the onURLReceived
signal from the application. Here’s an example:
slicer://viewer/?download=https%3A%2F%2Fgithub.com%2Frbumm%2FSlicerLungCTAnalyzer%2Freleases%2Fdownload%2FSampleData%2FLungCTAnalyzerChestCT.nrrd
See more information <a href="https://discourse.slicer.org/t/how-to-load-nifti-file-from-web-browser-link/18664/5">here</a>.
"""
self.parent.acknowledgementText = """
This file was originally developed by Andras Lasso, PerkLab and ASH.
"""
# Initilize self.sampleDataLogic. At this point, Slicer modules are not initialized yet, so we cannot instantiate the logic yet.
self.sampleDataLogic = None
slicer.app.connect("urlReceived(QString)", self.onURLReceived)
def reportProgress(self, message, logLevel=None):
# Print progress in the console
print(f"Loading... {self.sampleDataLogic.downloadPercent}%")
# Abort download if cancel is clicked in progress bar
if self.progressWindow.wasCanceled:
raise Exception("download aborted")
# Update progress window
self.progressWindow.show()
self.progressWindow.activateWindow()
threeDWidget = layoutManager.threeDWidget(0)
threeDView = threeDWidget.threeDView()
threeDView.resetFocalPoint()
def showSliceViewsIn3d(self):
layoutManager = slicer.app.layoutManager()
for sliceViewName in layoutManager.sliceViewNames():
controller = layoutManager.sliceWidget(sliceViewName).sliceController()
controller.setSliceVisible(True)
def onURLReceived(self, urlString):
"""Process DICOM view requests. URL protocol and path must be: slicer://viewer/
Query parameters:
- `download`: download and show with default file type
- `image` or `volume`: download and show as image
- `segmentation`: download and show as segmentation
- `show3d`: show segmentation in 3D and center 3D view
- `filename`: filename to specify file format and node name for the first node; useful if the download URL does not contain filename
Display a file (using default file type):
1 Like