#pragma rtGlobals=3 // Use modern global access method and strict wave access. #include #include Function SetImageFolder(ctrlName) : ButtonControl String ctrlName SVAR NewImageList = NewImageList SVAR PreImageList = PreImageList SVAR TotalImages = totalImages If(StringMatch(ctrlName, "NewImages" )) newpath/Q/O NewImages NewImageList = IndexedFile(NewImages, -1, ".jpg") TotalImages = "of " + num2str(itemsinlist(NewImageList))+" images" else newpath/Q/O PreImages PreImageList = IndexedFile(PreImages, -1, ".jpj") endif End Window Scrub() : Graph PauseUpdate; Silent 1 // building window... Display /W=(451,45,1119,553) as "New Scrub Mark" AppendImage/T ImageNew ModifyImage ImageNew ctab= {*,*,Grays,0} ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 ModifyGraph mirror=2 ModifyGraph nticks(left)=10,nticks(top)=12 ModifyGraph minor=1 ModifyGraph fSize=9 ModifyGraph standoff=0 ModifyGraph tkLblRot(left)=90 ModifyGraph btLen=3 ModifyGraph tlOffset=-2 SetAxis/A/R left Cursor/P/I/H=1/C=(0,65535,0) A ImageNew 68,239 ShowInfo ControlBar 50 Button NewImages,pos={22,5},size={50,40},proc=SetImageFolder,title="New \rImage" Button PreviousImage,pos={93,5},size={50,40},proc=SetImageFolder,title="Pre \rImage" Button ZoomOut,pos={604,5},size={50,40},proc=ZoomOut,title="Zoom\rOut" Button ZoomOut,font="Arial",fSize=12,fStyle=1 PopupMenu GoToBump,pos={494,13},size={93,20},proc=PickBump,title="Go To Bump" PopupMenu GoToBump,mode=1,popvalue="1",value= #"\"1;2;3;4;5;6;7;8;10;11\"" Button Start,pos={161,6},size={50,40},title="Start\rReview",font="Arial" Button Start,fSize=12,fStyle=1 SetVariable ImageNum,pos={224,19},size={85,17},title="Image",font="Arial" SetVariable ImageNum,fSize=12,limits={-inf,inf,0},value= ImageNum TitleBox TotalImages,pos={317,20},size={62,12},frame=0,variable= TotalImages SetDrawLayer UserFront SetDrawEnv xcoord= top,ycoord= left,linefgc= (64000,20000,10000),fillpat= 0 SetDrawEnv save DrawRect 118.916666666667,444.384615384615,178.688311688312,505.424242424242 SetWindow kwTopWin,hook(myHook)=MywindowHook EndMacro Window PreScrub() : Graph PauseUpdate; Silent 1 // building window... Display /W=(40,44,472,335) as "Previous Image" AppendImage/T ImagePre ModifyImage ImagePre ctab= {*,*,Grays,0} ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 ModifyGraph mirror=2 ModifyGraph nticks(left)=10,nticks(top)=12 ModifyGraph minor=1 ModifyGraph fSize=9 ModifyGraph standoff=0 ModifyGraph tkLblRot(left)=90 ModifyGraph btLen=3 ModifyGraph tlOffset=-2 SetAxis/A/R left EndMacro Function PadImage() Wave Pad = Pad Wave Padpre = PadPre Wave ImageNew = ImageNew Wave ImagePre = ImagePre Pad = NaN PadPre = Nan Variable StartP,StartQ StartP = Max(-(Pcsr(A)-25),0) StartQ = Max(-(Qcsr(A)-25),0) print Pcsr(A),Qcsr(A) pad[StartP,][StartQ,] = ImageNew[pcsr(A)-25 +p][qcsr(A) -25 +q][2] padPre[startP,][StartQ,] = ImagePre[pcsr(A)-25 +p][qcsr(A) -25 +q] End Window PadInset() : Graph PauseUpdate; Silent 1 // building window... Display /W=(252,278,449,477) as "Inset" AppendImage/T Pad ModifyImage Pad ctab= {*,*,Grays,0} ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 ModifyGraph mirror=2 ModifyGraph nticks=3 ModifyGraph minor=1 ModifyGraph fSize=9 ModifyGraph standoff=0 ModifyGraph tkLblRot(left)=90 ModifyGraph btLen=3 ModifyGraph tlOffset=-2 SetAxis/A/R left SetDrawLayer UserFront SetDrawEnv xcoord= top,ycoord= left,linefgc= (65535,0,52428) DrawLine 0,25,50,25 SetDrawEnv xcoord= top,ycoord= left,linefgc= (65535,0,52428) DrawLine 25,0,25,50 EndMacro Window PadInsetPre() : Graph PauseUpdate; Silent 1 // building window... Display /W=(298,99,428,229) as "Previous" AppendImage/T PadPre ModifyImage PadPre ctab= {*,*,Grays,0} ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 ModifyGraph mirror=2 ModifyGraph nticks=3 ModifyGraph minor=1 ModifyGraph fSize=9 ModifyGraph standoff=0 ModifyGraph tkLblRot(left)=90 ModifyGraph btLen=3 ModifyGraph tlOffset=-2 SetAxis/A/R left EndMacro Function DefinePad() Wave ImageNew =ImageNew Make/O /N=51 PadX,PadY padX = ImageNew[pcsr(A)-25 +p][Qcsr(A)] SetScale/P x, (pcsr(A)-25)*2, 2, PadX PadY = ImageNew[pcsr(A)][Qcsr(A)-25+p] SetScale/P x, (Qcsr(A)-25)*2, 2, PadY SetDrawLayer/W=Scrub /K Userfront Variable,right,left, top, bottom Edgestats/Q/R=[25,0]/L=(padx[25],Wavemax(Padx,0,25)) PadX left=V_Edgeloc2 Edgestats/Q/R=[25,50]/L=(padx[25],Wavemax(Padx,25,50)) PadX right = V_EdgeLoc2 EdgeStats/Q/R=[25,0]/L=(PadY[25],Wavemax(PadY,0,25)) PadY top = V_Edgeloc2 EdgeStats/Q/R=[25,50] /L=(PadY[25],Wavemax(PadY,25,50))PadY bottom= V_EdgeLoc2 setdrawenv /W=scrub xcoord=top,ycoord=left,fillpat=0,linefgc=(64000,20000,10000), save DrawRect /W=scrub left, top, right, bottom NVAR PadCenterX = PadCenterX NVAR PadCenterY = PadCenterY Padcenterx = (Right+Left)/2 PadCenterY = (Top + Bottom)/2 End Function ScrubOffset() NVAR PadCenterX = PadcenterX NVAR PadcenterY = PadCenterY //Print (hcsr(A)-padcenterX),(vcsr(A)- padcenterY) NVAR getDataFlag = getDataFlag getDataFlag =0 //reset data flag End Function SetBump(ID) variable ID Wave Bumps = Bumps bumps[id][0] = Hcsr(A) bumps[id][1] = Vcsr(A) End Function GoToBump(ID) variable ID wave bumps = bumps Cursor/I A ImageNew Bumps[id][0],bumps[id][1] setAxis /w=Scrub top, (Bumps[id][0]-50),(Bumps[id][0]+50) setAxis /w=Scrub Left, (Bumps[id][1]+50),(Bumps[id][1]-50) setAxis /w=Previous top, (Bumps[id][0]-50),(Bumps[id][0]+50) setAxis /w=Previous Left, (Bumps[id][1]+50),(Bumps[id][1]-50) definepad() setCursor(0) End Function MarqueeDefinePad() GetMarquee /K/W=Scrub Top,Left SetDrawLayer/W=Scrub /K Userfront setdrawenv /W=scrub xcoord=top,ycoord=left,fillpat=0,linefgc=(64000,20000,10000), save DrawRect /W=scrub V_left, V_top, V_right, V_bottom NVAR PadCenterX = PadCenterX NVAR PadCenterY = PadCenterY Padcenterx = (V_Right+V_Left)/2 PadCenterY = (V_Top + V_Bottom)/2 End function setCursor(State) variable state //0 = define pad mode //1 = define bump location mode NVAR getDataFlag=getDataFlag if(State) cursor /M /C=(0,65535,0) A getDataflag = 1 else cursor /M /C=(65535,0,52428) A getDataFlag = 0 endif End Function ZoomOut(ctrlName) : ButtonControl String ctrlName SetAxis/A/W=Scrub Top SetAxis/A/R/W=Scrub Left SetAxis/A/W=Previous Top SetAxis/A/R/W=Previous Left End Function MyWindowHook(s) STRUCT WMWinHookStruct &s Variable hookResult = 0 // 0 if we do not handle event, 1 if we handle it. switch(s.eventCode) case 11: // Keyboard event switch (s.keycode) case 49: //1 definePad() setcursor(0) hookResult = 1 break case 50: //2 marqueeDefinePad() setCursor(0) hookResult = 1 break case 51://3 setCursor(1) hookResult = 1 break case 13://Line Feed CR_Button() hookResult = 1 break endswitch break endswitch return hookResult // If non-zero, we handled event and Igor will ignore it. End Function PickBump(ctrlName,popNum,popStr) : PopupMenuControl String ctrlName Variable popNum String popStr String Bump Bump = "B"+popStr Wave Bumps = Bumps gotobump(FindDimLabel(Bumps, 0, Bump )) NVAR BumpNum = BumpNum BumpNum = popNum End Function LoadNextImage() NVAR BumpNum = BumpNum BumpNum = 0 //reset on load NVAR ImageIndex = ImageIndex NVAR ImageNum = ImageNum ImageLoad/P=NewImages/T=jpeg/O/Q/N=ImageNew IndexedFile(NewImages, ImageIndex, ".jpg") ImageLoad/P=PreImages/T=jpeg/O/Q/N=ImagePre IndexedFile(PreImages, ImageIndex, ".jpg") Wave ImageNew = ImageNew Wave ImagePre = ImagePre SetScale/P x, 0, 2, ImageNew,ImagePre SetScale/P Y, 0, 2, ImageNew,ImagePre imageNum = ImageIndex+1 zoomOut("") End Function CR_Button() //Check to see which bump NVAR BumpNum = BumpNum NVAR GetDataFlag NVAR ImageIndex=ImageIndex //if GetDataFlag is set to 0 move to next bump unless bumpNum =0 if(!GetDataFlag) //Flag set to zero If(!mod(BumpNum,10))//Bump = 0 or 10 (large view with no scrub marks) or no scrub on last bump imageindex +=1 LoadNextImage() abort else //go to next bump bumpNum +=1 gotobump(BumpNum) abort endif endif scruboffset() //record data and increment getDataFlag = 0 BumpNum +=1 if(BumpNum==11) loadnextimage() abort endif gotobump(bumpNum) End Function GetImage(ctrlName,varNum,varStr,varName) : SetVariableControl String ctrlName Variable varNum String varStr String varName NVAR ImageIndex=ImageIndex ImageIndex = varNum-1 loadNextImage() End Window Previous() : Graph PauseUpdate; Silent 1 // building window... Display /W=(40,44,462,306) as "Previous Run" AppendImage/T ImagePre ModifyImage ImagePre ctab= {*,*,Grays,0} ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 ModifyGraph mirror=2 ModifyGraph nticks(left)=10,nticks(top)=12 ModifyGraph minor=1 ModifyGraph fSize=9 ModifyGraph standoff=0 ModifyGraph tkLblRot(left)=90 ModifyGraph btLen=3 ModifyGraph tlOffset=-2 SetAxis/A/R left EndMacro