Add new Node to scene under specific patient

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

Add new Node to scene under specific patient

Matthew Anthony Mouawad

Hello again,

 

I have a quick question about how to programmatically add a node to the scene under a specific patient. For example let’s say I have a patient named Jane01 and a study description of “user”. Slicer will load the dicoms under Jane01 > user > dicoms if looked at in the subject hierarchy. I can drag and drop other volumes to there if needed. I also know how to create volumes and output them to the scene:

 

outputVolumeNode = slicer.vtkMRMLScalerVolumeNode()

slicer.mrmlScene.AddNode(outputVolumeNode)

 

and I can then use this volume node for, say, registering. But this put’s it under the general “scene” and not under any specific patient node. Is there any way to make it so that it adds it under a specific patient node? And while on the topic, what do I have to do to change a nodes name? I have some node (retrieved using the slicer.util.getNode(‘Name’) function) I know I can set it by doing: newNodeObject.setName(“NewName”) and this is reflected when I “print” this object but it’s not reflected in the subject hierarchy under the MRML Node Inspector. I am assuming I have to update the scene in some way but I don’t know how (again not very programmatically inclined).

 

Thanks for any help again!


_______________________________________________
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: Add new Node to scene under specific patient

Andras Lasso-2

Subject hierarchy has significantly changed in recent nightly builds. Now you can place a node in the SH like this:

 

shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)

shNode.SetItemParent(shNode.GetItemByDataNode(node), shNode.GetItemByDataNode(parentNode))

 

Andras

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Matthew Anthony Mouawad
Sent: February 22, 2017 16:04
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Add new Node to scene under specific patient

 

Hello again,

 

I have a quick question about how to programmatically add a node to the scene under a specific patient. For example let’s say I have a patient named Jane01 and a study description of “user”. Slicer will load the dicoms under Jane01 > user > dicoms if looked at in the subject hierarchy. I can drag and drop other volumes to there if needed. I also know how to create volumes and output them to the scene:

 

outputVolumeNode = slicer.vtkMRMLScalerVolumeNode()

slicer.mrmlScene.AddNode(outputVolumeNode)

 

and I can then use this volume node for, say, registering. But this put’s it under the general “scene” and not under any specific patient node. Is there any way to make it so that it adds it under a specific patient node? And while on the topic, what do I have to do to change a nodes name? I have some node (retrieved using the slicer.util.getNode(‘Name’) function) I know I can set it by doing: newNodeObject.setName(“NewName”) and this is reflected when I “print” this object but it’s not reflected in the subject hierarchy under the MRML Node Inspector. I am assuming I have to update the scene in some way but I don’t know how (again not very programmatically inclined).

 

Thanks for any help again!


_______________________________________________
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: Add new Node to scene under specific patient

Csaba Pinter-2

Thanks, Andras!

 

Matthew, with the update subject hierarchy, if you change a name of the node as you mentioned (node.SetName(‘NewName’)), it will change its name in subject hierarchy too.

Let us know how it works!

 

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Andras Lasso
Sent: Monday, March 13, 2017 21:46
To: Matthew Anthony Mouawad <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Add new Node to scene under specific patient

 

Subject hierarchy has significantly changed in recent nightly builds. Now you can place a node in the SH like this:

 

shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)

shNode.SetItemParent(shNode.GetItemByDataNode(node), shNode.GetItemByDataNode(parentNode))

 

Andras

 

From: slicer-users [[hidden email]] On Behalf Of Matthew Anthony Mouawad
Sent: February 22, 2017 16:04
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Add new Node to scene under specific patient

 

Hello again,

 

I have a quick question about how to programmatically add a node to the scene under a specific patient. For example let’s say I have a patient named Jane01 and a study description of “user”. Slicer will load the dicoms under Jane01 > user > dicoms if looked at in the subject hierarchy. I can drag and drop other volumes to there if needed. I also know how to create volumes and output them to the scene:

 

outputVolumeNode = slicer.vtkMRMLScalerVolumeNode()

slicer.mrmlScene.AddNode(outputVolumeNode)

 

and I can then use this volume node for, say, registering. But this put’s it under the general “scene” and not under any specific patient node. Is there any way to make it so that it adds it under a specific patient node? And while on the topic, what do I have to do to change a nodes name? I have some node (retrieved using the slicer.util.getNode(‘Name’) function) I know I can set it by doing: newNodeObject.setName(“NewName”) and this is reflected when I “print” this object but it’s not reflected in the subject hierarchy under the MRML Node Inspector. I am assuming I have to update the scene in some way but I don’t know how (again not very programmatically inclined).

 

Thanks for any help again!


_______________________________________________
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: Add new Node to scene under specific patient

Matthew Anthony Mouawad
In reply to this post by Andras Lasso-2
While I was waiting for an answer I decided to do some investigating on my own. I do understand a bit more about how things work and as you said changing the name of the *subject hierarchy node* will change it in the gui. The reason I wasn't seeing a name change is because of the following steps:

1. Load Dicoms (image name is jane's image when I look at it in slicer) 

2. Get the node through the python console with ImageNode = slicer.util.getNode("jane's image") 

3. Try and change the name: ImageNode. SetName('newNodeName') 

And this wouldn't be shown. I didn't realize that the actual scalar volume node was stored in the subject hierarchy node (or references the scalar node, sorry if wrong terminology). Instead to change the name I guess I should replace the name in step 2 with "jane's image_subject_hierarchy" as it append that to the image name for the subject hierarchy node. When I do that and change the name then it works fine. 

Essentially I am just trying to add scalar nodes for registration programmatically through the python consol and just needed a way to systematically name the output volumes and was having issues with that. I think the tips given as well as what I looked at should be enough! Thanks


-------- Original message --------
From: Csaba Pinter <[hidden email]>
Date: 2017-03-13 21:52 (GMT-05:00)
To: Andras Lasso <[hidden email]>, Matthew Anthony Mouawad <[hidden email]>, SPL Slicer Users <[hidden email]>
Subject: RE: Add new Node to scene under specific patient

Thanks, Andras!

 

Matthew, with the update subject hierarchy, if you change a name of the node as you mentioned (node.SetName(‘NewName’)), it will change its name in subject hierarchy too.

Let us know how it works!

 

csaba

 

From: slicer-users [mailto:[hidden email]] On Behalf Of Andras Lasso
Sent: Monday, March 13, 2017 21:46
To: Matthew Anthony Mouawad <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Add new Node to scene under specific patient

 

Subject hierarchy has significantly changed in recent nightly builds. Now you can place a node in the SH like this:

 

shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)

shNode.SetItemParent(shNode.GetItemByDataNode(node), shNode.GetItemByDataNode(parentNode))

 

Andras

 

From: slicer-users [[hidden email]] On Behalf Of Matthew Anthony Mouawad
Sent: February 22, 2017 16:04
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Add new Node to scene under specific patient

 

Hello again,

 

I have a quick question about how to programmatically add a node to the scene under a specific patient. For example let’s say I have a patient named Jane01 and a study description of “user”. Slicer will load the dicoms under Jane01 > user > dicoms if looked at in the subject hierarchy. I can drag and drop other volumes to there if needed. I also know how to create volumes and output them to the scene:

 

outputVolumeNode = slicer.vtkMRMLScalerVolumeNode()

slicer.mrmlScene.AddNode(outputVolumeNode)

 

and I can then use this volume node for, say, registering. But this put’s it under the general “scene” and not under any specific patient node. Is there any way to make it so that it adds it under a specific patient node? And while on the topic, what do I have to do to change a nodes name? I have some node (retrieved using the slicer.util.getNode(‘Name’) function) I know I can set it by doing: newNodeObject.setName(“NewName”) and this is reflected when I “print” this object but it’s not reflected in the subject hierarchy under the MRML Node Inspector. I am assuming I have to update the scene in some way but I don’t know how (again not very programmatically inclined).

 

Thanks for any help again!


_______________________________________________
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: Add new Node to scene under specific patient

Andras Lasso-2
In reply to this post by Andras Lasso-2

Subject hierarchy has been completely reworked and the new version was integrated a week ago. There is no more redundant naming (name of data node <-> name of subject hierarchy item), but the node name is shown in the subject hierarchy tree.

 

Andras

 

From: Matthew Anthony Mouawad [mailto:[hidden email]]
Sent: March 14, 2017 9:40
To: Csaba Pinter <[hidden email]>; Andras Lasso <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: Add new Node to scene under specific patient

 

While I was waiting for an answer I decided to do some investigating on my own. I do understand a bit more about how things work and as you said changing the name of the *subject hierarchy node* will change it in the gui. The reason I wasn't seeing a name change is because of the following steps:

 

1. Load Dicoms (image name is jane's image when I look at it in slicer) 

 

2. Get the node through the python console with ImageNode = slicer.util.getNode("jane's image") 

 

3. Try and change the name: ImageNode. SetName('newNodeName') 

 

And this wouldn't be shown. I didn't realize that the actual scalar volume node was stored in the subject hierarchy node (or references the scalar node, sorry if wrong terminology). Instead to change the name I guess I should replace the name in step 2 with "jane's image_subject_hierarchy" as it append that to the image name for the subject hierarchy node. When I do that and change the name then it works fine. 

 

Essentially I am just trying to add scalar nodes for registration programmatically through the python consol and just needed a way to systematically name the output volumes and was having issues with that. I think the tips given as well as what I looked at should be enough! Thanks

 

 

-------- Original message --------

From: Csaba Pinter <[hidden email]>

Date: 2017-03-13 21:52 (GMT-05:00)

To: Andras Lasso <[hidden email]>, Matthew Anthony Mouawad <[hidden email]>, SPL Slicer Users <[hidden email]>

Subject: RE: Add new Node to scene under specific patient

 

Thanks, Andras!

 

Matthew, with the update subject hierarchy, if you change a name of the node as you mentioned (node.SetName(‘NewName’)), it will change its name in subject hierarchy too.

Let us know how it works!

 

csaba

 

From: slicer-users [[hidden email]] On Behalf Of Andras Lasso
Sent: Monday, March 13, 2017 21:46
To: Matthew Anthony Mouawad <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Add new Node to scene under specific patient

 

Subject hierarchy has significantly changed in recent nightly builds. Now you can place a node in the SH like this:

 

shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)

shNode.SetItemParent(shNode.GetItemByDataNode(node), shNode.GetItemByDataNode(parentNode))

 

Andras

 

From: slicer-users [[hidden email]] On Behalf Of Matthew Anthony Mouawad
Sent: February 22, 2017 16:04
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Add new Node to scene under specific patient

 

Hello again,

 

I have a quick question about how to programmatically add a node to the scene under a specific patient. For example let’s say I have a patient named Jane01 and a study description of “user”. Slicer will load the dicoms under Jane01 > user > dicoms if looked at in the subject hierarchy. I can drag and drop other volumes to there if needed. I also know how to create volumes and output them to the scene:

 

outputVolumeNode = slicer.vtkMRMLScalerVolumeNode()

slicer.mrmlScene.AddNode(outputVolumeNode)

 

and I can then use this volume node for, say, registering. But this put’s it under the general “scene” and not under any specific patient node. Is there any way to make it so that it adds it under a specific patient node? And while on the topic, what do I have to do to change a nodes name? I have some node (retrieved using the slicer.util.getNode(‘Name’) function) I know I can set it by doing: newNodeObject.setName(“NewName”) and this is reflected when I “print” this object but it’s not reflected in the subject hierarchy under the MRML Node Inspector. I am assuming I have to update the scene in some way but I don’t know how (again not very programmatically inclined).

 

Thanks for any help again!


_______________________________________________
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: Add new Node to scene under specific patient

Matthew Anthony Mouawad
In reply to this post by Andras Lasso-2
Oh great! Thanks for letting me know


-------- Original message --------
From: Andras Lasso <[hidden email]>
Date: 2017-03-14 09:49 (GMT-05:00)
To: Matthew Anthony Mouawad <[hidden email]>, Csaba Pinter <[hidden email]>, SPL Slicer Users <[hidden email]>
Subject: RE: Add new Node to scene under specific patient

Subject hierarchy has been completely reworked and the new version was integrated a week ago. There is no more redundant naming (name of data node <-> name of subject hierarchy item), but the node name is shown in the subject hierarchy tree.

 

Andras

 

From: Matthew Anthony Mouawad [mailto:[hidden email]]
Sent: March 14, 2017 9:40
To: Csaba Pinter <[hidden email]>; Andras Lasso <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: Add new Node to scene under specific patient

 

While I was waiting for an answer I decided to do some investigating on my own. I do understand a bit more about how things work and as you said changing the name of the *subject hierarchy node* will change it in the gui. The reason I wasn't seeing a name change is because of the following steps:

 

1. Load Dicoms (image name is jane's image when I look at it in slicer) 

 

2. Get the node through the python console with ImageNode = slicer.util.getNode("jane's image") 

 

3. Try and change the name: ImageNode. SetName('newNodeName') 

 

And this wouldn't be shown. I didn't realize that the actual scalar volume node was stored in the subject hierarchy node (or references the scalar node, sorry if wrong terminology). Instead to change the name I guess I should replace the name in step 2 with "jane's image_subject_hierarchy" as it append that to the image name for the subject hierarchy node. When I do that and change the name then it works fine. 

 

Essentially I am just trying to add scalar nodes for registration programmatically through the python consol and just needed a way to systematically name the output volumes and was having issues with that. I think the tips given as well as what I looked at should be enough! Thanks

 

 

-------- Original message --------

From: Csaba Pinter <[hidden email]>

Date: 2017-03-13 21:52 (GMT-05:00)

To: Andras Lasso <[hidden email]>, Matthew Anthony Mouawad <[hidden email]>, SPL Slicer Users <[hidden email]>

Subject: RE: Add new Node to scene under specific patient

 

Thanks, Andras!

 

Matthew, with the update subject hierarchy, if you change a name of the node as you mentioned (node.SetName(‘NewName’)), it will change its name in subject hierarchy too.

Let us know how it works!

 

csaba

 

From: slicer-users [[hidden email]] On Behalf Of Andras Lasso
Sent: Monday, March 13, 2017 21:46
To: Matthew Anthony Mouawad <[hidden email]>; SPL Slicer Users <[hidden email]>
Subject: Re: [slicer-users] Add new Node to scene under specific patient

 

Subject hierarchy has significantly changed in recent nightly builds. Now you can place a node in the SH like this:

 

shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)

shNode.SetItemParent(shNode.GetItemByDataNode(node), shNode.GetItemByDataNode(parentNode))

 

Andras

 

From: slicer-users [[hidden email]] On Behalf Of Matthew Anthony Mouawad
Sent: February 22, 2017 16:04
To: SPL Slicer Users <[hidden email]>
Subject: [slicer-users] Add new Node to scene under specific patient

 

Hello again,

 

I have a quick question about how to programmatically add a node to the scene under a specific patient. For example let’s say I have a patient named Jane01 and a study description of “user”. Slicer will load the dicoms under Jane01 > user > dicoms if looked at in the subject hierarchy. I can drag and drop other volumes to there if needed. I also know how to create volumes and output them to the scene:

 

outputVolumeNode = slicer.vtkMRMLScalerVolumeNode()

slicer.mrmlScene.AddNode(outputVolumeNode)

 

and I can then use this volume node for, say, registering. But this put’s it under the general “scene” and not under any specific patient node. Is there any way to make it so that it adds it under a specific patient node? And while on the topic, what do I have to do to change a nodes name? I have some node (retrieved using the slicer.util.getNode(‘Name’) function) I know I can set it by doing: newNodeObject.setName(“NewName”) and this is reflected when I “print” this object but it’s not reflected in the subject hierarchy under the MRML Node Inspector. I am assuming I have to update the scene in some way but I don’t know how (again not very programmatically inclined).

 

Thanks for any help again!


_______________________________________________
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