Convert DICOM video (4D) to 3D matrix

4 views (last 30 days)
I have a DICOM ultrasound video, when I save it as a .mat file I find that it is a unit8 file with a 4D matrix. I thought the output would be a 3D matrix
When I save an individual frame and save as a .mat file I get a 2D matrix (Depth and Lateral). Which is to be expected. I am assuming the 4th dimension is an extra colour dimension that isn't needed (these are greyscale images).
What I want is to get the video and save it as a 3D matrix. Depth, Lateral and Frame number. Any help would be greatly appreciated.

Accepted Answer

Rik
Rik on 1 Feb 2018
If it saves your data as an RGB image, one of the dimensions will be 3. You can find the size of your matrix with the size function.
%suppose D contains your data
disp(size(D))
%suppose the result is 255 255 3 40
D=squeeze(D(:,:,1,:));
% or:
D=mean(D,3,'native');
% or even:
D=mean(D,find(size(D)==3,1),'native');

More Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!