How to read multiple files in a folder and extract information for each one

1 回表示 (過去 30 日間)
Mihnea Constantin
Mihnea Constantin 2020 年 11 月 25 日
回答済み: Mahesh Taparia 2020 年 12 月 15 日
I have a code that extracts multiple features on one Dicom slice, from a folder that has 350 slices
I now need to make a for loop that will allow me to extract the same features for the remaining Dicom slices in the folder, and then later take the average of each feature
Can anyone suggest how i can do this?
Here is the code I have for doing it for just one of the slices
%%
im=double(dicomread('slice1.dcm'));
[LL1,LH1,HL1,HH1] = dwt2(im,'sym4','mode','per');
[LL2,LH2,HL2,HH2] = dwt2(LL1,'sym4','mode','per');
[LL3,LH3,HL3,HH3] = dwt2(LL2,'sym4','mode','per');
%%
GLSZM_Original = getGLSZMtextures(im)
GLSZM_First_Depthlevel = getGLSZMtextures(LL1)
GLSZM_Second_Depthlevel = getGLSZMtextures(LL2)
GLSZM_Third_Depthlevel = getGLSZMtextures(LL3)
%%
GLCM_Original = getGLCMtextures(abs(im))
GLCM_First_Depthlevel = getGLCMtextures(abs(LL1))
GLCM_Second_Depthlevel = getGLCMtextures(abs(LL2))
GLCM_Third_Depthlevel = getGLCMtextures(abs(LL3))
%%
GLRLM_Original = getGLRLMtextures(im)
GLRLM_First_Depthlevel = getGLRLMtextures(LL1)
GLRLM_Second_Depthlevel = getGLRLMtextures(LL2)
GLRLM_Third_Depthlevel = getGLRLMtextures(LL3)

回答 (1 件)

Mahesh Taparia
Mahesh Taparia 2020 年 12 月 15 日
Hi
You can use dir function to list out the content of a folder. After this use a for loop, in that you can keep the file reading and further processing part. You can use fullfile function if data is present in subfolder. You can refer this documentation for more help. The similar question has been already answered here. Hope it will help!

カテゴリ

Help Center および File ExchangeDICOM Format についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by