DICOMファイルのデータサイズの読み込み方

5 次查看(过去 30 天)
ssk
ssk 2019-2-3
评论: ssk 2019-2-4
プログラミング初心者です。
CNNを動かすのにDICOMファイルのデータサイズを必要としています。(データサイズは〇〇pixel ×〇〇pixelという形式を想定しています。)
%path = current directory
currentdirectory = pwd;
% set categories of subdirectory
categories = {'a', 'b', 'c','d'};
imds = imageDatastore(fullfile(currentdirectory, categories),'IncludeSubfolders',true,'FileExtensions','.dcm','LabelSource', 'foldernames');
現在、上のようなコードを書いていて、imageがjpgファイルの場合、以下のようなコードでデータサイズが表示できるようです。
img = readimage(imds,1);
size(img)
DICOMファイルのデータサイズを表示するために、以下のコードを書いてみたのですが動きませんでした。
img = dicomread(imds,1);
size(img)
jpgファイルを表示するコードに即した形で表示できたらと思います。
どうぞよろしくお願いいたします。

采纳的回答

Satoshi Kobayashi
二通り提示します。
imds = imageDatastore(fullfile(currentdirectory,categories),'IncludeSubfolders',true,'FileExtensions','.dcm','LabelSource', 'foldernames');
img = dicomread(imds.Files{1});
size(img)
imds = imageDatastore(fullfile(currentdirectory, categories),'IncludeSubfolders',true,'FileExtensions','.dcm','LabelSource', 'foldernames','ReadFcn',@dicomread);
img=readimage(imds,1);
size(img)
  1 个评论
ssk
ssk 2019-2-4
ご回答ありがとうございます。
無事表示されました!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 DICOM Format 的更多信息

Community Treasure Hunt

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

Start Hunting!