Saving volume as nii with Python script

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

Saving volume as nii with Python script

Matyas123
Hi all,
I am PhD student and I was asked to register a lot of mice brain MR images. I have made a simple script for that purpose, all works perfectly except i am unable to figure out how to save an image/volume using python.
(how to delete some nodes would be great also :) )  

Thanks in advance,
Matyas
Reply | Threaded
Open this post in threaded view
|

Re: Saving volume as nii with Python script

Jean-Christophe Fillion-Robin
Hi Matyas, 

There are methods like slicer.util.saveNode and slicer.util.saveScene


Hth
Jc


On Mon, Apr 22, 2013 at 11:36 AM, Matyas123 <[hidden email]> wrote:
Hi all,
I am PhD student and I was asked to register a lot of mice brain MR images.
I have made a simple script for that purpose, all works perfectly except i
am unable to figure out how to save an image/volume using python.
(how to delete some nodes would be great also :) )

Thanks in advance,
Matyas



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108.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



--
+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
Reply | Threaded
Open this post in threaded view
|

Re: Saving volume as nii with Python script

Jean-Christophe Fillion-Robin


On Mon, Apr 22, 2013 at 11:56 AM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:
Hi Matyas, 

There are methods like slicer.util.saveNode and slicer.util.saveScene


Hth
Jc


On Mon, Apr 22, 2013 at 11:36 AM, Matyas123 <[hidden email]> wrote:
Hi all,
I am PhD student and I was asked to register a lot of mice brain MR images.
I have made a simple script for that purpose, all works perfectly except i
am unable to figure out how to save an image/volume using python.
(how to delete some nodes would be great also :) )

Thanks in advance,
Matyas



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108.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



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



--
+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
Reply | Threaded
Open this post in threaded view
|

Re: Saving volume as nii with Python script

Julien Finet
I also added an entry in the IO section:
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/IO#How_to_save_files_programmatically

Julien.

On Mon, Apr 22, 2013 at 12:06 PM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:


On Mon, Apr 22, 2013 at 11:56 AM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:
Hi Matyas, 

There are methods like slicer.util.saveNode and slicer.util.saveScene


Hth
Jc


On Mon, Apr 22, 2013 at 11:36 AM, Matyas123 <[hidden email]> wrote:
Hi all,
I am PhD student and I was asked to register a lot of mice brain MR images.
I have made a simple script for that purpose, all works perfectly except i
am unable to figure out how to save an image/volume using python.
(how to delete some nodes would be great also :) )

Thanks in advance,
Matyas



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108.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



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



--
<a href="tel:%2B1%20919%20869%208849" value="+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


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Saving volume as nii with Python script

Matyas123
Dne 22.4.2013 18:14, Julien Finet [via slicer-users] napsal(a):
I also added an entry in the IO section:
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/IO#How_to_save_files_programmatically

Julien.

On Mon, Apr 22, 2013 at 12:06 PM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:


On Mon, Apr 22, 2013 at 11:56 AM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:
Hi Matyas, 

There are methods like slicer.util.saveNode and slicer.util.saveScene


Hth
Jc


On Mon, Apr 22, 2013 at 11:36 AM, Matyas123 <[hidden email]> wrote:
Hi all,
I am PhD student and I was asked to register a lot of mice brain MR images.
I have made a simple script for that purpose, all works perfectly except i
am unable to figure out how to save an image/volume using python.
(how to delete some nodes would be great also :) )

Thanks in advance,
Matyas



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108.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



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



--
<a href="tel:%2B1%20919%20869%208849" value="+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


_______________________________________________
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


If you reply to this email, your message will be added to the discussion below:
http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108p4026111.html
To unsubscribe from Saving volume as nii with Python script, click here.
NAML

Thank you very much. Its working fine now!
Reply | Threaded
Open this post in threaded view
|

Re: Saving volume as nii with Python script

Matyas123
Dne 23.4.2013 8:17, Matyas123 napsal(a):
Dne 22.4.2013 18:14, Julien Finet [via slicer-users] napsal(a):
I also added an entry in the IO section:
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/IO#How_to_save_files_programmatically

Julien.

On Mon, Apr 22, 2013 at 12:06 PM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:


On Mon, Apr 22, 2013 at 11:56 AM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:
Hi Matyas, 

There are methods like slicer.util.saveNode and slicer.util.saveScene


Hth
Jc


On Mon, Apr 22, 2013 at 11:36 AM, Matyas123 <[hidden email]> wrote:
Hi all,
I am PhD student and I was asked to register a lot of mice brain MR images.
I have made a simple script for that purpose, all works perfectly except i
am unable to figure out how to save an image/volume using python.
(how to delete some nodes would be great also :) )

Thanks in advance,
Matyas



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108.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



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



--
<a href="tel:%2B1%20919%20869%208849" value="+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


_______________________________________________
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


If you reply to this email, your message will be added to the discussion below:
http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108p4026111.html
To unsubscribe from Saving volume as nii with Python script, click here.
NAML

Thank you very much. Its working fine now!


View this message in context: Re: Saving volume as nii with Python script
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
Hi, I have tried it in hurry and it seemed it is OK. But now I see that I get error:

>>> slicer.util.saveNode(img_reg,output_path)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'saveNode'

img_reg is vtkMRMLScalarVolumeNode class. Am I missing something?

Thanks once more,
Matyas

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Saving volume as nii with Python script

Matyas123
Dne 23.4.2013 11:45, Matyáš kuhn napsal(a):
Dne 23.4.2013 8:17, Matyas123 napsal(a):
Dne 22.4.2013 18:14, Julien Finet [via slicer-users] napsal(a):
I also added an entry in the IO section:
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/IO#How_to_save_files_programmatically

Julien.

On Mon, Apr 22, 2013 at 12:06 PM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:


On Mon, Apr 22, 2013 at 11:56 AM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:
Hi Matyas, 

There are methods like slicer.util.saveNode and slicer.util.saveScene


Hth
Jc


On Mon, Apr 22, 2013 at 11:36 AM, Matyas123 <[hidden email]> wrote:
Hi all,
I am PhD student and I was asked to register a lot of mice brain MR images.
I have made a simple script for that purpose, all works perfectly except i
am unable to figure out how to save an image/volume using python.
(how to delete some nodes would be great also :) )

Thanks in advance,
Matyas



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108.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



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



--
<a href="tel:%2B1%20919%20869%208849" value="+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


_______________________________________________
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


If you reply to this email, your message will be added to the discussion below:
http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108p4026111.html
To unsubscribe from Saving volume as nii with Python script, click here.
NAML

Thank you very much. Its working fine now!


View this message in context: Re: Saving volume as nii with Python script
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
Hi, I have tried it in hurry and it seemed it is OK. But now I see that I get error:

>>> slicer.util.saveNode(img_reg,output_path)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'saveNode'

img_reg is vtkMRMLScalarVolumeNode class. Am I missing something?

Thanks once more,
Matyas
I have finally managed it, but i had to define "saveNode" function in my script once more. I just copied definition from https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/util.py#L229-267 and now its doing what i wanted. I don´t know why I have no access to this function through slicer.util. ...

Thanks for help

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Saving volume as nii with Python script

Jean-Christophe Fillion-Robin
Hi Matyáš, 

Could you share the code that fail to import "slicer.util" ? I would like to fix the root cause of the problem. Copying the function into your own code is definitively not the way to go.

Could you see remember me which version of Slicer you are using.

Thanks
Jc


On Tue, Apr 23, 2013 at 6:59 AM, Matyáš kuhn <[hidden email]> wrote:
Dne 23.4.2013 11:45, Matyáš kuhn napsal(a):
Dne 23.4.2013 8:17, Matyas123 napsal(a):
Dne 22.4.2013 18:14, Julien Finet [via slicer-users] napsal(a):
I also added an entry in the IO section:
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/IO#How_to_save_files_programmatically

Julien.

On Mon, Apr 22, 2013 at 12:06 PM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:


On Mon, Apr 22, 2013 at 11:56 AM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:
Hi Matyas, 

There are methods like slicer.util.saveNode and slicer.util.saveScene


Hth
Jc


On Mon, Apr 22, 2013 at 11:36 AM, Matyas123 <[hidden email]> wrote:
Hi all,
I am PhD student and I was asked to register a lot of mice brain MR images.
I have made a simple script for that purpose, all works perfectly except i
am unable to figure out how to save an image/volume using python.
(how to delete some nodes would be great also :) )

Thanks in advance,
Matyas



--
View this message in context: http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108.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



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



--
<a href="tel:%2B1%20919%20869%208849" value="<a href="tel:%2B19198698849" value="+19198698849" target="_blank">+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


_______________________________________________
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


If you reply to this email, your message will be added to the discussion below:
http://slicer-users.65878.n3.nabble.com/Saving-volume-as-nii-with-Python-script-tp4026108p4026111.html
To unsubscribe from Saving volume as nii with Python script, click here.
NAML

Thank you very much. Its working fine now!


View this message in context: Re: Saving volume as nii with Python script
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
Hi, I have tried it in hurry and it seemed it is OK. But now I see that I get error:

>>> slicer.util.saveNode(img_reg,output_path)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'saveNode'

img_reg is vtkMRMLScalarVolumeNode class. Am I missing something?

Thanks once more,
Matyas
I have finally managed it, but i had to define "saveNode" function in my script once more. I just copied definition from https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/util.py#L229-267 and now its doing what i wanted. I don´t know why I have no access to this function through slicer.util. ...

Thanks for help

_______________________________________________
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



--
+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