Reputation: 51
I want to calculate the comparison between my Ground Truth and Segmentation result, both were saved in different directory in main_folder
, and I want to access it, but it seemed that I can't access the data inside the directory. Can someone help me whats wrong with the code.
Here is the code :
addpath('main')
currentDir=pwd; % current directory in main_folder
cases=dir('Casos_img');
interp=1;
ori=1;
ASMvGT=zeros(0,1);
for c=3:size(cases,1)
caseName=cases(c).name;
gt_case=[currentDir '\Casos_combine\' cases(c).name]; %'
% ground truth combined
[~,~,~,volumeL,volumeR]=load_file(gt_case,0,ori);
ind= volumeR>0;volumeGT=volumeL;volumeGT(ind)=1;
[GT1 GT2 GT3]=ind2sub(size(volumeGT),find(volumeGT>0));GT=[GT1 GT2 GT3];
segm_case=[currentDir '\Casos_img\' cases(c).name]; %'
[~,~,~,volumeL,volumeR]=load_file(segm_case,0,0);
ind= volumeR>0;volumeS=volumeL;volumeS(ind)=1;
[ASM1 ASM2 ASM3]=ind2sub(size(volumeS),find(volumeS>0));ASM=[ASM1 ASM2 ASM3];
[hd,~]=HausdorffDist(GT,ASM);
ASMvGT=[ASMvGT;hd];%/numel(volumeGT)];
end
save resultshd ASMvGT
I can't get the volume with load_file function, because when I debug it the problem is I can't acces the data inside the directory. Please help me with this, thank you in advance.
Upvotes: 1
Views: 282
Reputation: 9075
Use addpath(genpath("___address of main_folder___"))
Put the address of your main folder above. Replace the first line of your code with above line. You have only written addpath('main')
. Therefore, it does not add subfolders and thats why probably you are getting error. genpath
creates list of subfolders and thus if you combine addpath
and genpath
, the current folder as well as all of its subfolders will get added.
Upvotes: 0
Reputation: 114786
use chdir
and fullfile
command to create file names with full paths.
Upvotes: 1