Borrar filtros
Borrar filtros

How to read Harvard Medical MRI images which are in .gif format?

2 visualizaciones (últimos 30 días)
I can not read Harvard Mediacl School MRI images which are in .gif format.Whenever I tried to read by using imread() and show it using imshow() funcions, the images are not appearing as it is seen in the webside or in desktop.Two images are included here with the attachment.

Respuesta aceptada

yanqi liu
yanqi liu el 7 de Mzo. de 2022
yes,sir,may be check the map,use
k = 1;
[im,map] = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/916049/1.gif');
if ~isempty(map)
im = ind2gray(im,map);
end
imwrite(im, sprintf('%d.jpg', k));
figure; imshow(im, []);
if use loop to prcess 310 images, may be use
% total 310 images.
for k = 1 : 310
[im,map] = imread('your image file path');
if ~isempty(map)
im = ind2gray(im,map);
end
imwrite(im, sprintf('%d.jpg', k));
end
  2 comentarios
DGM
DGM el 8 de Mzo. de 2022
In your prior comment, you asked about avoiding quality loss. If that's still your concern, do not use JPG to save the image.

Iniciar sesión para comentar.

Más respuestas (1)

Simon Chan
Simon Chan el 6 de Mzo. de 2022
Save it as png file and open it
data = imread('1.png');
imshow(data)
  3 comentarios
Sanjib
Sanjib el 6 de Mzo. de 2022
I have total 310 images.
Image Analyst
Image Analyst el 19 de Abr. de 2022
See the FAQ
Inside the loop call imread() to read it into a variable, then change the file extension to PNG and call imwrite().

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by