I am trying to use a listbox multiselection to add images together and median combine for SNR improvement comparison reasons. I first allow the multiselection from the list box using:
%Get selected files from listbox selection
set(handles.listbox1, 'Max',2,'Min',0) %allow multi selection
list=handles.listbox1; temp = get(list, 'String'); selected = temp(get(list, 'Value')); set(list, 'Value', []); %Clear current selection for next time
I then use the following to perform the sum and median combine:
l=length(selected)path=getappdata(0,'Folder'); %Get the folder
imSum=[]; %initialise
imStack=[];for i=1:l file=fullfile(path,selected{i}) im=double(imread(file)); imSum=imSum+im; imStack=cat(3,imMed,im)end imMed=median(ImgStack,3);
However, I get an error:
Error using + Matrix dimensions must agree.Error in MultiImageanalysis>pushbuttonAddImages_Callback (line 1372) imSum=imSum+im;
Best Answer