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

5 vues (au cours des 30 derniers jours)
ssk
ssk le 3 Fév 2019
Commenté : ssk le 4 Fév 2019
プログラミング初心者です。
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ファイルを表示するコードに即した形で表示できたらと思います。
どうぞよろしくお願いいたします。

Réponse acceptée

Satoshi Kobayashi
Satoshi Kobayashi le 4 Fév 2019
二通り提示します。
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 commentaire
ssk
ssk le 4 Fév 2019
ご回答ありがとうございます。
無事表示されました!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur DICOM Format dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!