Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
helpDicom

Subject: helpDicom

From: grand

Date: 18 Mar, 2010 23:20:21

Message: 1 of 4

Hi all,
How to read all Dicom images (using example uigetdir) from one folder and show this...
thx

Subject: helpDicom

From: Sadik

Date: 18 Mar, 2010 23:32:04

Message: 2 of 4

Hi,

An example:

[filename, chosenDirectory] = uigetfile('*.dicom', 'Pick an M-file');

allDicomFiles = dir([chosenDirectory '*.dcm']);

for k = 1:length(allDicomFiles)
    stackOfImages(:,:,k) = dicomread([chosenDirectory '\' allDicomFiles(k).name]);
end

so that stackOfImages will be, for example, 256x256x(#images), if your images are 256x256.

Then, you can go through the slices one by one by pressing any key on the keyboard:

for k = 1:size(stackOfImages,3)
    imagesc(stackOfImages(:,:,k))
    title(['Image ' num2str(k)]);
    drawnow
    pause
end

Hope this helps.

Best.

Subject: helpDicom

From: Sadik

Date: 18 Mar, 2010 23:37:02

Message: 3 of 4

I am really sorry. The first line should have been:

[filename, chosenDirectory] = uigetfile('*.dcm', 'Pick an M-file');

Subject: helpDicom

From: grand

Date: 19 Mar, 2010 12:23:03

Message: 4 of 4

Sadik, Thanks a lot for help

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us