How to write a 16 bit image with a drawing rectangle in a folder
1 次查看(过去 30 天)
显示 更早的评论
I am working with a 16 bit DICOM Image whose size is 512*512. I want to draw a rectangle at 250,375 positions with length and width 50,50 respectively. I am capable to draw rectangle on that particular position. But, I am incapable to save the image with the rectangle. Is it possible to write the image with rectangle.
I=dicomread('F:\img1.dcm'); figure,imshow(X, []); hold on; title('16 bit image.', 'FontSize', 10); rectangle('Position', [250,375,100,100],... 'EdgeColor','r', 'LineWidth', 3); imwrite(X,'C:\Users\Jhilam\Desktop\code\myfile.png','WriteMode','append');
0 个评论
采纳的回答
Swarnava Pramanik
2018-6-22
Hi Jhilam,
As per your question you can save the image with the rectangle drawn at a specific coordinate using the “saveas” command. Here is a small code snippet to do that:
info = dicominfo('CT-MONO2-16-ankle.dcm');
Y = dicomread(info);
a = figure();
imshow(Y,[]);
hold on;
title('16 bit image.', 'FontSize', 10);
rectangle('Position', [250,375,100,100], 'EdgeColor','r', 'LineWidth', 3);
saveas(a,'dcmFile2.png')
Thanks,
Swarnava Pramanik
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!