Borrar filtros
Borrar filtros

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

3 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de En. de 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);

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by