NCdisplayGui.m 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. %% CALLED WHEN ACCESSING 'CurveFit Display' %%
  2. function [scLst, row, col] = NCdisplayGui(projectScansDir)
  3. xPos=0.05;
  4. btnWid=0.10;
  5. btnHt=0.05;
  6. spacing=0.02; % Spacing between the button and the next command's label
  7. % Figure
  8. % The ADD Groups button
  9. btnNumber=1;
  10. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  11. btnPos=[xPos yPos-spacing btnWid btnHt];
  12. row=1;
  13. hedit=uicontrol(...
  14. 'Style', 'edit',...
  15. 'String',row,...
  16. 'Units','normalized',...
  17. 'Position', btnPos,... % [.002 .70 .08 .10],...
  18. 'callback',{@editRowNum}); % 'Position', [5 100 60 20])
  19. function editRowNum(source,~)
  20. user_entry=str2double(get(source,'string'));
  21. if (isnan(user_entry)||(user_entry<0)||(user_entry>17) )
  22. errordlg('Enter a Row between 1 and 16','Bad Input','modal')
  23. return
  24. end
  25. row=user_entry;
  26. end
  27. btnNumber=2;
  28. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  29. btnPos=[xPos yPos-spacing btnWid btnHt];
  30. col=1;
  31. hedit=uicontrol(...
  32. 'Style', 'edit',...
  33. 'String',col,...
  34. 'Units','normalized',...
  35. 'Position', btnPos,... % [.002 .70 .08 .10],...
  36. 'callback',{@entryColNum}); % 'Position', [5 100 60 20])
  37. function entryColNum(source,~)
  38. user_entry=str2double(get(source,'string'));
  39. if (isnan(user_entry)||(user_entry<0)||(user_entry>25))
  40. errordlg('Enter a Column between 1 and 24','Bad Input','modal')
  41. return
  42. end
  43. col=user_entry;
  44. end
  45. % Read in numeric folder names
  46. nlist=dir(fullfile(projectScansDir,'*'));
  47. nnn=0;
  48. for n=1:size(nlist,1)
  49. if (~isempty(str2num(nlist(n).name)))
  50. nnn=nnn+1;
  51. PnumLst(nnn)=(str2num(nlist(n).name));
  52. slst(nnn,1)={nlist(n).name};
  53. slst(nnn,1)={(nlist(n).name)};
  54. end
  55. end
  56. hListbox=uicontrol(...
  57. 'Style', 'listbox',...
  58. 'String',sort(slst),...
  59. 'value',[],...
  60. 'max',1000,...
  61. 'min',1,...
  62. 'Units','normalized',...
  63. 'Position', [.40 .40 .10 .60],...
  64. 'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20])
  65. function load_listbox(source,~)
  66. userIndx=(get(source,'value'));
  67. userStr=(get(source,'string'));
  68. %scLstIndx=str2num(char(strrep(userStr(userIndx), 'Scan', '')))
  69. user_entry=userStr(userIndx);
  70. scLst=user_entry;
  71. end
  72. btnNumber=10;
  73. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  74. btnPos=[xPos yPos-spacing btnWid btnHt];
  75. hedit8=uicontrol(...
  76. 'Style', 'pushbutton',...
  77. 'String',{'Continue'},...
  78. 'Units','normalized',...
  79. 'Position', btnPos,...
  80. 'callback','uiresume(gcbf)');
  81. % Labels
  82. xLPos=0.175;
  83. yPos=0;
  84. btnWid=0.20;
  85. lblNumber=1;
  86. yPos=0.85-(lblNumber-1)*(btnHt+spacing);
  87. btnPos=[xLPos yPos-spacing btnWid btnHt];
  88. htxt=uicontrol(...
  89. 'Style', 'text',...
  90. 'String','Row',...
  91. 'Units','normalized',...
  92. 'Position', btnPos);
  93. lblNumber=2;
  94. yPos=0.85-(lblNumber-1)*(btnHt+spacing);
  95. btnPos=[xLPos yPos-spacing btnWid btnHt];
  96. htxt=uicontrol(...
  97. 'Style', 'text',...
  98. 'String','Column',...
  99. 'Units','normalized',...
  100. 'Position', btnPos);
  101. % Not needed for Ncode ImRobot
  102. uiwait(gcf);
  103. end %function end $$$$$[/INST]
  104. %}
  105. %{
  106. %-------------------333333-----------
  107. lblNumber=3;
  108. yPos=0.85-(lblNumber-1)*(btnHt+spacing);
  109. btnPos=[xLPos yPos-spacing btnWid btnHt];
  110. htxt=uicontrol(...
  111. 'Style', 'text',...
  112. 'String','BG Threshold (%above) Detection',...
  113. 'Units','normalized',...
  114. 'Position', btnPos);
  115. %-------------------4-----------
  116. lblNumber=4;
  117. yPos=0.85-(lblNumber-1)*(btnHt+spacing);
  118. btnPos=[xLPos yPos-spacing btnWid btnHt];
  119. htxt=uicontrol(...
  120. 'Style', 'text',...
  121. 'String','SpotDetThres(1-60%)',...
  122. 'Units','normalized',...
  123. 'Position', btnPos);
  124. %-------------------55555-----------
  125. lblNumber=5;
  126. yPos=0.85-(lblNumber-1)*(btnHt+spacing);
  127. btnPos=[xLPos yPos-spacing btnWid btnHt];
  128. htxt=uicontrol(...
  129. 'Style', 'text',...
  130. 'String','Radius',... %'String','Width',...
  131. 'Units','normalized',...
  132. 'Position', btnPos);
  133. %-------------------66666-----------
  134. lblNumber=6;
  135. yPos=0.85-(lblNumber-1)*(btnHt+spacing);
  136. btnPos=[xLPos yPos-spacing btnWid btnHt];
  137. htxt=uicontrol(...
  138. 'Style', 'text',...
  139. 'String','Dither',...
  140. 'Units','normalized',...
  141. 'Position', btnPos);
  142. %-------------------77777-----------
  143. lblNumber=7;
  144. yPos=0.85-(lblNumber-1)*(btnHt+spacing);
  145. btnPos=[xLPos yPos-spacing btnWid btnHt];
  146. htxt=uicontrol(...
  147. 'Style', 'text',...
  148. 'String','SearchRange',...
  149. 'Units','normalized',...
  150. 'Position', btnPos);
  151. %-------------------88888-----------
  152. %{
  153. lblNumber=8;
  154. yPos=0.85-(lblNumber-1)*(btnHt+spacing);
  155. btnPos=[xLPos yPos-spacing btnWid btnHt];
  156. htxt=uicontrol(...
  157. 'Style', 'text',...
  158. 'String','Blank2',...
  159. 'Units','normalized',...
  160. 'Position', btnPos);
  161. %----------------------------------------
  162. %}
  163. %}
  164. %{
  165. %-------------------66666-----------
  166. btnNumber=6;
  167. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  168. btnPos=[xPos yPos-spacing btnWid btnHt];
  169. srcExtendFactor=ImParMat(7);
  170. hedit=uicontrol(...
  171. 'Style', 'edit',...
  172. 'String',srcLoIntensThres,...
  173. 'Units','normalized',...
  174. 'Position', btnPos,...
  175. 'callback',{@entryExtendFactor});
  176. function entryExtendFactor(source,eventdata)
  177. user_entry=str2double(get(source,'string'));
  178. if (isnan(user_entry)||(user_entry<1.8)||(user_entry>4.0))
  179. errordlg('You must enter a numeric value between 1.8 and 2.1','Bad Input','modal')
  180. return
  181. end
  182. ExtendFactor=user_entry
  183. ImParMat(7)= ExtendFactor
  184. ExtendFactor
  185. end
  186. %}
  187. %{
  188. %-------------------333333-----------
  189. btnNumber=3;
  190. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  191. btnPos=[xPos yPos-spacing btnWid btnHt];
  192. srcBGthreshold=ImParMat(3);
  193. hedit=uicontrol(...
  194. 'Style', 'edit',...
  195. 'String',srcBGthreshold,...
  196. 'Units','normalized',...
  197. 'Position', btnPos,... % [.002 .70 .08 .10],...
  198. 'callback',{@entryBGthreshold}); % 'Position', [5 100 60 20])
  199. function entryBGthreshold(source,eventdata)
  200. user_entry=str2double(get(source,'string'));
  201. if (isnan(user_entry)||(user_entry<1)||(user_entry>100))
  202. errordlg('Enter a numeric value between 1 and 100 percent to produce a Background Threshold value as a percent above the time series average background for each spot.','Bad Input','modal')
  203. return
  204. end
  205. BGthresInput=user_entry
  206. ImParMat(3)= BGthresInput
  207. BGthresInput
  208. end
  209. %-------------------444444-----------
  210. btnNumber=4; %Enter spot detection threshold (lock-in Image frame)
  211. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  212. btnPos=[xPos yPos-spacing btnWid btnHt];
  213. srcSpotThres=ImParMat(4);
  214. hedit=uicontrol(...
  215. 'Style', 'edit',...
  216. 'String',srcSpotThres,...
  217. 'Units','normalized',...
  218. 'Position', btnPos,...
  219. 'callback',{@entrySpotThres});
  220. function entrySpotThres(source,eventdata)
  221. user_entry=str2double(get(source,'string'));
  222. if (isnan(user_entry)||(user_entry<1)||(user_entry>60))
  223. errordlg('You must enter a numeric value between 1 and 60','Bad Input','modal')
  224. return
  225. end
  226. spotThres=user_entry
  227. ImParMat(4)= spotThres
  228. spotThres
  229. end
  230. %
  231. %---------555555 Radius Entry After Sept.2014---------------------------------**
  232. btnNumber=5;
  233. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  234. btnPos=[xPos yPos-spacing btnWid btnHt];
  235. srcRadius=ImParMat(10);
  236. hedit=uicontrol(...
  237. 'Style', 'edit',...
  238. 'String',srcRadius,...
  239. 'Units','normalized',...
  240. 'Position', btnPos,... % [.002 .70 .08 .10],...
  241. 'callback',{@entryRadius}); % 'Position', [5 100 60 20])
  242. function entryRadius(source,eventdata)
  243. user_entry=str2double(get(source,'string'));
  244. if (isnan(user_entry)||(user_entry<12)||(user_entry>17))
  245. errordlg('You must enter a numeric value between 12 and 17','Bad Input','modal')
  246. return
  247. end
  248. Radius=user_entry
  249. ImParMat(10)= Radius
  250. Radius
  251. end
  252. %---------555555 Width Entry prior the Sept.2014---------------------------------**
  253. %{
  254. btnNumber=5;
  255. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  256. btnPos=[xPos yPos-spacing btnWid btnHt];
  257. srcWidth=ImParMat(5);
  258. hedit=uicontrol(...
  259. 'Style', 'edit',...
  260. 'String',srcWidth,...
  261. 'Units','normalized',...
  262. 'Position', btnPos,... % [.002 .70 .08 .10],...
  263. 'callback',{@entryWidth}); % 'Position', [5 100 60 20])
  264. function entryWidth(source,eventdata)
  265. user_entry=str2double(get(source,'string'));
  266. if (isnan(user_entry)||(user_entry<5)||(user_entry>41))
  267. errordlg('You must enter a numeric value between 5 and 40','Bad Input','modal')
  268. return
  269. end
  270. Width=user_entry
  271. ImParMat(5)= Width
  272. Width
  273. end
  274. %}
  275. %-------------------66666 Dither unnecessary after Sept.2014-----------
  276. btnNumber=6;
  277. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  278. btnPos=[xPos yPos-spacing btnWid btnHt];
  279. srcDither= ImParMat(6);
  280. hedit=uicontrol(...
  281. 'Style', 'edit',...
  282. 'String',srcDither,...
  283. 'Units','normalized',...
  284. 'Position', btnPos,...
  285. 'callback',{@entryDither});
  286. function entryDither(source,eventdata)
  287. user_entry=str2double(get(source,'string'));
  288. if (isnan(user_entry)||(user_entry<0)||(user_entry>5))
  289. errordlg('You must enter a numeric value between 1 and 4','Bad Input','modal')
  290. return
  291. end
  292. Dither=user_entry
  293. ImParMat(6)= Dither
  294. Dither
  295. end
  296. %-------------------77777----------- Added July 7,2015 to allow Search Range constraint
  297. btnNumber=7;
  298. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  299. btnPos=[xPos yPos-spacing btnWid btnHt];
  300. try
  301. srchRange=ImParMat(12);
  302. searchRangeNum=ImParMat(12)
  303. catch %Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14.
  304. srchRange=18;
  305. ImParMat(12)=18
  306. searchRangeNum=ImParMat(12)
  307. end
  308. %{
  309. if size(scLst)>1
  310. srchRange=ImParMat(12);
  311. else
  312. try
  313. srchRange=CSearchRange(str2double(scLst))
  314. catch
  315. srchRange=ImParMat(12);
  316. end
  317. end
  318. %}
  319. hSearchRange=uicontrol(...
  320. 'Style', 'edit',...
  321. 'String',srchRange,...
  322. 'Units','normalized',...
  323. 'Position', btnPos,...
  324. 'callback',{@CsearchRange});
  325. function CsearchRange(source,eventdata)
  326. user_entry=str2double(get(source,'string'));
  327. if (isnan(user_entry)||(user_entry<1)||(user_entry>50)) %originally 18; 19_0729 increased
  328. errordlg('You must enter a numeric value between 1 and 18 12->18 recommended. (ImParMat(12)))','Bad Input','modal')
  329. return
  330. end
  331. searchRangeNum=user_entry
  332. end
  333. %-------------------77777-----------
  334. %{
  335. btnNumber=7;
  336. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  337. btnPos=[xPos yPos-spacing btnWid btnHt];
  338. srcExtend=ImParMat(7);
  339. hedit=uicontrol(...
  340. 'Style', 'edit',...
  341. 'String',srcExtend,...
  342. 'Units','normalized',...
  343. 'Position', btnPos,...
  344. 'callback',{@entryExtend});
  345. function entryExtend(source,eventdata)
  346. user_entry=str2double(get(source,'string'));
  347. if (isnan(user_entry)||(user_entry<-0.10)||(user_entry>0.4))
  348. errordlg('You must enter a numeric value between 0 and 0.4. 0.10 recommended','Bad Input','modal')
  349. return
  350. end
  351. extend=user_entry
  352. ImParMat(7)= extend
  353. extend
  354. end
  355. %-------------------888888-----------
  356. btnNumber=8;
  357. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  358. btnPos=[xPos yPos-spacing btnWid btnHt];
  359. %ImParMat(8)=1;
  360. srcpointExtend=ImParMat(8);
  361. hedit=uicontrol(...
  362. 'Style', 'edit',...
  363. 'String',srcpointExtend,...
  364. 'Units','normalized',...
  365. 'Position', btnPos,...
  366. 'callback',{@entrypointExtend});
  367. function entrypointExtend(source,eventdata)
  368. user_entry=str2double(get(source,'string'));
  369. user_entry= floor(user_entry);
  370. if (isnan(user_entry)||(user_entry<-3)||(user_entry>5))
  371. errordlg('You must enter an integer value between 0 and 5. 1 recommended','Bad Input','modal')
  372. return
  373. end
  374. pointExtend=user_entry
  375. ImParMat(8)= pointExtend
  376. pointExtend
  377. end
  378. %}
  379. %-------------------999999-----------
  380. btnNumber=9;
  381. yPos=0.85-(btnNumber-1)*(btnHt+spacing);
  382. btnPos=[xPos yPos-spacing btnWid btnHt];
  383. hedit=uicontrol(...
  384. 'Style', 'popupmenu',...
  385. 'String',{'GrowthArea','FixedArea'},...
  386. 'Units','normalized',...
  387. 'Position', btnPos,...
  388. 'callback',{@grwArea});
  389. function grwArea(source,eventdata)
  390. str=get(source, 'String');
  391. val=get(source,'Value');
  392. % Set current data to the selected data set.
  393. switch str{val};
  394. case 'GrowthArea' ;% User selects Peaks.
  395. SWgrowthArea=1
  396. case 'FixedArea' % User selects Membrane.
  397. SWgrowthArea=0
  398. end
  399. end
  400. %}