MATLAB Answers

How to convert a stack of medical images in the work space into .png without losing information?

3 views (last 30 days)
Sara Salimi
Sara Salimi on 29 Dec 2016
Commented: Walter Roberson on 29 Dec 2016
I have a stack of medical images that I need to convert them into png or any other image format. It is, for example, 281x389x104 (i.e., 104 images, Width: 281 and Height: 389). The files are in .mhd and .raw format. After reading that, how can I convert each slice into an image format without losing information?
Your help is appreciated
Many thanks


Sign in to comment.

Answers (1)

Ahmet Cecen
Ahmet Cecen on 29 Dec 2016
for i = 1:104
currentImage = YourData(:,:,i);
currentFileName = ['YourFileName', num2str(i), '.png'];
Should work.

Community Treasure Hunt

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

Start Hunting!

Translated by