interrogating pixels in RT structures

Can anyone save me time? - I have spend considerable time but not found the answer to this:

I have a data set comprising a set of MRI images, and a set of RT (Radiotherapy) structures.
Aim - I would like to obtain the pixel values from each of the structure volumes, and do simple processing of them - generate historgrams of the pixel values, etc.
I don’t necessarily need to do the image processing of the pixels in Slicer - I would be happy even to be able to export the pixel values for each structure out of Slicer and process elsewhere if necessary.

So far, I can get my data into 3DSlicer, and I have installed SlicerRT.
I can see the images, and the structures/volumes.

BUT, I do not know how to actually analyse the pixels in the structures, or export their values offline.
This is really such a basic thing to do, I strongly suspect someone has already done it - I don’#t want to reinvent the wheel here.
I’ve been told I need to do something with binary labelmap representations…but I have no idea what do do, and can’t quickly find help in documentation/tutorials so far…

If anyone can point me to exactly where there are understandable instructions for this kind of thing, or suggest a set of steps I can try - that would be awesome.


You got most of it done. You just need to use one more tool:

  • Install the SegmentEditorExtraEffects extension
  • Make sure the RT structure set is selected as segmentation and the MRI as master volume
  • Use the Mask volume effect

Thanks Csaba!
Good to know I’m almost there - I was beginning to think Slicer was more focussed on visualisation, than pixel analysis…
OK - so I’ve installed that extension [ and btw, I get an error (That extension is dependent on another which cannot be found - MarkupsToModel - but hopefully that will not affect what I am trying to do?]
In SegmentationEditor, I can set the volume as master, etc. and I see the mask tool.

I’ll read the module document on how to use the mask effect and explore this process…
Fingers-crossed - but I may need to come back to you if I get stuck.
Thanks again

MarkupsToModel extension should be available on all platforms. Please try again. If it still cannot find it then let us know which Slicer version you use on what platform and I’ll lok into it.

OK - here is where I have gotten to with this:

I load up my images and RT structures
Set the images as master volume
Select a segment
Mask outside the segment to 0 intensity and store the masked segment;
Make the masked_segment the active volume
In volume module, I can see some information about the volume - including a displayed histogram of pixel intensities.
–Two things I cannot see how to do:
How do I save this histogram as something which allows me to have this data in a useful form, eg .csv file or similar? can the displayed histogram be formatted better, with axis labels and saved as an image file?
Secondly - the histogram is great - but I’m surprised not to see the simple stuff - mean and median pixel values for the volume - where can I get these?


You can use the Segment Statistics module (even without doing the masking, just with the original volume and the segmentation) to see simple metrics.

I’m not sure you can show the histogram just using modules. I’d use the vtkImageAccumulate filter from python and fill a vtkTable and put it in a vtkMRMLTableNode to show the histogram nicely as a Plot.