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

6 visualizzazioni (ultimi 30 giorni)
ssk
ssk il 3 Feb 2019
Commentato: ssk il 4 Feb 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ファイルを表示するコードに即した形で表示できたらと思います。
どうぞよろしくお願いいたします。

Risposta accettata

Satoshi Kobayashi
Satoshi Kobayashi il 4 Feb 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 Commento
ssk
ssk il 4 Feb 2019
ご回答ありがとうございます。
無事表示されました!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su DICOM Format in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!