📄 guisaliency.html
字号:
0266 [newImg,err] = <a href="initializeImage.html" class="code" title="function [Img,err] = initializeImage(varargin);">initializeImage</a>([newPath newName]);0267 <span class="keyword">if</span> ~isempty(err)0268 beep;0269 uiwait(warndlg(sprintf(<span class="string">'%s is not a valid image!'</span>,newName),<span class="keyword">...</span>0270 <span class="string">'Not a valid image'</span>,<span class="string">'modal'</span>));0271 defName = <span class="string">''</span>;0272 <span class="keyword">end</span>0273 <span class="keyword">end</span>0274 0275 <span class="comment">% image is okay, set as img for analyses</span>0276 img = <a href="checkImageSize.html" class="code" title="function img = checkImageSize(img,mode,targetSize)">checkImageSize</a>(newImg,<span class="string">'GUI'</span>);0277 set(handles.ImageName,<span class="string">'String'</span>,newName);0278 <span class="keyword">if</span> (params.foaSize < 0)0279 p = <a href="defaultSaliencyParams.html" class="code" title="function params = defaultSaliencyParams(varargin)">defaultSaliencyParams</a>(img.size);0280 params.foaSize = p.foaSize;0281 <a href="#_sub33" class="code" title="subfunction setShapeMode(handles)">setShapeMode</a>(handles);0282 <span class="keyword">end</span>0283 0284 <span class="comment">% Replacing an old image? output separator</span>0285 <span class="keyword">if</span> strcmp(prevState,<span class="string">'MapsComputed'</span>)0286 fprintf(<span class="string">'---------------------------\n'</span>);0287 <span class="keyword">end</span>0288 0289 <span class="comment">% some house keeping</span>0290 state = <span class="string">'ImageLoaded'</span>;0291 <a href="#_sub4" class="code" title="subfunction checkColorParams(handles)">checkColorParams</a>(handles);0292 <a href="#_sub43" class="code" title="subfunction updateImg(handles)">updateImg</a>(handles);0293 <a href="#_sub48" class="code" title="subfunction updateLocImg(handles)">updateLocImg</a>(handles);0294 <a href="#_sub3" class="code" title="subfunction setState(h,newState)">setState</a>(handles);0295 <a href="debugMsg.html" class="code" title="function debugMsg(message,varargin)">debugMsg</a>(sprintf(<span class="string">'Loaded image %s.\n'</span>,img.filename));0296 <span class="keyword">return</span>;0297 0298 0299 0300 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0301 <span class="comment">% Feature selection and weights %</span>0302 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0303 0304 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0305 <span class="comment">% get the values for a particular feature from the GUI controls</span>0306 <a name="_sub8" href="#_subfunctions" class="code">function getFeature(hSelect,hWeight,handles)</a>0307 <span class="keyword">global</span> params;0308 <span class="keyword">if</span> ~<a href="#_sub6" class="code" title="subfunction response = confirmParamsChange(handles)">confirmParamsChange</a>(handles)0309 <span class="keyword">return</span>;0310 <span class="keyword">end</span>0311 name = get(hSelect,<span class="string">'Tag'</span>);0312 idx = strmatch(name,params.features);0313 0314 <span class="keyword">if</span> get(hSelect,<span class="string">'Value'</span>)0315 set(hWeight,<span class="string">'Enable'</span>,<span class="string">'on'</span>);0316 0317 <span class="comment">% need to add this feature?</span>0318 <span class="keyword">if</span> isempty(idx)0319 params.features = {params.features{:},name};0320 params.weights = [params.weights 1];0321 idx = strmatch(name,params.features);0322 <span class="keyword">end</span>0323 0324 <span class="comment">% get weight value from text box</span>0325 w = str2num(get(hWeight,<span class="string">'String'</span>));0326 <span class="keyword">if</span> ~isempty(w)0327 params.weights(idx(1)) = w(1);0328 <span class="keyword">end</span>0329 <span class="keyword">else</span>0330 set(hWeight,<span class="string">'Enable'</span>,<span class="string">'off'</span>);0331 0332 <span class="comment">% need to remove this feature?</span>0333 <span class="keyword">if</span> ~isempty(idx)0334 newIdx = setdiff([1:length(params.features)],idx);0335 params.features = {params.features{newIdx}};0336 parmas.weights = [params.weights(newIdx)];0337 <span class="keyword">end</span>0338 <span class="keyword">end</span>0339 <span class="keyword">return</span>;0340 0341 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0342 <span class="comment">% set the GUI controls for a particular feature</span>0343 <a name="_sub9" href="#_subfunctions" class="code">function setFeature(hSelect,hWeight)</a>0344 <span class="keyword">global</span> params;0345 name = get(hSelect,<span class="string">'Tag'</span>);0346 idx = strmatch(name,params.features);0347 0348 <span class="keyword">if</span> isempty(idx)0349 set(hSelect,<span class="string">'Value'</span>,0);0350 set(hWeight,<span class="string">'Enable'</span>,<span class="string">'off'</span>);0351 <span class="keyword">else</span>0352 set(hSelect,<span class="string">'Value'</span>,1);0353 set(hWeight,<span class="string">'Enable'</span>,<span class="string">'on'</span>,<span class="string">'String'</span>,num2str(params.weights(idx(1))));0354 <span class="keyword">end</span>0355 <span class="keyword">return</span>;0356 0357 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0358 <span class="comment">% enable/disable a vector of GUI elements</span>0359 <a name="_sub10" href="#_subfunctions" class="code">function setEnable(value,hs)</a>0360 enableStrings = {<span class="string">'off'</span>,<span class="string">'on'</span>};0361 <span class="keyword">for</span> h = 1:length(hs)0362 set(hs(h),<span class="string">'Enable'</span>,enableStrings{value+1});0363 <span class="keyword">end</span>0364 <span class="keyword">return</span>;0365 0366 0367 <span class="comment">%%%% Color %%%%</span>0368 0369 <span class="comment">% Color checkbox</span>0370 <a name="_sub11" href="#_subfunctions" class="code">function Color_Callback(hObject, eventdata, handles)</a>0371 <a href="#_sub8" class="code" title="subfunction getFeature(hSelect,hWeight,handles)">getFeature</a>(handles.Color,handles.WeightCol,handles);0372 <a href="#_sub9" class="code" title="subfunction setFeature(hSelect,hWeight)">setFeature</a>(handles.Color,handles.WeightCol);0373 0374 <span class="comment">% Color weight textbox</span>0375 <a name="_sub12" href="#_subfunctions" class="code">function WeightCol_Callback(hObject, eventdata, handles)</a>0376 <a href="#_sub8" class="code" title="subfunction getFeature(hSelect,hWeight,handles)">getFeature</a>(handles.Color,handles.WeightCol,handles);0377 <a href="#_sub9" class="code" title="subfunction setFeature(hSelect,hWeight)">setFeature</a>(handles.Color,handles.WeightCol);0378 0379 <span class="comment">% Create color weight textbox</span>0380 <a name="_sub13" href="#_subfunctions" class="code">function WeightCol_CreateFcn(hObject, eventdata, handles)</a>0381 <span class="keyword">if</span> ispc && isequal(get(hObject,<span class="string">'BackgroundColor'</span>), get(0,<span class="string">'defaultUicontrolBackgroundColor'</span>))0382 set(hObject,<span class="string">'BackgroundColor'</span>,<span class="string">'white'</span>);0383 <span class="keyword">end</span>0384 0385 0386 <span class="comment">%%%% Intensities %%%%</span>0387 0388 <span class="comment">% Intensities checkbox</span>0389 <a name="_sub14" href="#_subfunctions" class="code">function Intensities_Callback(hObject, eventdata, handles)</a>0390 <a href="#_sub8" class="code" title="subfunction getFeature(hSelect,hWeight,handles)">getFeature</a>(handles.Intensities,handles.WeightInt,handles);0391 <a href="#_sub9" class="code" title="subfunction setFeature(hSelect,hWeight)">setFeature</a>(handles.Intensities,handles.WeightInt);0392 0393 <span class="comment">% Intensities weight textbox</span>0394 <a name="_sub15" href="#_subfunctions" class="code">function WeightInt_Callback(hObject, eventdata, handles)</a>0395 <a href="#_sub8" class="code" title="subfunction getFeature(hSelect,hWeight,handles)">getFeature</a>(handles.Intensities,handles.WeightInt,handles);0396 <a href="#_sub9" class="code" title="subfunction setFeature(hSelect,hWeight)">setFeature</a>(handles.Intensities,handles.WeightInt);0397 0398 <span class="comment">% create Intensities weight textbox</span>0399 <a name="_sub16" href="#_subfunctions" class="code">function WeightInt_CreateFcn(hObject, eventdata, handles)</a>0400 <span class="keyword">if</span> ispc && isequal(get(hObject,<span class="string">'BackgroundColor'</span>), get(0,<span class="string">'defaultUicontrolBackgroundColor'</span>))0401 set(hObject,<span class="string">'BackgroundColor'</span>,<span class="string">'white'</span>);0402 <span class="keyword">end</span>0403 0404 0405 <span class="comment">%%%% Orientations %%%%</span>0406 0407 <span class="comment">% Orientations checkbox</span>0408 <a name="_sub17" href="#_subfunctions" class="code">function Orientations_Callback(hObject, eventdata, handles)</a>0409 <a href="#_sub8" class="code" title="subfunction getFeature(hSelect,hWeight,handles)">getFeature</a>(handles.Orientations,handles.WeightOri,handles);0410 <a href="#_sub9" class="code" title="subfunction setFeature(hSelect,hWeight)">setFeature</a>(handles.Orientations,handles.WeightOri);0411 <a href="#_sub10" class="code" title="subfunction setEnable(value,hs)">setEnable</a>(get(hObject,<span class="string">'Value'</span>),[handles.NumOriText,handles.NumOri]);0412 0413 <span class="comment">% Orientaions weight textbox</span>0414 <a name="_sub18" href="#_subfunctions" class="code">function WeightOri_Callback(hObject, eventdata, handles)</a>0415 <a href="#_sub8" class="code" title="subfunction getFeature(hSelect,hWeight,handles)">getFeature</a>(handles.Orientations,handles.WeightOri,handles);0416 <a href="#_sub9" class="code" title="subfunction setFeature(hSelect,hWeight)">setFeature</a>(handles.Orientations,handles.WeightOri);0417 0418 <span class="comment">% create Orientations weight textbox</span>0419 <a name="_sub19" href="#_subfunctions" class="code">function WeightOri_CreateFcn(hObject, eventdata, handles)</a>0420 <span class="keyword">if</span> ispc && isequal(get(hObject,<span class="string">'BackgroundColor'</span>), get(0,<span class="string">'defaultUicontrolBackgroundColor'</span>))0421 set(hObject,<span class="string">'BackgroundColor'</span>,<span class="string">'white'</span>);0422 <span class="keyword">end</span>0423 0424 <span class="comment">% number of orientations textbox</span>0425 <a name="_sub20" href="#_subfunctions" class="code">function NumOri_Callback(hObject, eventdata, handles)</a>0426 <span class="keyword">global</span> params0427 <span class="keyword">if</span> <a href="#_sub6" class="code" title="subfunction response = confirmParamsChange(handles)">confirmParamsChange</a>(handles)0428 n = str2num(get(hObject,<span class="string">'String'</span>));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -