How to remove the grey margin from the imshow image

10 views (last 30 days)
I'm analysing the MRI data with the imshow function. But every time the image pop out in a small window with a large grey (or white if I save it) margin around it. I have to zoom in the image in order to select the ROI.
Is there a code that can remove or reduce the margin as well as show the image in a larger window so that I don't have to double click it to full screen every single time?
Please see my code below. Thank you very much!
%% Draw kidney left t1 ROIs
slice =4 ;
figure; imshow(Maps.kidney.t1(:,:,slice),[0 1500]); colormap('jet');
r = drawrectangle('Position',[32 84 3 3]), wait(r);

Answers (1)

Image Analyst
Image Analyst on 6 Dec 2022
You're probably saving it with exportgraphics or saveas instead of imwrite. Use imwrite instead when you save your image.
Shuyang Zhang
Shuyang Zhang on 7 Dec 2022
The image with a small white padding is good enough for me. Thank you very much for your help!

Sign in to comment.


Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by