From: Ali Al-Radaideh on
Hi,

I am quite new to Matlab and I have a question which might be very simple to most of you.

I have an MRI image with pixel values range from 0 to 15000. Is there any way to create a mask such that all values between 0-3000 are assigned to one while value above 3000 are assigned to zero. Any ideas please?

Thanks in advance
Ali


From: Jos (10584) on
"Ali Al-Radaideh" <aliradaideh(a)yahoo.com> wrote in message <ht0hsd$rcr$1(a)fred.mathworks.com>...
> Hi,
>
> I am quite new to Matlab and I have a question which might be very simple to most of you.
>
> I have an MRI image with pixel values range from 0 to 15000. Is there any way to create a mask such that all values between 0-3000 are assigned to one while value above 3000 are assigned to zero. Any ideas please?
>
> Thanks in advance
> Ali
>
>

Use a logical matrix. Example:

r = magic(5) % example image
q = r > 12 % logical matrix
r(q) = -1
r(~q) = 9

hth
Jos
From: ImageAnalyst on
Ali Al-Radaideh:

maskImage = mriImage <= 3000;

% Optional (beyond what you asked for)
% To actually perform the masking:
outputImage = mriImage .* maskImage;
 | 
Pages: 1
Prev: The Round function in Matlab
Next: ode 45