| function exec_evaluation_contrast_speckle(path_scan,path_phantom,path_img,flag_simu,flag_display,path_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| category = [1 11 75];
|
|
|
|
|
|
|
| flag_simu = uint8(str2num(flag_simu));
|
| flag_display = uint8(str2num(flag_display));
|
|
|
|
|
|
|
| scan = linear_scan();
|
| scan.read_file(path_scan);
|
| pht = us_phantom();
|
| pht.read_file(path_phantom);
|
| image = us_image();
|
| image.read_file(path_img);
|
|
|
|
|
|
|
| testing_contrast = us_contrast();
|
| testing_contrast.pht = pht;
|
| testing_contrast.scan = scan;
|
| testing_contrast.image = image;
|
| testing_contrast.flagDisplay = flag_display;
|
| testing_contrast.evaluate();
|
|
|
|
|
|
|
| testing_speckle = us_speckle_quality();
|
| testing_speckle.pht = pht;
|
| testing_speckle.scan = scan;
|
| testing_speckle.image = image;
|
| testing_speckle.flagDisplay = flag_display;
|
| testing_speckle.evaluate();
|
|
|
|
|
|
|
| pw_list = testing_contrast.getNumberPlaneWavesList();
|
| indexCategory = [0 0 0];
|
| selected_pw = [];
|
|
|
|
|
|
|
| its = 0;
|
| for c=1:length(category)
|
| idx = find(pw_list==category(c));
|
| if (~isempty(idx))
|
| indexCategory(c) = idx;
|
| its = its+1;
|
| selected_pw(its) = category(c);
|
| end
|
| end
|
|
|
|
|
|
|
| pw_bonus = setdiff(pw_list,selected_pw);
|
| if ( (length(pw_bonus)>1) || isempty(pw_bonus) )
|
| pw_bonus = 0;
|
| end
|
|
|
|
|
|
|
| fid = fopen(path_output,'w');
|
|
|
|
|
| for c=1:length(category)
|
|
|
| fprintf(fid,'#C%d \n\n',category(c));
|
| if ( indexCategory(c)~=0 )
|
| idx = indexCategory(c);
|
| score_contrast = squeeze(testing_contrast.score(idx,:,:));
|
| writeScoreContrast(fid,score_contrast,flag_simu);
|
| score_speckle = squeeze(testing_speckle.score(idx,:));
|
| writeScoreSpeckle(fid,score_speckle);
|
| end
|
| fprintf(fid,'\n#END\n\n');
|
| end
|
|
|
|
|
| if (pw_bonus == 0)
|
| fprintf(fid,'#BONUS-NONE \n\n');
|
| else
|
| fprintf(fid,'#BONUS-C%d \n\n',pw_bonus);
|
| idx = find(pw_list==pw_bonus);
|
| score = squeeze(testing_contrast.score(idx(1),:,:));
|
| writeScoreContrast(fid,score,flag_simu);
|
| score_speckle = squeeze(testing_speckle.score(idx(1),:));
|
| writeScoreSpeckle(fid,score_speckle);
|
| end
|
| fprintf(fid,'\n#END\n\n');
|
|
|
| fclose(fid);
|
|
|
| end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| function writeScoreContrast(fid,score,flag_simu)
|
|
|
| if (flag_simu==1)
|
| writeSimulationScoreContrast(fid,score);
|
| else
|
| writeExperimentScoreContrast(fid,score);
|
| end
|
|
|
| end
|
|
|
|
|
|
|
| function writeSimulationScoreContrast(fid,score)
|
|
|
|
|
| fprintf(fid,'Mean contrast scores (dB): %.2f \n\n',mean(score));
|
|
|
|
|
|
|
|
|
|
|
| fprintf(fid,'Left column targets \n');
|
| for k=4:6
|
| fprintf(fid,'%.2f\n',score(k));
|
| end
|
| fprintf(fid,'\n');
|
|
|
|
|
| fprintf(fid,'Middle column targets \n');
|
| for k=1:3
|
| fprintf(fid,'%.2f\n',score(k));
|
| end
|
| fprintf(fid,'\n');
|
|
|
|
|
| fprintf(fid,'Right column targets \n');
|
| for k=7:9
|
| fprintf(fid,'%.2f\n',score(k));
|
| end
|
| fprintf(fid,'\n');
|
|
|
| end
|
|
|
|
|
|
|
| function writeExperimentScoreContrast(fid,score)
|
|
|
|
|
| fprintf(fid,'Mean contrast scores (dB): %.2f \n\n',mean(score));
|
|
|
|
|
|
|
|
|
|
|
| fprintf(fid,'Middle column targets \n');
|
| for k=1:2
|
| fprintf(fid,'%.2f\n',score(k));
|
| end
|
| fprintf(fid,'\n');
|
|
|
| end
|
|
|
|
|
|
|
| function writeScoreSpeckle(fid,score)
|
|
|
|
|
| fprintf(fid,'PENALITY: ');
|
| if ~isempty(find(score==0,1))
|
| fprintf(fid,'-40\n');
|
| else
|
| fprintf(fid,'0\n');
|
| end
|
| fprintf(fid,'Speckle quality (from Kolmogorov-Smirnov test) \n');
|
|
|
| end
|
|
|
|
|