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

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

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu DICOM Format finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!