// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // ! This script is provided "as is" by Applied Maths. ! // ! You are free to use and modify this script for your own needs. ! // ! Redistribution or reproduction of the script is prohibited. ! // ! DISCLAIMER: ! // ! Improper use of scripts may corrupt your database. ! // ! Running this script is entirely at your own responsibility. ! // ! Applied Maths accepts no lialibility for any consequences ! // ! resulting from its use. ! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer bandcount,i,j,k,ok; string str_bandpos[],str_tol,experlist,expername; string methodlist,method; integer searchneg,useor; DIALOG dlg; string key; FPRINT fp; float bandpos[],tol; float ps,h,w; integer present[]; //Fills a list with valid experiments for i=1 to DbGetExperCount do if dbGetExperClass(i)="FPR" then { if length(expername)=0 then expername=DbGetExperName(i); experlist=experlist+DbGetExperName(i)+" "; } DlgAddText(dlg,"Select fingerprint type:",15,15,150,15); DlgAddList(dlg,experlist,expername,15,35,150,150,"LIST"); methodlist="Add to list Replace list Search in list"; method="Add to list"; DlgAddText(dlg,"Selection method:",15,190,150,15); DlgAddList(dlg,methodlist,method,15,210,150,53,"LIST"); DlgAddCheck(dlg,"Negative search",searchneg,15,270,150,15); DlgAddCheck(dlg,"Combine using OR",useor,15,290,150,15); DlgAddText(dlg,"Specify bands positions~nto include (in %):",200,15,150,30); bandcount=7; for i=1 to bandcount do { str_bandpos[i]=""; DlgAddEdit(dlg,str_bandpos[i],240,27+i*22,60,16); } str_tol="1.0"; DlgAddText(dlg,"Position tolerance (in %):",200,210,150,15); DlgAddEdit(dlg,str_tol,240,235,60,20); //Shows the dialog box ok=0; while not(ok) do { if not(DlgShow(dlg,"Select entries according to bands",340,400)) then stop; ok=1; if length(expername)=0 then ok=0; if length(str_tol)=0 then ok=0; } tol=val(str_tol); for i=1 to bandcount do { bandpos[i]=-1; if length(str_bandpos[i])>0 then bandpos[i]=val(str_bandpos[i]); } //loops through the database for i=1 to DbGetEntryCount do { key=DbGetEntryKey(i); if method="Replace list" then DbSetSel(key,0); FprLoadNorm(fp,key,expername); for j=1 to bandcount do present[j]=(bandpos[j]<0); for j=1 to FprGetBandCount(fp) do { FprGetBandInfo(fp,j,ps,h,w); for k=1 to bandcount do if not(present[k]) then if abs(ps-bandpos[k])<=tol then present[k]=1; } if not(useor) then { ok=1; for j=1 to bandcount do if not(present[j]) then ok=0; } if useor then { ok=0; for j=1 to bandcount do if (bandpos[j]>=0) and (present[j]) then ok=1; } if method="Search in list" then ok= (ok and DbGetSel(key)); if searchneg then ok=not(ok); if ok then DbSetSel(key,1); if method="Search in list" then DbSetSel(key,ok); }