Effacer les filtres
Effacer les filtres

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

3 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Walter Roberson
Walter Roberson le 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);
  1 commentaire
sakshi ahuja
sakshi ahuja le 21 Jan 2019
Thank you so much for detailed information and correcting the mistake. God bless you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by