first code
user_4319474
plain_text
2 years ago
1.2 kB
7
Indexable
% Read DICOM info from the first image info_fixed1 = dicominfo('CT_1.3.46.670589.33.1.63762475895493731700001.5331339939737593077.dcm'); % Read DICOM width, height, and bitdepth parameters into variables width = info_fixed1.Width; height = info_fixed1.Height; bitdepth = info_fixed1.BitDepth; % Build a data structure of the 32 image file names within the folder image_list = dir('*.dcm'); % Create an order-3 (3D) array of zeros of size width, height, length data = zeros(height, width, length(image_list)); % Read all DICOM data into the array for i = 1:length(image_list) filename = image_list(i).name; img = dicomread(filename); data(:,:,i) = img; end % Examine the values in the array disp(['Minimum pixel value: ' num2str(min(data(:)))]); disp(['Maximum pixel value: ' num2str(max(data(:)))]); % Normalize the data to a range between 0 and 1 data = data / (2^bitdepth - 1); % Display slices of the image stack figure; imshow(squeeze(data(:,round(end/2),:)), []); title('Axial plane'); figure; imshow(squeeze(data(round(end/2),:,:)), []); title('Coronal plane'); figure; imshow(squeeze(data(:,:,round(end/2))), []); title('Sagittal plane');
Editor is loading...