# interrogating pixels in RT structures

**URL:** <https://discourse.slicer.org/t/interrogating-pixels-in-rt-structures/9809>\
**Category:** Support\
**Created:** [January 14, 2020, 3:50pm UTC](https://discourse.slicer.org/t/interrogating-pixels-in-rt-structures/9809 "2020-01-14T15:50:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcjury](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@mcjury](https://discourse.slicer.org/u/mcjury)\
**Post date:** [January 14, 2020, 3:50pm UTC](https://discourse.slicer.org/t/interrogating-pixels-in-rt-structures/9809/1 "2020-01-14T15:50:18Z")

</div>

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.

Thanks  
mark

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [January 14, 2020, 4:22pm UTC](https://discourse.slicer.org/t/interrogating-pixels-in-rt-structures/9809/2 "2020-01-14T16:22:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mcjury](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@mcjury](https://discourse.slicer.org/u/mcjury)\
**Post date:** [January 15, 2020, 2:12pm UTC](https://discourse.slicer.org/t/interrogating-pixels-in-rt-structures/9809/3 "2020-01-15T14:12:15Z")

</div>

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  
mark

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 15, 2020, 9:13pm UTC](https://discourse.slicer.org/t/interrogating-pixels-in-rt-structures/9809/4 "2020-01-15T21:13:01Z")

</div>

> [@mcjury](#):
>
> That extension is dependent on another which cannot be found - MarkupsToModel

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.

---

<div class="post-metadata">

**Author:** ![mcjury](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@mcjury](https://discourse.slicer.org/u/mcjury)\
**Post date:** [January 22, 2020, 11:11am UTC](https://discourse.slicer.org/t/interrogating-pixels-in-rt-structures/9809/5 "2020-01-22T11:11:41Z")

</div>

Csaba,  
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?

Thanks!  
mark

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [January 22, 2020, 4:03pm UTC](https://discourse.slicer.org/t/interrogating-pixels-in-rt-structures/9809/6 "2020-01-22T16:03:38Z")

</div>

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.
