フィルターのクリア

I want to load the dicom files from a folder..

11 ビュー (過去 30 日間)
ash fairy
ash fairy 2018 年 3 月 31 日
コメント済み: Rena Berman 2018 年 4 月 5 日
clear % no variables
close all % no figures
clc % empty command window
fileFolder = fullfile(pwd, 'p5');
files = dir(fullfile(fileFolder, '*.dcm'));%specify data file diectory
fileNames = {files.name};
%examine file header meta datafrom dicom stack
info = dicominfo(fullfile(fileFolder, fileNames{1}));
%extract size info from meta data
voxel_size = [info.PixelSpacing; info.SliceThickness];
%read slice image% 3D matrix
hWaitBar= waitbar(0,'Reading DICOM files');
%create array
ct=zeros(sizeI(1), sizeI(2),numImages, classI);
for i=length(fileNames):-1:1
fname = fullfile(fileFolder, fileNames{i});
ct(:,:,i) = dicomread(fname);
waitbar((length(fileNames):-1+1)/length(fileNames))
end
delete(hWaitBar)
montage(reshape((ct), [size(ct,1), size(ct,2), 1, size(ct, 3)]), 'DisplayRange', []);
drawnow;
shg;
im = (ct(:, :, 148));
maxl = double(max(im(:)));
imt = imtool(im, [0, maxl]);
imtool close all;
  1 件のコメント
Rena Berman
Rena Berman 2018 年 4 月 5 日
(Answers Dev) Restored edit

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2018 年 3 月 31 日
Your code is assuming that your current directory has a subdirectory named 'p5' that has at least one .dcm file. You should not be assuming that. You should be checking isempty(fileNames)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by