# Swiss Skull Stripper: troubles invoking from python console

**URL:** https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305
**Category:** Development
**Tags:** segmentation, swissskullstripper
**Created:** [May 13, 2017, 3:37pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305 "2017-05-13T15:37:28Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![drAl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dral/32/176_2.png) [@drAl](https://discourse.slicer.org/u/drAl)
#### Post date: [May 13, 2017, 3:37pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/1 "2017-05-13T15:37:28Z")

</div>

Hi everyone!

I’m trying to run the Swiss Skull Stripper from script and I’m getting this error every time:

* * *

"Swiss Skull Stripper standard error:

Exception caught !

itk::ImageFileReaderException (0000001D6C5BD080)  
Location: "unknown"  
File: c:\d\p\slicer-462-package\itkv4\modules\io\imagebase\include\itkImageFileReader.hxx  
Line: 87  
Description: FileName must be specified

* * *

I’m trying to figure out if there’s an error with parameters when invoking the module. I’m using this (in this order):  
’’‘  
parameters = {}  
1. "atlasImage"  
2. "atlasMask"  
3. “patientVolume” 3  
4. “patientOutputVolume” 4  
5. “patientMaskLabel” 5  
’’'  
I’m running the module:  
sss = slicer.modules.swissskullstripper  
return (slicer.cli.run(sss, None, parameters))

Anyone have any idea!?

Thanks in advance!! 😃

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [May 13, 2017, 4:05pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/2 "2017-05-13T16:05:27Z")

</div>

One of the required inputs are not specified in `parameters` variable, probably because you use incorrect parameter name. Parameter names can be printed using the script here: [https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python\_scripting#Running\_a\_CLI\_from\_Python](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#Running_a_CLI_from_Python)

Parameter (0/0): **atlasMRIVolume** (Atlas Volume)  
Parameter (0/1): **atlasMaskVolume** (Atlas Mask Volume)  
Parameter (1/0): **patientVolume** (Patient Volume)  
Parameter (2/0): **patientOutputVolume** (Patient Output Volume)  
Parameter (2/1): **patientMaskLabel** (Patient Mask Label)

---

<div class="post-metadata">

### Author: ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)
#### Post date: [May 13, 2017, 4:26pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/3 "2017-05-13T16:26:50Z")

</div>

Sometimes I get itkImageFileReader error in Linux because:

- The path or the file name contains spaces or special characters.
- Don’t have permission to access the file.  
Good luck!

---

<div class="post-metadata">

### Author: ![drAl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dral/32/176_2.png) [@drAl](https://discourse.slicer.org/u/drAl)
#### Post date: [May 13, 2017, 4:48pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/4 "2017-05-13T16:48:34Z")

</div>

Thanks for answering!!

that is the piece of code I’m using, but still not working!

I get your point, though. I’m loading/creating this four parameters (atlasMRIVolume, atlasMaskVolume, patientOutputVolume and patientMaskLabel) but for the patient volume I am just getting the ID:

(parameters[“patientVolume”] = volumeNode.GetID())

I don’t know if (maybe) I should perform any other instruction before setting this volume to the parameters.

Do you know where can I find documentation about swiss skull stripping module?

I’ll keep trying 🙂

Again thanks for tip 👍

---

<div class="post-metadata">

### Author: ![drAl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dral/32/176_2.png) [@drAl](https://discourse.slicer.org/u/drAl)
#### Post date: [May 13, 2017, 4:49pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/5 "2017-05-13T16:49:50Z")

</div>

hey!! Thanks brhoom!

I’ll double check the syntaxis again 🙂

thankks!! 👍

---

<div class="post-metadata">

### Author: ![drAl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dral/32/176_2.png) [@drAl](https://discourse.slicer.org/u/drAl)
#### Post date: [May 17, 2017, 4:29pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/6 "2017-05-17T16:29:38Z")

</div>

Hi again!!

So after almost a week…I haven’t been able to invoke the module without an error.

Does anyone know where can I found some documentation about the skull stripper or the swiss skull stripper?? I would really appreciate it.

Another way to find out what I need (what to pass as to the function!!!) would be to read the source code of the swissskullstripper module. Any idea how to do that???

\<\>Desperate ☹ \<\>

Thank you all!

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [May 17, 2017, 7:00pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/7 "2017-05-17T19:00:23Z")

</div>

We’ve updated SkullStripper, it should be very easy to use now.

Slicer [download page doesn’t show the latest version](https://discourse.slicer.org/t/its-2017-05-16-nightly-build-is-still-2017-05-09/323/7) so you have to download the latest version of Slicer from the dashboard (small yellow icon in the Build Name column): [http://slicer.cdash.org/index.php?project=Slicer4](http://slicer.cdash.org/index.php?project=Slicer4)

---

<div class="post-metadata">

### Author: ![drAl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dral/32/176_2.png) [@drAl](https://discourse.slicer.org/u/drAl)
#### Post date: [May 17, 2017, 7:24pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/8 "2017-05-17T19:24:53Z")

</div>

> [@lassoan](#):
>
> Slicer download page doesn’t show the latest version so you have to download the latest version of Slicer from the dashboard (small yellow icon in the Build Name column): [CDash](http://slicer.cdash.org/index.php)

wow!!  
Ok, I’ll update the Slicer.  
I’m trying to write a script for the python console: do you know what do I need to define and how to invoke (parameters needed) the skullstripper module 🙂 ???

Thanks in advance lassoan ☀

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [May 17, 2017, 7:54pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/9 "2017-05-17T19:54:00Z")

</div>

First use it from the GUI. Everything should be self-explaining. If not, then ask here.

If it works well, then follow [instructions for how to call a CLI from Python](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#Running_a_CLI_from_Python).

---

<div class="post-metadata">

### Author: ![drAl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dral/32/176_2.png) [@drAl](https://discourse.slicer.org/u/drAl)
#### Post date: [May 17, 2017, 8:29pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/10 "2017-05-17T20:29:50Z")

</div>

hi again!

I appreciate the guidance…I already tested the GUI -and the results are quite interesting. I’ve tested the stripping changing parameters for different sets of images and now I would like to set all this values from the command line. Thanks for linking again the “Running a CLI from Python” code. I assure you that I have almost learnt those lines…the problem is, as you might be already guessing, that the parameters required for the Skull Stripping are not “Input Volume” and “Output Geometry” (as shown in the linked example). That’s what I’m looking for…some kind of documentation about the use of this module.

Thanks lassoan. I really appreciate the time you’re taking to help me out. 💪 😉

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [May 17, 2017, 10:09pm UTC](https://discourse.slicer.org/t/swiss-skull-stripper-troubles-invoking-from-python-console/305/11 "2017-05-17T22:09:54Z")

</div>

> [@drAl](#):
>
> the problem is, as you might be already guessing, that the parameters required for the Skull Stripping are not “Input Volume” and “Output Geometry” (as shown in the linked example).

Hi,

If not already done, consider looking at the module documentation, you can find there some example of atlases:

[https://www.slicer.org/wiki/Documentation/Nightly/Modules/SwissSkullStripper](https://www.slicer.org/wiki/Documentation/Nightly/Modules/SwissSkullStripper)

Looking at the description of its parameters could also be helpful:

[SwissSkullStripperExtension/SwissSkullStripper/SwissSkullStripper.xml at master · lorensen/SwissSkullStripperExtension · GitHub](https://github.com/lorensen/SwissSkullStripperExtension/blob/master/SwissSkullStripper/SwissSkullStripper.xml)
