MATLAB Answers

DICOM data as input for Deep Learning

6 views (last 30 days)
Ana Mota
Ana Mota on 5 May 2020
Commented: Ana Mota on 11 May 2020
Dear colleagues!
I am new with Deep Learning and I am having problems in introducing DICOM data as input into imagedatastore in order to train a network.
I have followed the steps described here https://www.mathworks.com/help/deeplearning/ug/preprocess-volumes-for-deep-learning.html to "create an ImageDatastore from a collection of DICOM files".
I am able to load the .mat files and I see de 3D volumes for each case (I have 2 classes, each with three 3D volume data sets)
The problem is when I try to "trainNetwork", I get an error:
" Error using matlab.io.datastore.ImageDatastore/read (line 77)
Unable to read file:
'C:\Users\...\TrainingData\...\MATFiles\Class1\Case04.mat'."
Any help please???
(I have multiple clinical datasets. Each dataset is stored in a different folder and it is represented by multiple slices)
Thank you in advance!

  0 Comments

Sign in to comment.

Accepted Answer

Mahesh Taparia
Mahesh Taparia on 11 May 2020
Hi
It seems that you are unable to load the mat file into the network. Your input is in mat file format. So, create a custom read function which read the files in that specified format and then pass it to the network. For example, call the read function after declaring the image datastore as given below:
datastore.ReadFcn=@readFcn_mat;
Define the read function as per your file. For example, consider a function given below:
function I = readFcn_mat(filename)
I = load(filename);
I = I.Input; %%%%change here as per your dataset
end
Hope it will helps.

  3 Comments

Ana Mota
Ana Mota on 11 May 2020
Thank you very much for your answer!!
I am trying to do as you said but I don't understand the line
"I = I.Input; %%%%change here as per your dataset"
Did you mean
"I = I.V;" ??
Thank you!!
Mahesh Taparia
Mahesh Taparia on 11 May 2020
Yes, if the input data is stored in variable V then it will be
I = I.V;
Ana Mota
Ana Mota on 11 May 2020
Great! I think it is working now!! Thank you very much!!!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by