I want to separate a range of pixels from the whole image.How shall i extract the values

2 ビュー (過去 30 日間)
ayesha
ayesha 2018 年 2 月 3 日
コメント済み: Image Analyst 2018 年 2 月 5 日
now the matrix is of a gray scale image 512x512.
I want to separate the values like 134 132 so on upt 169. and I want the extra pixels to be deleted. Is it possible.as I want to create a mask out of the above intensity values
  3 件のコメント
ayesha
ayesha 2018 年 2 月 3 日
Actually i want to extract the region of interest having the intensity values 132,168,134.. the other values displayed in the matrix like 9, 256 etc are to be removed
Rik
Rik 2018 年 2 月 3 日
Wouldn't your mask be this?
mask=IM>=132 & IM<=169;

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2018 年 2 月 3 日
Explain EXACTLY what "removed" or "deleted" means to you, keeping in mind that an image must remain rectangular. You can set the values out of that range to some other value, like 0 or 255 or nan or something, like this:
mask = grayImage >= 132 & grayImage <= 169;
grayImage(~mask) = 0; % Set outside mask equal to 0.
grayImage will still be a 2-D image with the pixels outside the mask STILL THERE, just black (0).
Alternatively however, you can extract all the other values into a 1-D list if you want.
listOfValuesInMask = grayImage(mask); % A 1-D vector.
listOfValuesInMask is now a 1-D list of all pixel value in the mask in column major order (taken from mask top to bottom, left to right).
  2 件のコメント
ayesha
ayesha 2018 年 2 月 5 日
thank you for the guidance. It taught me how to use masking. My objective is to extract liver out of the CT scan and suppress ALL OTHER ORGANS. I am attaching the picture. please suggest shall I apply any pre processing technique for a good mask creation.
Image Analyst
Image Analyst 2018 年 2 月 5 日
I don't know how to do that off the top of my head. Anyway, it's be more than a 5 minute effort. I suggest you look for algorithms here: http://www.visionbib.com/bibliography/contentsmedical.html#Medical%20Applications,%20CAT,%20MRI,%20Ultrasound,%20Heart%20Models,%20Brain%20Models

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by