Problem in conversion from 2D array value to raster data.

Discussion created by paraspant on May 9, 2011
I am tying to segment the raster data set, for which I know the multiple threshold value to segment different region

I want some thing like
read pixel data
if pixel value> Threshold
set pixel value to 0
else do nothing

I read the pixel value from raster data and store that value in 2D  and make some changes as i need array no I have problem how to convert this 2D array value to raster image.
If there is other better way please suggest me.
All you valuable suggestion and time given for that will be appreciated.