I tried to segment the tumor but when I save it as .nrrd, I got the whole volume with other tissues. I want to save and use JUST the tumor volume. how can I do that?
Do I have to use the Editor to segment the tumor or I can do something by CLI?
I tried to segment the tumor but when I save it as .nrrd, I got the whole volume with other tissues. I want to save and use JUST the tumor volume. how can I do that?
Do I have to use the Editor to segment the tumor or I can do something by CLI?
Hide all segments that you don’t want to export and in advanced section of Export section, choose Visible segments only.
Thank you it works and I got (segmentation.seg.nrrd and segmentation-lable.nrrd)
However, since I’m new learner, I want to get the volume (segmented tumor) as an array.
so I loaded the “segmentation-lable.nrrd” then:
o= slicer.util.array(‘segmentation-lable’)
print (o)
[[[0 0 0 …, 0 0 0]
[0 0 0 …, 0 0 0]
[0 0 0 …, 0 0 0]
…
I’m getting zeros
Could you please guide me
Thank you.
It may look like zeros, but your data is probably just being shortened for display.
Try o.max()
and you should see the label value you exported.
Also something like:
import numpy
numpy.transpose(numpy.where(o==1))
will give you a list of the pixel coordinates where there’s a 1 in the segmentation array.
HTH
now I got “None” when printing o
You got None
if you mistype the node name or the image is invalid.
I would recommend to use slicer.util.arrayFromSegment()
. It can retrieve voxels directly from segmentation node, you don’t need to export it to labelmap.
now I’m getting error.
Could you please give me the complete steps code maybe I did something wrong.
Sorry, I need more specific information than this to be able to help.
You can get help on usage of any commands by using help
command. For example: help(slicer.util.arrayFromSegment)
.
See complete example here: Area of segment in a given slice? - #3 by lassoan