Run Python Script on Slicer Using Bash Command

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Run Python Script on Slicer Using Bash Command

chasinggoals
Hi there!

I am trying to run some a piece of Python Script through Terminal of my mac.
I asked my friend who used windows and she provided me a piece of code below
in Windows Command Line:

Slicer.exe   --no-main-window   --python-script  [path_python_script]
argv[1] argv[2] argv[3]  

However, I could really find a similar thing in Mac. I am wondering if
anyone can help me out!

Thank you!



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Run-Python-Script-on-Slicer-Using-Bash-Command-tp4030428.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Run Python Script on Slicer Using Bash Command

Jean-Christophe Fillion-Robin
Hi Weiyao,

On Mac, you would something like this:

./Slicer.app/Contents/MacOS/Slicer --python-script [path_python_script] argv[1] argv[2] argv[3]

Hth
Jc


On Tue, May 10, 2016 at 3:09 PM, chasinggoals <[hidden email]> wrote:
Hi there!

I am trying to run some a piece of Python Script through Terminal of my mac.
I asked my friend who used windows and she provided me a piece of code below
in Windows Command Line:

Slicer.exe   --no-main-window   --python-script  [path_python_script]
argv[1] argv[2] argv[3]

However, I could really find a similar thing in Mac. I am wondering if
anyone can help me out!

Thank you!



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Run-Python-Script-on-Slicer-Using-Bash-Command-tp4030428.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ



--
+1 919 869 8849

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Run Python Script on Slicer Using Bash Command

Jean-Christophe Fillion-Robin
In reply to this post by chasinggoals

Dear Weiyao,

(( re-adding the user list in cc ))

Could you try with the latest nightly build and check if there still an issue ?

See http://download slicer.org

If the issue still happen, it means there is a probably a problem with the packaging on MacOSX. If it is the case, could you create a bug report ?

Thanks for your help,
Jc

On Tue, May 10, 2016 at 8:51 PM, Weiyao Wang <[hidden email]> wrote:
Dear JC,

Thank you for the help! Unfortunately, I am confused by the error message suggesting that the library below is not loaded:
/Users/kitware/Dashboards/Package/Slicer-450-package/ITKv4-build/lib/libITKIOBMP-4.8.1.dylib
I realized that I do not have a kitware directory in my computer. I am wondering if there is anyway I can install such a thing.

Thank you!

Best Wishes,
Weiyao

在 2016年5月10日,下午4:50,Jean-Christophe Fillion-Robin <[hidden email]> 写道:

Hi Weiyao,

On Mac, you would something like this:

./Slicer.app/Contents/MacOS/Slicer --python-script [path_python_script] argv[1] argv[2] argv[3]

Hth
Jc


On Tue, May 10, 2016 at 3:09 PM, chasinggoals <[hidden email]> wrote:
Hi there!

I am trying to run some a piece of Python Script through Terminal of my mac.
I asked my friend who used windows and she provided me a piece of code below
in Windows Command Line:

Slicer.exe   --no-main-window   --python-script  [path_python_script]
argv[1] argv[2] argv[3]

However, I could really find a similar thing in Mac. I am wondering if
anyone can help me out!

Thank you!



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Run-Python-Script-on-Slicer-Using-Bash-Command-tp4030428.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ



--
<a href="tel:%2B1%20919%20869%208849" value="&#43;19198698849" target="_blank">+1 919 869 8849




--
<a href="tel:%2B1%20919%20869%208849" value="&#43;19198698849" target="_blank">+1 919 869 8849

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Run Python Script on Slicer Using Bash Command

Steve Pieper-2
Hi Weiyao -

I see those messages too - it's something to do with the way plugin file reader/writer code is being packaged on mac.  I believe you can ignore them and Slicer will work as expected.

But please do file an issue report as Jc suggested.  These messages are annoying and should be cleaned up sometime.

Thanks,
Steve

On Wed, May 11, 2016 at 10:15 AM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:

Dear Weiyao,

(( re-adding the user list in cc ))

Could you try with the latest nightly build and check if there still an issue ?

See http://download slicer.org

If the issue still happen, it means there is a probably a problem with the packaging on MacOSX. If it is the case, could you create a bug report ?

Thanks for your help,
Jc

On Tue, May 10, 2016 at 8:51 PM, Weiyao Wang <[hidden email]> wrote:
Dear JC,

Thank you for the help! Unfortunately, I am confused by the error message suggesting that the library below is not loaded:
/Users/kitware/Dashboards/Package/Slicer-450-package/ITKv4-build/lib/libITKIOBMP-4.8.1.dylib
I realized that I do not have a kitware directory in my computer. I am wondering if there is anyway I can install such a thing.

Thank you!

Best Wishes,
Weiyao

在 2016年5月10日,下午4:50,Jean-Christophe Fillion-Robin <[hidden email]> 写道:

Hi Weiyao,

On Mac, you would something like this:

./Slicer.app/Contents/MacOS/Slicer --python-script [path_python_script] argv[1] argv[2] argv[3]

Hth
Jc


On Tue, May 10, 2016 at 3:09 PM, chasinggoals <[hidden email]> wrote:
Hi there!

I am trying to run some a piece of Python Script through Terminal of my mac.
I asked my friend who used windows and she provided me a piece of code below
in Windows Command Line:

Slicer.exe   --no-main-window   --python-script  [path_python_script]
argv[1] argv[2] argv[3]

However, I could really find a similar thing in Mac. I am wondering if
anyone can help me out!

Thank you!



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Run-Python-Script-on-Slicer-Using-Bash-Command-tp4030428.html
Sent from the slicer-users mailing list archive at Nabble.com.
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ



--
<a href="tel:%2B1%20919%20869%208849" value="&#43;19198698849" target="_blank">+1 919 869 8849




--
<a href="tel:%2B1%20919%20869%208849" value="&#43;19198698849" target="_blank">+1 919 869 8849

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Run Python Script on Slicer Using Bash Command

Steve Pieper-2
In reply to this post by Jean-Christophe Fillion-Robin
Hi Weiyao - 

[ Let's keep the mailing list in the cc' so others can participate too ]

I think the error is exactly what it says - that module probably needs a full 3D volume to work.  You might be able to fake it by making copies of the file as image1.tiff, image2.tiff, image3.tiff and then loading them in slicer and saving again maybe as a nrrd file.

Best,
Steve

On Thu, May 12, 2016 at 6:38 PM, Weiyao Wang <[hidden email]> wrote:
Dear Steve,

Thank you for your help! I tried with tiff files, and one part worked. However, I kept getting an error message from command window and my mac gives me error message indicating there is something wrong with Slicer. The error message is attached below. I’ve also attached my code, wondering if there is anything wrong with my code or is my DICOM input simply bad input. The command line is [path for Slicer] —python-script [path for python script] [path for input dicom file] [path for filter file to save as] [path for original volume to be saved as].

Mask no read.  Creaing Otsu mask.

 

A spacing of 0 is not allowed: Spacing is [476.25, 476.25, 0]





N4ITK MRI Bias correction returned 1 which probably indicates an error.



cannot write ImageData, it's NULL

Thank you so much for the help!

Best Wishes,
Weiyao


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/4.3/FAQ