Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 19 Jan. 2019
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);

Weitere Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by