Skip to content

Instantly share code, notes, and snippets.

@awhite40
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save awhite40/fa1178364ae06c8b1658 to your computer and use it in GitHub Desktop.

Select an option

Save awhite40/fa1178364ae06c8b1658 to your computer and use it in GitHub Desktop.
function [a] = StackingDicom(filename,short,nFrames)
%Read in file information
info = dicominfo(filename);
nRows = info.Rows;
nColumns = info.Columns;
%nPlanes = info.SamplesPerPixel;
X = repmat(int16(0), [nRows, nColumns, nFrames]); %create empty array
%Stacking slices
for p=0:nFrames-1
filename = sprintf('%s%05d.DCM', short,p);
X(:,:,p+1) = dicomread(filename);%add files to array
end
a = size(X);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment