フィルターのクリア

How to crop brain dicom image so that only brain apperars in a rectangular box?

3 ビュー (過去 30 日間)
I am having an image of brain in DICOM format. I wanted to cover in a bounding box so that outer area can be eliminated. I have tried the following code but its not working.
clear all;
close all;
clc;
X = dicomread('T2W_Brain.dcm');
imagesc(X, [0 1024]), colormap(gray), colorbar, axis image, axis off
imcrop(X).
Here, output is black screen.
Kindly suggest the suitable wayout.

採用された回答

Walter Roberson
Walter Roberson 2019 年 1 月 19 日
The problem is the imcrop(X) call. When you pass in an image like you are, imcrop() is defined as displaying the image and then putting up a cropping tool. It displays the image by using imshow() with no parameters. Your data is uint16 that has a maximum of about 1624, so relative to the full uint16 range it is pretty much all black.
Calling imcrop() passing in an image does not use the active caxis value or the active colormap. Indeed in your situation where the axes is the only thing in the figure, the imshow() that gets called will delete the axes and create a new one.
The solution:
h = imagesc(X, [0 1024]), colormap(gray), colorbar, axis image, axis off
Y = imcrop(h);
  1 件のコメント
sakshi ahuja
sakshi ahuja 2019 年 1 月 21 日
Thank you so much for detailed information and correcting the mistake. God bless you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by