# grayscale segmentation from binary mask

**URL:** https://discourse.itk.org/t/grayscale-segmentation-from-binary-mask/1756
**Category:** Algorithms
**Created:** [April 7, 2019, 11:59am UTC](https://discourse.itk.org/t/grayscale-segmentation-from-binary-mask/1756 "2019-04-07T11:59:17Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Marco\_Festugato](https://discourse.itk.org/user_avatar/discourse.itk.org/marco_festugato/32/696_2.png) [@Marco\_Festugato](https://discourse.itk.org/u/Marco_Festugato)
#### Post date: [April 9, 2019, 2:33pm UTC](https://discourse.itk.org/t/grayscale-segmentation-from-binary-mask/1756/4 "2019-04-09T14:33:47Z")

</div>

Hi @matt.mccormick and sorry to bother u! I’ve got this problem… why, in the segmented image, is it gray in the background instead of black?

 ![Immagine](https://discourse.itk.org/uploads/default/original/1X/5fb74348f4a9ef60d3407df7073f9d4f7fbbbd09.jpeg)

I think it’s a problem in the parameter i set using confidence connected (for the liver segmentation) and the MaskImageFilter

confidenceConnected-\>SetMultiplier( 2.2 );  
confidenceConnected-\>SetNumberOfIterations( 5 );  
confidenceConnected-\>SetReplaceValue( 255 );  
confidenceConnected-\>SetSeed( index );  
confidenceConnected-\>SetInitialNeighborhoodRadius( 2 );

voting-\>SetRadius( indexRadius );  
voting-\>SetBackgroundValue( 0 );  
voting-\>SetForegroundValue( 255 );  
voting-\>SetMajorityThreshold( 2 );  
voting-\>SetMaximumNumberOfIterations( 15 );

Note: before segmentation, I changed the pixel type of the original image from ‘signed short’ to ‘float’ and I rescaled it between 0 and 1… is this actually affecting the MaskImageFilter? One last thing… the intensity of the pixel in the ‘segmented image’ look different from the ‘Input image’, why? Should I care? Should I not perform rescaling?

Thanks in advance for your precious help!

---

_[View the full topic](https://discourse.itk.org/t/grayscale-segmentation-from-binary-mask/1756)._
