if i have an MRI image and I don't want the down part. I want to make it black or neglected.how can i do like the image I attached. I don't want the down part horizontally after point 3 or if you have a way to extract only the brain part thanks alot
it

 Accepted Answer

I assume you used text() to place the numbers on the image. I'm not sure what the "down" part is, but if you want to set the image below the row that the 3 is on to be zero, then you can do this:
grayImage(row3, :) = 0;

11 Comments

this numbers i put to identify the regions after using regionprops so it make it easier to delete the unwanted regions
I consider the region number 3 to be the end of the image. I don't want the down part to be considered in my processing( I hope you get my idea)
forget the numbers I don't want the down part of the image. i want to process the brain part only, can I
Down means below or under or beneath or lower. I'm not sure what it means in the context you're using it. Can you use some photoretouching program such as Photoshop to show me what you want as a final image. I have posted demos on "skull stripping" if that's what you're after.
hanem ellethy
hanem ellethy on 4 Sep 2015
Edited: hanem ellethy on 4 Sep 2015
I already used your skull stripping and it is so helpful. I need to neglect the part under the red line
i used imcrop but i am afraid it may affect any????
Sure, cropping will affect the image. Almost anything you do (except for things like saving it or displaying it or copying it) will affect the image. So what do you want to do with the part under the orange line? Do you just want to set it to zero (like I showed you in my first response)?
yes I want to make it black, any way I will never work with it (because of that I think of cropping). I just want to extract some features from the upper part, but the down part include some tissues which has similar mean intensity and some other features which is not wanted
OK, let's call it the "bottom" part rather than the "down" part - English speakers will then understand what you mean.
If you want to mask some part of the image to black, and you have the coordinates of the line end points and the bottom ocrners of the image, you can juse use poly2mask:
mask = poly2mask(x, y, rows, columns);
grayImage(mask) = 0;
Also see my masking demos, attached.
thanks for your support but what is the effects if I use crop instead??
your demos is so helpful, appreciated your efforts and support. I used imrect to make a rectangular mask then masked the image to make it black.
but i have this message in work space area Warning: Image is too big to fit on screen; displaying at 67% > In images.internal.initSize (line 71) In imshow (line 305) is it affect my image measurements or just for screen fit
thank you so much for your patience and follow up
imrect() and imcrop() only allow for rectangular regions of interest. And imcrop() changes the size of the image by throwing away pixels. poly2mask() does not change the size of the image and allows you to have non-rectangular shapes to zero out.
Don't worry about that warning - it's just saying that it's shrinking your image upon display only so that it will fit into the axes. If you don't want that warning message to appear, see my utility (attached) to suppress common warning messages.
thank you so much.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!