Re: Obtain the slice of segmentation

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

Re: Obtain the slice of segmentation

andrey.fedorov
On Tue, Feb 28, 2017 at 4:21 AM,  <[hidden email]> wrote:
> Hi,
> I Apologise in advance because I write in private but would like to know how I can access individual slice once the segmentation.

Please post general questions like this one to the slicer-devel list.

> Let me explain I I perform segmentation and 3D reconstruction of the volume of brain tumor once that is done with the modules already in python I want my form to take the volume and that from this ricavasse images where there is the tumor with the already segmented tumor for each image in order to obtain a subimage comprising only pixels that are part of the tumor.
> is it possible?

You can use the Mask module to set all of the pixels outside the
segmented area to zero.

> Another question: how can I access the slice in the three views? ie how can I take all the images of views and put them in separate carriers (always in python) for views so that we can do the calculations?
>

Sorry, I don't understand this question! Can you clarify?

> _____________________________________
> Sent from http://slicer-devel.65872.n3.nabble.com
>
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
What I need is that:
After my segmentation I want to obtain the image where the tumor is in from
the entire set of image created by the machine and inserted into slicer. For
example: If I have this situation in slicer:
<http://slicer-devel.65872.n3.nabble.com/file/n4038098/Schermata_2017-02-28_alle_15.png>

How can I obtain the image where there a segmentation?
And how can I obtain the distance ( z-index ) between two of this image?



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038098.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
This post has NOT been accepted by the mailing list yet.
In reply to this post by andrey.fedorov
What I need is that:
After my segmentation I want to obtain the image where the tumor is in from the entire set of image created by the machine and inserted into slicer. For example: If I have this situation in slicer:
Slicer with segmented tumor

How can I obtain the image where there a segmentation?
And how can I obtain the distance ( z-index ) between two of this image?
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
My other question is: how can I obtain all the image there is in slicer?
For example for the image in the previous post: how can I obtain all the
TumorBrain Image?



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038100.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
This post has NOT been accepted by the mailing list yet.
In reply to this post by mosx
My other question is: how can I obtain all the image there is in slicer?
For example for the image in the previous post: how can I obtain all the TumorBrain Image?
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

pinter
In reply to this post by mosx
When you say image is it a screenshot with the anatomical image in the background as you can see it in the slice, or is it a slice extracted from the segmentation itself?

You can get the position of a slice view like this:
lm=slicer.app.layoutManager()
sw=lm.sliceWidget('Red') # Get available names using lm.sliceViewNames()
sl=sw.sliceLogic()
sl.GetSliceOffset()
Also you can get the bounds:
b=[0]*6
sl.GetSliceBounds(b)

Hth,
csaba

-----Original Message-----
From: slicer-devel [mailto:[hidden email]] On Behalf Of mosx
Sent: Tuesday, February 28, 2017 10:20
To: SPL Slicer Devel <[hidden email]>
Subject: Re: [slicer-devel] Obtain the slice of segmentation

My other question is: how can I obtain all the image there is in slicer?
For example for the image in the previous post: how can I obtain all the TumorBrain Image?



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038100.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
This post has NOT been accepted by the mailing list yet.
Thank you so much for your help! With this snippet of code I obtain the offset between two slice.
My question now are:
1- where I find a manual of all the method and all the class of slicer for python?
2- Can I obtain the set of Image where the tumor is segmented from slicer?
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
In reply to this post by pinter
Thank you so much for your help! With this snippet of code I obtain the
offset between two slice.
My question now are:
1- where I find a manual of all the method and all the class of slicer for
python?
2- Can I obtain the set of Image where the tumor is segmented from slicer?




--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038108.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

pinter
1. https://www.slicer.org/doc/html/classes.html
2. When you say "image", is it a screenshot with the anatomical image in the background as you can see it in the slice, or is it a slice extracted from the segmentation itself?


-----Original Message-----
From: slicer-devel [mailto:[hidden email]] On Behalf Of mosx
Sent: Tuesday, February 28, 2017 13:08
To: SPL Slicer Devel <[hidden email]>
Subject: Re: [slicer-devel] Obtain the slice of segmentation

Thank you so much for your help! With this snippet of code I obtain the offset between two slice.
My question now are:
1- where I find a manual of all the method and all the class of slicer for python?
2- Can I obtain the set of Image where the tumor is segmented from slicer?




--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038108.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
2. A slice extracted from the segmentation itself.
Another time thank you so much.



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038111.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
For more precisely I want an Image where my segmentation ( tumor for my
purpose ) have value and the extern of my segmentation has 0 value.



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038113.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
This post has NOT been accepted by the mailing list yet.
In reply to this post by mosx
For more precisely I want an Image where my segmentation ( tumor for my purpose ) have value and the extern of my segmentation has 0 value.
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

pinter
In reply to this post by mosx
You can access the image data directly by:
import vtkSegmentationCorePython as vtkSegmentationCore
segment = segmentationNode.GetSegmentation().GetSegment(segmentID)
orientedImageData = segment.GetRepresentation(vtkSegmentationCore.vtkSegmentationConverter.GetSegmentationBinaryLabelmapRepresentationName())

Then you'll need to use the bounds (see my previous email) to crop it. Unfortunately there is no convenience function yet to do it (there are many others in vtkSegmentationCore.vtkOrientedImageDataResample), so you'll need to use a VTK filter to crop the image data.

csaba

-----Original Message-----
From: slicer-devel [mailto:[hidden email]] On Behalf Of mosx
Sent: Tuesday, February 28, 2017 13:25
To: SPL Slicer Devel <[hidden email]>
Subject: Re: [slicer-devel] Obtain the slice of segmentation

For more precisely I want an Image where my segmentation ( tumor for my purpose ) have value and the extern of my segmentation has 0 value.



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038113.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
how can I define segmentationNode?

And segmentID is the label of the segment?



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038117.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
This post has NOT been accepted by the mailing list yet.
In reply to this post by pinter
how can I define segmentationNode?

And segmentID is the label of the segment?
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

pinter
In reply to this post by mosx
segmentationNode = slicer.util.getNode('vtkMRMLSegmentationNode1')
or
segmentationNode = slicer.util.getNode(nodeName)

Segment ID is an identifier. You can get the available IDs from the segmentation (segmentationNode.GetSegmentation()), and if you want to get a segment by name, then you need to find it in that list. See
https://www.slicer.org/doc/html/classvtkSegmentation.html

csaba

-----Original Message-----
From: slicer-devel [mailto:[hidden email]] On Behalf Of mosx
Sent: Tuesday, February 28, 2017 14:01
To: SPL Slicer Devel <[hidden email]>
Subject: Re: [slicer-devel] Obtain the slice of segmentation

how can I define segmentationNode?

And segmentID is the label of the segment?



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038117.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
And if I want to create a plugin and in it give the possibility to select a
segmentation which is created by this tutorial: segmentation tutorial
youtube <https://www.youtube.com/watch?v=lawaJUGEf5A>  





--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038120.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
This post has NOT been accepted by the mailing list yet.
In reply to this post by pinter
And if I want to create a plugin and in it give the possibility to select a segmentation which is created by this tutorial:segmentation tutorial youtube

Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

pinter
In reply to this post by mosx
Please use the GrowCut effect in Segment Editor instead of Editor.

csaba

-----Original Message-----
From: slicer-devel [mailto:[hidden email]] On Behalf Of mosx
Sent: Tuesday, February 28, 2017 15:58
To: SPL Slicer Devel
Subject: Re: [slicer-devel] Obtain the slice of segmentation

And if I want to create a plugin and in it give the possibility to select a segmentation which is created by this tutorial: segmentation tutorial youtube <https://www.youtube.com/watch?v=lawaJUGEf5A>  





--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038120.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Obtain the slice of segmentation

mosx
Hi,
I try to use your code from python console in slicer but I don't find the
segmentID.
My goal is to get from slicer the slice where the tumor is present and
segmented and after this I want to calculate the volume of the tumor.
I think for calculate the tumor I will use the slice before and the offset
between slice in that manner: I calculate the area of tumor for all slice I
have and after multiply it for the offset ( the idea is the offset is small
and the tumor do not grown more in this space ).




--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Re-Obtain-the-slice-of-segmentation-tp4038096p4038125.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
12