Code Monkey home page Code Monkey logo

slicerjupyter's Introduction

SlicerJupyter

Extension for 3D Slicer that allows the application to be used from Jupyter notebook

Demo video: https://youtu.be/oZ3_cRXX2QM

Usage

Option 1. Run using Binder

You can use this option for a quick start. No installation or setup is needed, just click the link below and start using Slicer via Jupyter notebook in your web browser.

Binder

When you click on the link, Binder launches 3D Slicer with SlicerJupyter extension on their cloud servers. Binder is a free service and server resources are quite limited. Also, there is no interactive access to the graphical user interface. Therefore, this option is only recommended for testing, demos, or simple computations or visualizations.

Option 2. Run on your own computer

  • Install 3D Slicer and launch it
  • Install SlicerJupyter extension in Extension Manager (in the application menu choose View/Extension Manager, click Install button of SlicerJupyter, wait for the installation to complete, and click Restart)
  • Switch to JupyterKernel module (open the module finder by click the "Search" icon on the toolbar, or hitting Ctrl/Cmd-F, then type its name)
  • Click Start Jupyter server button

Run classic notebook interface

Follow all the installation steps above (start Jupyter server once with the default JupyterLab user interface), then restart Slicer. After this, a classic notebook server can be started by typing this into the Python console in Slicer:

slicer.util._executePythonModule('notebook',['--notebook-dir', 'some/path/to/workspace'])

Using external Jupyter server

Slicer's Python kernel can be used in Jupyter servers in external Python environments. Kernel specification installation command is displayed in Jupyter server in external Python environment section in JupyterKernel module.

You need to install and set up these Python packages: jupyter jupyterlab ipywidgets pandas ipyevents ipycanvas.

Option 3. Run using docker on your computer

  • Install docker
  • Run the docker image as described here

Using Slicer from a notebook

  • Create a new notebook, selecting Slicer 4.x kernel (for example, Slicer 4.13). Jupyter will open a new Slicer instance automatically when kernel start is requested. This Slicer instance will be automatically closed when kernel is shut down. If you manually close the Slicer application (e.g., File/Exit menu is used in Slicer) then Jupyter will automaticall restart the application in a few seconds.

Select Slicer kernel

  • While the kernel is starting, "Kernel starting, please wait.." message is displayed. After maximum few ten seconds Slicer kernel should start.
  • Do a quick test - show views content in the notebook:
import JupyterNotebooksLib as slicernb
slicernb.ViewDisplay()
  • Try the interactive view widget:
slicernb.ViewInteractiveWidget()
  • Hit Tab key for auto-complete
  • Hit Shift+Tab for showing documentation for a method (hit multiple times to show more details). Note: method name must be complete (you can use Tab key to complete the name) and the cursor must be inside the name or right after it (not in the parentheses). For example, type slicer.util.getNode and hit Shift+Tab.

Hit Tab key to auto-complete

Hit Shift-Tab key to inspect

Notes

Upgrading pip

You may see warning messages about upgrading pip, such as this:

WARNING: You are using pip version 20.1.1; however, version 20.3.3 is available.
You should consider upgrading via the '/Applications/Slicer.app/Contents/bin/./python-real -m pip install --upgrade pip' command.

In general, it is not necessary to upgrade pip, so you can ignore this warning. If you do want to upgrade it then you need to use the Slicer's "Python launcher" (instead of python-real). Slicer's Python launcher is called PythonSlicer and it sets up Slicer's virtual Python environment so that the real Python executable (python-real) can run correctly.

Script not on PATH

You may get warning about installing scripts in folder that is not on PATH:

WARNING: The script pyjson5 is installed in ‘/Applications/Slicer.app/Contents/lib/Python/bin’ which is not on PATH.

This warning is displayed to warn you that the installed script will not run by simply typing its name anywhere in a terminal. This can be safely ignored.

Shutdown all Slicer Jupyter kernels

If a Jupyter server is kept running then it will automatically restart all kernel instances (Slicer applications) that it manages. If the browser window is accidentally closed before shutting down the server, then you can get the address of all running servers by typing the following into any Slicer Python console:

slicer.util._executePythonModule('jupyter', ['notebook', 'list'])

Open the address in a web browser and click "Quit" button to shutdown the server.

Examples

You can get started by looking at example Slicer notebooks here.

For developers

Build instructions

  • Build 3D Slicer
  • Configure this project using CMake, set Slicer_DIR CMake variable to the .../Slicer-build
  • Install prerequisites

Install kernel manually

Example:

jupyter-kernelspec install /tmp/SlicerJupyter-build/inner-build/share/Slicer-4.13/qt-loadable-modules/JupyterKernel/Slicer-4.13/ --replace --user

Launch a kernel manually

Type this into Slicer's Python console to manually start a kernel that a notebook can connect to:

connection_file=r'C:\Users\andra\AppData\Roaming\jupyter\runtime\kernel-3100f53f-3433-40f9-8978-c72ed8f88515.json'
print('Jupyter connection file: ['+connection_file+']')
slicer.modules.jupyterkernel.startKernel(connection_file)

Path of connection_file is printed on jupyter notebook's terminal window.

Special commands

These commands must be the last commands in a cell.

  • __kernel_debug_enable(): enable detailed logging of all incoming Jupyter requests
  • __kernel_debug_disable(): enable detailed logging of all incoming Jupyter requests

slicerjupyter's People

Contributors

fedorov avatar ihnorton avatar jcfr avatar lassoan avatar pieper avatar tommydino93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slicerjupyter's Issues

Kernel misses autoreload IPython extension

Hi there,
first of all thanks for the jupyter notebook extension for 3DSlicer.
It allows for streamlined data processing and reproducible workflows.

Slicer kernel seems to miss autoreload extension, which is a handy feature within jupyter notebooks.

%load_ext autoreload
causes AttributeError: 'kernel.XInteractiveShell' object has no attribute 'events'

Auto-complete does not work in Slicer-4.11

Auto-complete does not work in Slicer-4.11, because "jedi" Python package is not found.

Jedi is bundled in the extension package, but Slicer does not add the site-packages subfolder of the extension to PYTHONPATH - see result of this command on Slicer-4.10 and Slicer-4.11:

print('\n'.join(os.environ['PYTHONPATH'].split(os.pathsep)))

If I manually modify SlicerLauncherSettings.ini by adding the site-packages folder then auto-completion works well.

[PYTHONPATH]
...
12\path=c:/Users/andra/appdata/Roaming/NA-MIC/Extensions-28482/SlicerJupyter/Lib/site-packages
...

Slicer 4.11 freezes when evaluating an expression of type vtkMRMLModelNode

I make a new notebook, connect it to the 4.11 kernel that I installed earlier from within the SlicerJupyter module. Then I put in a few lines of code that makes a box.

If the last line of the cell happens to be of type <class 'MRMLCorePython.vtkMRMLModelNode'>, then the output will be shown rendered in the notebook.

That's cool, but the managed Slicer instance runs into a major crisis. The problem is shown below, where I've defined a box. The box is shown alright in the notebook, but a black rectangle is scraped out of the window of the Slicer instance, which then generally refuse to work: nothing in that window is redrawn correctly afterwards. Example of kernel file is also enclosed. The Linux console output is:

Warning: In /work/Stable/Slicer-0/Libs/MRML/Core/vtkMRMLDisplayNode.cxx, line 831
vtkMRMLModelDisplayNode (0x43e88a0): SetSliceIntersectionVisibility method is deprecated, please use SetVisibility2D instead

Before that, I see after restarting:

[I 13:02:25.720 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel a45bc8c0-9fa5-40fc-8c1b-37f4b20c1bb1 restarted
Switch to module: "Welcome"
Loading Slicer RC file [/home/fusentasticus/.slicerrc.py]
Jupyter connection file: [/home/fusentasticus/.local/share/jupyter/runtime/kernel-a45bc8c0-9fa5-40fc-8c1b-37f4b20c1bb1.json]
Starting Jupyter kernel server
Run with XEUS 0.24.1

The Slicer version is 4.11.20200930 (new release), running on Ubuntu 20.04.

image

{
  "shell_port": 57603,
  "iopub_port": 53115,
  "stdin_port": 41961,
  "control_port": 34089,
  "hb_port": 60745,
  "ip": "127.0.0.1",
  "key": "703c2a32-e40336538922c79555486e35",
  "transport": "tcp",
  "signature_scheme": "hmac-sha256",
  "kernel_name": "slicer-4.11"
}

Kernel dies when debugger is attached

The kernel stops responding when lldb is attached to the Slicer process on macOS. Slicer prints the following in the notebook terminal, and in a popup window:

"Slicer has caught an internal error.\n\nYou may be able to continue from this point, but results are undefined.\n\nSuggested action is to save your work and restart.\n\nIf you have a repeatable sequence of steps that causes this message, please report the issue following instructions available at http://slicer.org\n\n\nThe message detail is:\n\nException thrown in event: Interrupted system call"

Implement inspect request

Pressing Shift+Tab brings up the inspector window in the notebook, which shows documentation of the function where the cursor is at. Input code must be parsed to correctly identify the symbol that documentation should be displayed for.

Example:

Placing the cursor in getprofile shows its documentation (correctly ignores previous lines):

image

Placing the cursor after getrecursionlimit's opening bracket, it shows documentation of getrecusrionlimit(correctly ignores getprofile symbol):

image

This is the input that xeus receives:

code: a=5
b=10
sys.getprofile(sys.getrecursionlimit()
cursor_pos: 24
detail_level: 0```

Vscode Jupyter Server

Hi,
I was hoping to use Vscode as it had support for Jupyter notebooks. I have been unable to get it to place nicely however and the kernel is recognized but refuses to start.

image
kernel recognized

image
kernel selected

image
attempt to switch to slicer kernel but fails silently

The kernel starts correctly when connecting to the browser based jupyter notebooks. Would you have any suggestions as to what i would need to modify to get Vscode to start the kernel?

Thanks for creating this wonderful extension!

Cannot install Slicer kernel in Jupyter

I am getting the following error message when trying to install the Slicer kernel from SlicerJupyter extension in Slicer.

File kernel-template.json doesn't exist in the extension directory.

[DEBUG][Qt] 05.11.2018 11:52:47 [] (unknown:0) - Switch to module:  "JupyterKernel"
[WARNING][Qt] 05.11.2018 11:52:48 [] (unknown:0) - QIODevice::read (QFile, "/Applications/Slicer_4.11_nightly.app/Contents/Extensions-27534/SlicerJupyter/share/Slicer-4.11/qt-loadable-modules/JupyterKernel/Slicer-4.11/kernel-template.json"): device not open
[WARNING][Qt] 05.11.2018 11:52:48 [] (unknown:0) - virtual bool qSlicerJupyterKernelModule::installSlicerKernel(QString)  failed: time out while launching process  "/jupyter-kernelspec"
[CRITICAL][FD] 05.11.2018 12:01:46 [] (unknown:0) - objc[15905]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fffa0f27c90) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x1219c9cd8). One of the two will be used. Which one is undefined.
[WARNING][Qt] 05.11.2018 12:04:04 [] (unknown:0) - QIODevice::read (QFile, "/Applications/Slicer_4.11_nightly.app/Contents/Extensions-27534/SlicerJupyter/share/Slicer-4.11/qt-loadable-modules/JupyterKernel/Slicer-4.11/kernel-template.json"): device not open
[WARNING][Qt] 05.11.2018 12:04:04 [] (unknown:0) - virtual bool qSlicerJupyterKernelModule::installSlicerKernel(QString)  failed: time out while launching process  "/usr/local/bin/python/jupyter-kernelspec"

I installed SlicerJupyter from the extension manager.

Error browser can't be closed

Error browser can't be closed:

image

I invoked the dialog box clicking on the bottom right X. It appeared on top left. And now I am unable to close or minimize it.

Kernel dying out repeatedly

Followed your video, copied command to clipboard and installed on a Terminal that I launched from Notebook:

image

Installation went fine.

Error snapshot:

image

It's dying every three seconds or so.

@pieper might be able to reproduce this error.

Since our data are on the ERIS cluster, we won't be able to use public binder to run SlicerJupyter on. On the other hand, we won't have docker. So, we are left with making use of Parters Jupyter server to run SlicerJupyter on.

JupyterKernel uses 100% CPU when idle

When Jupyter kernel is connected, Slicer uses 100% CPU usage (at least on Windows). This does not impact performance (it only uses idle CPU cycles) but certainly not nice.

It is due to how QSocketNotifier is set up.

If we put a delay in the poll, as it was done earlier then CPU usage is low but GUI becomes much less responsive (slice browsing is slow, etc.).

It may be possible that the problem can be fixed by initializing the socket differently and making sure all available data is read as described here.

Slicer 4.10 unable to maintain connection to kernel

I am attempting to run slicer and Jupyter on my own machine. I installed SlicerJupyter as instructed
and installed the kernel per the instructions and by copying the command supplied by the SlicerJupyter module.

I am able to select the Slicer kernel as expected for a new notebook.

As the notebook loads, Slicer is started (as expected), however after about 10 seconds the notebook loses connection to the kernel, slicer shuts down and then Jupyter attempts to re-connect which re-launches slicer, and the process fails again.

The only output in the terminal that I get (where I am running jupyter notebook from) is below:

Switch to module:  "Welcome"
starting storescp process
(u'Starting /opt/Slicer/bin/../bin/storescp with ', ['11112', '--accept-all', '--output-directory', u'/home/matt/Documents/SlicerDICOMDatabase/incoming', '--exec-sync', '--exec-on-reception', u'/opt/Slicer/bin/../bin/dcmdump --load-short --print-short --print-filename --search PatientName "/home/matt/Documents/SlicerDICOMDatabase/incoming/#f"'])
process /opt/Slicer/bin/../bin/storescp now in state Starting
process /opt/Slicer/bin/../bin/storescp now in state Running
Jupyter connection file: [/home/matt/.local/share/jupyter/runtime/kernel-d8fe4d3d-7538-4a65-8d45-366fb853a0a4.json]
[W 15:47:56.001 NotebookApp] Replacing stale connection: d8fe4d3d-7538-4a65-8d45-366fb853a0a4:e02dc0d014cf4a278ff809dd32662747

Please let me know if I am missing something, or if I should install any software differently

Fix extension build on linux

On Linux platforms, xeus also requires libuuid, which is available in all linux distributions (uuid-dev on Debian). This package should be installed on factory machines.

Integrate widget from upstream ipyvtk_simple

I borrowed much of the awesome work here in the ViewInteractiveWidget class to create ipyvtk_simple as a more minimal, general, and extensible version of the widget for use with any vtkRenderWindow backend (VTK or ParaView). It would be awesome refactor this project to utilize ipyvtk_simple for the widget and maintain it there so that the broader Jupyter VTK ecosystem can leverage the excellent work done in this project!

I can handle a PR for this, but I won't have time likely until mid-August at the earliest. I figured I'd raise the issue just so everyone is aware and if there needs to be any discussion on this work, that can happen here. cc @jcfr

Some notable changes:

  • accepts any vtkRenderWindow during init
  • no more PyQt dependency
  • slimmed down to the bare minimum
  • no more render timers and checking render times in favor of throttling from both ipyevents and ipywdigets (see Kitware/ipyvtklink#3 and linked PRs)
  • working to improve the canvas layout (see Kitware/ipyvtklink#2)

Unable to package SlicerJupyter

Hi,

I added SlicerJupyter to SlicerCAT and I was able to build it but when I run CPack I get an error:

...
CPack: - Run preinstall target for: CTK
CPack: - Install project: CTK []
CPack: - Run preinstall target for: Slicer
CPack: - Install project: Slicer []
CMake Error at ~/Documents/Colada/d/Slicer-build/E/SlicerJupyter/cmake_install.cmake:50 (file):
  file INSTALL cannot find "///proc/sys/fs/binfmt_misc/register": Permission
  denied.

GIT Tag: b282a2c
Ubuntu 20.04

SlicerJupyter documentation on functions.

Hi! I would like to use SlicerJupyter to display images from jupyter notebook, have them labeled in the editor in Slicer and save the mask as .tiff also using commands from python.

I cannot seem to find documentation on what functions I should use to have it work.

Thanks

Already used connection error

From @jcfr: "At some point I got an already used connection message ... but I am not able to reproduce it yet."

When user requests a kernel restart or Jupyter determines that the kernel is dead then, Jupyter sends a server stop request to Slicer. If Slicer is busy (in the middle of a long computation) then Jupyter kills the process - which is actually just the launcher, so not SlicerApp-real keeps running, still using the server port.

Maybe the kernelspec could be changed so that SlicerApp-real is launched directly?

Slicer Kernel cannot start

Hi everyone,

I am facing the issue of "unable to start kernel for slicer" , giving logs as

Switch to module:  "Welcome"
Loading Slicer RC file [/home/sliceruser/.slicerrc.py]
Jupyter connection file: [/home/sliceruser/.local/share/jupyter/runtime/kernel-2c7279ff-433a-43c2-88d2-f15696ba54fb.json]
error: [/home/sliceruser/Slicer/bin/SlicerApp-real] exit abnormally - Report the problem.

I am running docker image for 3D slicer
docker run -p 8888:8888 -p49053:49053 -v "$PWD":/home/sliceruser/work --rm -ti lassoan/slicer-notebook:2021-10-15-b3077c2
It works fine on my local machine (windows) and I am able to use 3D slicer via Jupiter notebook.
However, its not working on my remote VM (Ubuntu 18.04). Whenever, I try to open Slicer in notebook, it prompts message "kernel appear to die and restart automatically" but never succeed to start.
Any guidance would be great.
Here is image attached of logs
image

Thanks

Slicer kernel cannot start

After installing the 4.10 Slicer kernel successfully (as indicated by the text within the JupyterKernel extension), I tried to select the kernel in jupyter.
It begins to start, and then gives me this error message:

Jupyter connection file: [/home/emclab/.local/share/jupyter/runtime/kernel-5c44bbb4-9b6a-4bf7-9861-bcc42feaa7eb.json]
error: [/home/emclab/Downloads/InstalledSoftware/Slicer/bin/SlicerApp-real] exit abnormally - Report the problem. 

Investigating a little bit, I was also unable to run SlicerApp-real directly when navigating to it from a terminal. It does not start and exits with the error message:
./SlicerApp-real: error while loading shared libraries: libqSlicerApp.so: cannot open shared object file: No such file or directory

I'm not sure that that test means anything because I suspect I'm not meant to run SlicerApp-real directly from a command line. I am using the stable binary release downloaded off of the Slicer website today

In any case there is an error with the kernel setup and I cannot run a jupyter notebook using the Slicer kernel.

Windows build error

Build fails on Windows (on the second run, it succeeds).

The error message refers to ipython requiring pygments and jedi, which is odd, because we don't need ipython and we install both pygments and jedi.

python-jedi.log

  Creating directories for 'python-jedi'
  Building Custom Rule C:/D/SlicerJupyter/CMakeLists.txt
  No download step for 'python-jedi'
  No update step for 'python-jedi'
  No patch step for 'python-jedi'
  Generate version-python-jedi.txt and license-python-jedi.txt
  fatal: not a git repository (or any of the parent directories): .git
  CMake Warning (dev) at C:/D/SlicerJupyter_R/CMakeFiles/python-jedi-generate-project-description.cmake:69 (message):
    python-jedi: Could not find a license file
  This warning is for project developers.  Use -Wno-dev to suppress it.
  
  No configure step for 'python-jedi'
  No build step for 'python-jedi'
  Performing install step for 'python-jedi'
  Collecting jedi==0.17.0
    Using cached jedi-0.17.0-py2.py3-none-any.whl (1.1 MB)
  Collecting parso>=0.7.0
    Using cached parso-0.7.0-py2.py3-none-any.whl (100 kB)
CUSTOMBUILD : error : ipython 7.14.0 requires pygments, which is not installed.
  Installing collected packages: parso, jedi
  Successfully installed jedi-0.17.0 parso-0.7.0
CUSTOMBUILD : warning : You are using pip version 20.0.2; however, version 20.1 is available.
  You should consider upgrading via the 'C:\D\S4R\python-install\bin\python.exe -m pip install --upgrade pip' command.
  Completed 'python-jedi'

python-pygments.log

  Creating directories for 'python-pygments'
  Building Custom Rule C:/D/SlicerJupyter/CMakeLists.txt
  No download step for 'python-pygments'
  No update step for 'python-pygments'
  No patch step for 'python-pygments'
  Generate version-python-pygments.txt and license-python-pygments.txt
  fatal: not a git repository (or any of the parent directories): .git
  CMake Warning (dev) at C:/D/SlicerJupyter_R/CMakeFiles/python-pygments-generate-project-description.cmake:69 (message):
    python-pygments: Could not find a license file
  This warning is for project developers.  Use -Wno-dev to suppress it.
  
  No configure step for 'python-pygments'
  No build step for 'python-pygments'
  Performing install step for 'python-pygments'
  Collecting pygments==2.3.1
    Using cached Pygments-2.3.1-py2.py3-none-any.whl (849 kB)
CUSTOMBUILD : error : ipython 7.14.0 requires jedi>=0.10, which is not installed.
  Installing collected packages: pygments
CUSTOMBUILD : warning : The script pygmentize.exe is installed in 'C:\D\SlicerJupyter_R\python-packages-install\Scripts' which is not on PATH.
    Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  Successfully installed pygments-2.3.1
CUSTOMBUILD : warning : You are using pip version 20.0.2; however, version 20.1 is available.
  You should consider upgrading via the 'C:\D\S4R\python-install\bin\python.exe -m pip install --upgrade pip' command.
  Completed 'python-pygments'

Add JupyterLab debugger support

xeus-python kernel supports debugging, but it it currently not supported in the Slicer kernel.

The issue is that the application hangs when the debugger is attached, because a message that comes in the control channel would need to be processed in the main thread, but Slicer processes all messages (including the ones coming from the control channel) on the main thread.

See more information here: jupyter-xeus/xeus-python#275

Missing version on configure file path

Hi Guys, I've tried to figure this one out with no success.
I am building a custom app with SlicerCAT.
The path on lines 75 and similarly below are missing the last bit with the version, looks like ${Slicer_VERSION} is evaluating to an empty string.

Many features missing in Jupyter terminal

I opened a terminal as follows:

image

On the terminal, the following features are missing:

  • tab completion
  • arrows
  • navigation by home/end keys

As you may realize-- I have to type every single folder name to be able to move around on this terminal which is really difficult.

nightly version cant install packages

Hi! We are trying to integrate slicer and pytorch and some other packages. There is no way we can get PyTorch or any other package to install through the interpreter. Interestingly, the interpreter tells me that slicer runs in my base environment where I do have the packages I need, but it fails to import them.

We have installed the nightly version because we need python 3, but when trying to do.

`import pip

pip.main(['install', 'scipy']) `

We get "AttributeError: module 'pip' has no attribute 'main'".

Could anyone help?

Automate installation of kernel file

Instead of asking the user to explicitly call jupyter-kernelspec install, we should ask the user to select a python installation.

The Slicer module would then take care of:

  • creating a virtual environment (using venv for regular python, and conda env for anaconda ...)
  • installing jupyter
  • installing the Slicer kernel

Slicer kernel should be named using a convention like this one: Slicer X.Y.Z[-YYYY-MM-DD-rNNNN]

Build tree and install tree should be supported

Missing SlicerJupyter

Hello,
I would like to use SlicerJupyter for a project, but I can't install the latest version.
I am using Ubuntu 20.04 and Slicer-4.11.20210226. I have tried both ways for downloading the extension:

  1. Extension Manager - I got the following error No extensions found for linux:64-bit, revision: '29738'. Please try a different combination
  2. Manually - I followed this link https://www.slicer.org/wiki/Documentation/Nightly/SlicerApplication/ExtensionsManager#How_to_manually_download_an_extension_package.3F and No extensions found message was displayed.

I am only able to install SlicerJupyter on Slicer revision = 27567, which is too old for me.
What am I doing wrong? Could you help me, please?
Do you have SliceJupyter for Linux Slicer-4.11.20210226?

Many thanks for considering my request.

Usage Instructions are confusing

Under Option 2, I don't understand the purpose of bullets 3, 4, and 5. Why tell the user to install python and jupyter when ultimately it will be the Slicer-provided python interpreter and Slicer-provided jupyter kernel that are used?

I am raising this issue because after following the instructions I thought SlicerJupyter was using the environment I installed and was frustrated when it couldn't access my packages. If I now understand correctly, then these instructions are just a way to give the user a GUI to manage their notebooks. If the user already has a Python env with jupyter installed -- which is probably true for everyone interested in SlicerJupyter -- then couldn't they simply use that?

The command to install the kernel copied to clipboard can be changed to {path_to_Slicer}/bin/PythonSlicer -m jupyter kernelspec install {...} and the user can be told to run it from any console. This can appear earlier in the instructions.

Then the instructions to run the jupyter notebook server could be as simple as: "Run a jupyter notebook server from one of your other Python environments like Anaconda or Jupyter Lab. If you don't have another Python environment then use ./PythonSlicer -m jupyter notebook" (except I couldn't get the latter to work! See below).

{And then continue with instructions on how to open a notebook with the correct kernel}

I admit my understanding of Python interpreters, jupyter kernels, jupyter notebook server and their interactions is rather basic. There's a good chance I'm misunderstanding how this is supposed to work.


I couldn't get ./PythonSlicer -m jupyter notebook to work. It returned an esoteric error:

File "/media/chad/STORE/Tools/Neurophys/Slicer-4.11.0-2020-06-06-linux-amd64/lib/Python/lib/python3.6/site-packages/prometheus_client/exposition.py", line 9, in
from wsgiref.simple_server import make_server, WSGIServer, WSGIRequestHandler
ModuleNotFoundError: No module named 'wsgiref.simple_server'

This returned no relevant search results. 'wsgiref.simple_server' is a core Python module so I'm guessing that PythonSlicer doesn't ship with a full set of modules. Maybe it should include the modules necessary to run jupyter server?

Slicer python command does nothing in Slicer Notebook

Hello! I am trying to display slice views with a particular markup control point.
I am using this function:

slicer.modules.markups.logic().JumpSlicesToLocation(ras[0], ras[1], ras[2], True)

The function runs without any problems in the Jupiter notebook but when I am trying to display it (slicernb.ViewDisplay('FourUp')) there are no changes.

If I run the function in Slicer's python console, it jumps to the location right away.
How could I get this to display in the notebook?

Untitled

Binder improvement ideas

Issue to collect ideas/notes for SlicerJupyter+binder.

Easy:

  • set up automatic update of the docker image, after #5
  • make the Slicer window full-screen in the virtual X window. Right now the images captured by display() reflect the size of the running virtual display, which is about 1/4 of the 1280x1024 screen, so they are usually much smaller than the saved image when a notebook is re-run. The “awesome” window manager I'm using can be controlled with Lua, so if this can’t be done directly in Slicer/Qt, then it could be applied to the window in a launcher script.
  • clean up slicer2binder Dockerfile
    • move the Slicer dependencies to a separate docker stage
    • move Dockerfile to Slicer org, maybe de-dup with Steve's and Matt's
  • make virtual X display size configurable, right now it is kind of hard-coded in xorg.conf

Maybe easy:

Hard:

  • make kernel start faster! Obviously this is a big/general issue. It's one reason I initially started trying to build against musl libc, but ran in to various problems - mostly with Python and VTK (ITK does build against musl). Not sure if @cpinter had any luck with the static build, but that might help.

Speculative:

  • hide the slider handles in screenshots, could be confusing to users. Not sure if that's possible in Qt.

Kernel doesn't start

After creating a notebook with Slicer 4.11, the kernel dies and keeps restarting without success. Below is the log i get. During this process a new instance of 3DSlicer is opened and then closed immediately.
I tried deleting my settings folder ( .config/NA-MIC ) and reinstalling the extension as well as re-downloading 3DSlicer but same thing happens. I'm not an expert at programming so comprehensive help would be much appreciated.

platform: Slicer-4.11.20200930-linux-amd64 r29402

[I 09:38:25.441 NotebookApp] Kernel started: 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee, name: slicer-4.11
Switch to module:  "Welcome"
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:38:40.443 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
Switch to module:  "Welcome"
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:38:55.472 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
Switch to module:  "Welcome"
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:39:10.495 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
Switch to module:  "Welcome"
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:39:25.520 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
[W 09:39:25.551 NotebookApp] Timeout waiting for kernel_info reply from 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
[W 09:39:30.091 NotebookApp] Nudge: attempt 10 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
[W 09:39:35.122 NotebookApp] Nudge: attempt 20 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
Switch to module:  "Welcome"
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[W 09:39:40.147 NotebookApp] Nudge: attempt 30 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
[I 09:39:40.532 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee restarted
[W 09:39:45.174 NotebookApp] Nudge: attempt 40 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
[W 09:39:50.203 NotebookApp] Nudge: attempt 50 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
Switch to module:  "Welcome"
[W 09:39:55.229 NotebookApp] Nudge: attempt 60 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:39:58.544 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee restarted
[W 09:40:00.255 NotebookApp] Nudge: attempt 70 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
[W 09:40:05.283 NotebookApp] Nudge: attempt 80 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
[W 09:40:10.314 NotebookApp] Nudge: attempt 90 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
Switch to module:  "Welcome"
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:40:13.572 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee restarted
[W 09:40:15.351 NotebookApp] Nudge: attempt 100 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
[W 09:40:20.380 NotebookApp] Nudge: attempt 110 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
[I 09:40:25.326 NotebookApp] Saving file at /Untitled Folder/Untitled5.ipynb
[W 09:40:25.406 NotebookApp] Nudge: attempt 120 on kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee
[E 09:40:25.569 NotebookApp] Uncaught exception GET /api/kernels/3acaca7f-c1d7-4b80-9791-3e4224e1e9ee/channels?session_id=90c231b255574bad9283ee221e2b03d4 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8891', method='GET', uri='/api/kernels/3acaca7f-c1d7-4b80-9791-3e4224e1e9ee/channels?session_id=90c231b255574bad9283ee221e2b03d4', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/tornado/websocket.py", line 956, in _accept_connection
        await open_result
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/asyncio/futures.py", line 327, in __iter__
        yield self  # This tells Task to wait for completion.
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
        future.result()
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/asyncio/futures.py", line 243, in result
        raise self._exception
    tornado.util.TimeoutError: Timeout
Switch to module:  "Welcome"
[W 09:40:26.603 NotebookApp] Replacing stale connection: 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee:90c231b255574bad9283ee221e2b03d4
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:40:28.608 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee restarted
[E 09:40:28.609 NotebookApp] KernelRestarter: restart callback <bound method ZMQChannelsHandler.on_kernel_restarted of ZMQChannelsHandler(3acaca7f-c1d7-4b80-9791-3e4224e1e9ee)> failed
    Traceback (most recent call last):
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/jupyter_client/restarter.py", line 86, in _fire_callbacks
        callback()
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/notebook/services/kernels/handlers.py", line 601, in on_kernel_restarted
        self._send_status_message('restarting')
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/notebook/services/kernels/handlers.py", line 597, in _send_status_message
        self.write_message(json.dumps(msg, default=date_default))
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/tornado/websocket.py", line 337, in write_message
        raise WebSocketClosedError()
    tornado.websocket.WebSocketClosedError
Switch to module:  "Welcome"
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:40:46.636 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee restarted
[E 09:40:46.637 NotebookApp] KernelRestarter: restart callback <bound method ZMQChannelsHandler.on_kernel_restarted of ZMQChannelsHandler(3acaca7f-c1d7-4b80-9791-3e4224e1e9ee)> failed
    Traceback (most recent call last):
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/jupyter_client/restarter.py", line 86, in _fire_callbacks
        callback()
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/notebook/services/kernels/handlers.py", line 601, in on_kernel_restarted
        self._send_status_message('restarting')
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/notebook/services/kernels/handlers.py", line 597, in _send_status_message
        self.write_message(json.dumps(msg, default=date_default))
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/tornado/websocket.py", line 337, in write_message
        raise WebSocketClosedError()
    tornado.websocket.WebSocketClosedError
Switch to module:  "Welcome"
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:41:04.676 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee restarted
[E 09:41:04.677 NotebookApp] KernelRestarter: restart callback <bound method ZMQChannelsHandler.on_kernel_restarted of ZMQChannelsHandler(3acaca7f-c1d7-4b80-9791-3e4224e1e9ee)> failed
    Traceback (most recent call last):
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/jupyter_client/restarter.py", line 86, in _fire_callbacks
        callback()
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/notebook/services/kernels/handlers.py", line 601, in on_kernel_restarted
        self._send_status_message('restarting')
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/notebook/services/kernels/handlers.py", line 597, in _send_status_message
        self.write_message(json.dumps(msg, default=date_default))
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/tornado/websocket.py", line 337, in write_message
        raise WebSocketClosedError()
    tornado.websocket.WebSocketClosedError
Switch to module:  "Welcome"
Jupyter connection file: [/home/raouf/.local/share/jupyter/runtime/kernel-3acaca7f-c1d7-4b80-9791-3e4224e1e9ee.json]
error: [/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.
[I 09:41:19.715 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel 3acaca7f-c1d7-4b80-9791-3e4224e1e9ee restarted
[E 09:41:19.716 NotebookApp] KernelRestarter: restart callback <bound method ZMQChannelsHandler.on_kernel_restarted of ZMQChannelsHandler(3acaca7f-c1d7-4b80-9791-3e4224e1e9ee)> failed
    Traceback (most recent call last):
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/jupyter_client/restarter.py", line 86, in _fire_callbacks
        callback()
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/notebook/services/kernels/handlers.py", line 601, in on_kernel_restarted
        self._send_status_message('restarting')
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/notebook/services/kernels/handlers.py", line 597, in _send_status_message
        self.write_message(json.dumps(msg, default=date_default))
      File "/home/raouf/Documents/Tools/Slicer-4.11.20200930-linux-amd64/lib/Python/lib/python3.6/site-packages/tornado/websocket.py", line 337, in write_message
        raise WebSocketClosedError()
    tornado.websocket.WebSocketClosedError
Switch to module:  "Welcome"

Implement auto-complete

If user presses Tab key, auto-completion should be performed. Currently it just performs some hardcoded character replacement.

xSlicerInterpreter::complete_request_impl needs to be implemented properly. Probably the Python console needs to provide auto-complete feature, which this interpreter class can use.

Shutdown all Slicer Jupyter kernels???

slicer.util._executePythonModule('jupyter', ['notebook', 'list'])
Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
  File "/Applications/Slicer.app/Contents/bin/../lib/Python/lib/python3.6/site.py", line 553, in <module>
    main()
  File "/Applications/Slicer.app/Contents/bin/../lib/Python/lib/python3.6/site.py", line 539, in main
    known_paths = addusersitepackages(known_paths)
  File "/Applications/Slicer.app/Contents/bin/../lib/Python/lib/python3.6/site.py", line 282, in addusersitepackages
    user_site = getusersitepackages()
  File "/Applications/Slicer.app/Contents/bin/../lib/Python/lib/python3.6/site.py", line 258, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/Applications/Slicer.app/Contents/bin/../lib/Python/lib/python3.6/site.py", line 248, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python3.6/sysconfig.py", line 601, in get_config_var
    return get_config_vars().get(name)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python3.6/sysconfig.py", line 550, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python3.6/sysconfig.py", line 421, in _init_posix
    _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata_m_darwin_darwin'
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
In  [10]:
Line 1:     

File /Applications/Slicer.app/Contents/bin/Python/slicer/util.py, in _executePythonModule:
Line 2851:  logProcessOutput(proc)

File /Applications/Slicer.app/Contents/bin/Python/slicer/util.py, in logProcessOutput:
Line 2820:  raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)

CalledProcessError: Command '['/Applications/Slicer.app/Contents/bin/../bin/PythonSlicer', '-m', 'jupyter', 'notebook', 'list']' returned non-zero exit status 1.

can't run notebook with PythonSlicer (missing wsgi package)

It would be more convenient if we could run the jupyter notebook directly out of slicer. It would mean we could automate some of the installation steps to make it easier to use for training purposes (other modes could still be supported for developers)

I was able to do pip_install('jupyter') inside slicer, but when I tried to run the notebook it fails with a missing python package, even though it should be a standard part of the Slicer python package (https://docs.python.org/3.6/library/wsgiref.html).

$ /Volumes/SSD2T/ssdtmp/Slicer.app/Contents/bin/PythonSlicer /Volumes/SSD2T/ssdtmp/Slicer.app/Contents/lib/Python/lib/python3.6/site-packages/jupyter.py notebook
Traceback (most recent call last):
  File "/Volumes/SSD2T/ssdtmp/Slicer.app/Contents/lib/Python/bin/jupyter-notebook", line 5, in <module>
    from notebook.notebookapp import main
  File "/Volumes/SSD2T/ssdtmp/Slicer.app/Contents/lib/Python/lib/python3.6/site-packages/notebook/notebookapp.py", line 76, in <module>
    from .base.handlers import Template404, RedirectWithParams
  File "/Volumes/SSD2T/ssdtmp/Slicer.app/Contents/lib/Python/lib/python3.6/site-packages/notebook/base/handlers.py", line 24, in <module>
    import prometheus_client
  File "/Volumes/SSD2T/ssdtmp/Slicer.app/Contents/lib/Python/lib/python3.6/site-packages/prometheus_client/__init__.py", line 3, in <module>
    from . import exposition
  File "/Volumes/SSD2T/ssdtmp/Slicer.app/Contents/lib/Python/lib/python3.6/site-packages/prometheus_client/exposition.py", line 11, in <module>
    from wsgiref.simple_server import make_server, WSGIRequestHandler
ModuleNotFoundError: No module named 'wsgiref'

Update to use xeus-python

It may be interesting to update to the latest xeus and use xeus-python for the SlicerJupyter kernel.

  • This should bring richer tracebacks, widget support, rich mime type rendering.
  • This would remove the need for cryptopp for signing messages as we now use OpenSSL which is already a dependency of Slicer.
  • The xeus project, together with xeus-python and xeus-cling are moving under the Jupyter governance to their own organization. The JEP for incorporation was merged a couple of days ago.
  • xeus-python implements now the debug adaptor protocol and is the current backend to the JupyterLab visual debugger: https://github.com/jupyterlab/debugger.

Kernel gets installed but does not shows up in the jupyter notebook

I can successfully install the kernel after running
jupyter-kernelspec install /home/username/.config/NA-MIC/Extensions-27968/SlicerJupyter/share/Slicer-4.11/qt-loadable-modules/JupyterKernel/Slicer-4.11/ --replace --user
and I get the [InstallKernelSpec] Installed kernelspec slicer-4.11 in /home/username/.local/share/jupyter/kernels/slicer-4.11 message indicating my kernel installation is sucessful.

However, when I run the jupyter notebook I don't see the kernel, and when I run jupyter kernelspec list I don't see the kernel there neither.

I'm using Ubuntu 16.04 and Slicer 4.11.0-2019-02-19 r27968, and anaconda virtual environment

Help me! Update plane from fiducial points...How can I aligne the red plane with Coordinate axis?

# Update plane from fiducial points
def UpdateSlicePlane(data):
  a = data
  points = np.array([list(zip(*a))])[0]
#     b2 = np.array([list(zip(*a))])
  sliceNode = slicer.app.layoutManager().sliceWidget("Red").mrmlSliceNode()
  planePosition = points.mean(axis=1)
  planeNormal = np.cross(points[:,1] - points[:,0], points[:,2] - points[:,0])
  planeX = points[:,1] - points[:,0]
  sliceNode.SetSliceToRASByNTP(planeNormal[0], planeNormal[1], planeNormal[2],
    planeX[0], planeX[1], planeX[2],
    planePosition[0], planePosition[1], planePosition[2], 0)

UpdateSlicePlane(data33)
slicernb.ViewDisplay('OneUpRedSlice', center=False)

下载

我想将图片对齐,就像这样:

I want aligne the red plane with Coordinate axis?, like that:

image

Update CryptoPP

Current version is from August 6 2018, see weidai11/cryptopp@2ec9c99 and

ExternalProject_SetIfNotDefined(
${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY
"${EP_GIT_PROTOCOL}://github.com/weidai11/cryptopp.git"
QUIET
)
ExternalProject_SetIfNotDefined(
${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG
# origin/master is changing (and CMake build breaking) too frequently, therefore we need to use specific git hash or tag instead
2ec9c9963c6ca58e8c764cc64b28fdb52eca28d7
QUIET
)

See jupyter-xeus/xeus#103 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.