Assign a CT intensity value within a segment

Hi -

I’m looking to assign an intensity value to a CT image for every voxel within a segment, and the voxels outside that segment should stay the same. I imagine there is a filter for this, but there are so many to choose! Anyone able to point me in the right direction?


Hi -

A direct way to do this is to use numpy. This example shows how to get the coordinates of all voxels corresponding to a particular label value and this example shows how to modify the values. You’d just need to export the segmentation as a labelmap to use these.

Hi Kevin,

The Mask volume effect in Segment Editor is just for this. You’ll need to install the SegmentEditorExtraEffects extension to have that.

I just tested it in 4.10.2, and it does not work.


I’m getting this error:

Traceback (most recent call last):
  File "C:/Users/pinter/AppData/Roaming/NA-MIC/Extensions-28257/SegmentEditorExtraEffects/lib/Slicer-4.10/qt-scripted-modules/SegmentEditorMaskVolumeLib/", line 347, in onApply
    self.maskVolumeWithSegment(segmentationNode, segmentID, operationMode, fillValues, inputVolume, outputVolume)
TypeError: maskVolumeWithSegment() takes at least 7 arguments (6 given)

There are even more errors in the nightly. @lassoan I see that you have worked on this effect, could you look at this? Maybe it’s something trivial.

@kmalexander please stand by. Thanks!

In an older version, it works well. Nightly wasn’t working - as you reported.

Thanks for the advice!


Sorry, I broke this yesterday when added a new effect (Split volume). I’ve fixed the issues now, all effects in SegmentEditorExtraEffects work in both Slicer-4.10 and Slicer-4.11 in releases downloaded tomorrow or later.

Awesome - thanks, Andras!