#pragma rtGlobals=3 // Use modern global access method and strict wave access. //Version 2.0 //-Added Color options //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\3D Panel Functions\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Function menu_slice_panel() String sw Prompt sw, "Data Wave:",popup,"NONE;"+WaveList("!aux*",";","DIMS:3") DoPrompt "3D Data Wave",sw if (V_FLAG) return -1 //User Canceled endif if(cmpstr(sw,"NONE")) Wave w=$(NameofWave($sw)) CreateSlicePanel(w) endif end Function CreateSlicePanel(w) wave w setdatafolder root: variable nr, nc, nl,xi,yi,zi,dx,dy,dz string wnamestr,window_name string cmdstr nr = DimSize(w, 0) nc = DimSize(w, 1) nl = DimSize(w, 2) xi=DimOffset(w,0) yi=DimOffset(w,1) zi=DimOffset(w,2) dx=DimDelta(w,0) dy=DimDelta(w,1) dz=DimDelta(w,2) wnamestr = NameOfWave(w) Make /N=(nr,nc)/O $wnamestr + "a" WAVE sla = $wnamestr + "a" Make /N=(nl,nc)/O $wnamestr + "b" WAVE slb = $wnamestr + "b" Make /N=(nr,nl)/O $wnamestr + "c" WAVE slc = $wnamestr + "c" Make/N=10 /O $(wNameStr + "slc") WAVE cslc = $(wNameStr + "slc") cslc[2]=zi cslc[3]=xi cslc[6]=yi cslc[9]=DimOffset($wnamestr,1) Setscale/p x DimOffset(w, 0), DimDelta(w, 0), WaveUnits(w, 0), sla, slc Setscale/p x DimOffset(w, 2), DimDelta(w, 2), WaveUnits(w, 2), slb Setscale/p y DimOffset(w, 1), DimDelta(w, 1), WaveUnits(w, 1), sla, slb Setscale/p y DimOffset(w, 2), DimDelta(w, 2), WaveUnits(w, 2), slc sprintf cmdstr, "%s[p][q][%s[0][0]]", wNameStr, wNameStr+"slc" SetFormula sla , cmdstr sprintf cmdstr, "%s[%s[1][0]][q][p]", wNameStr, wNameStr+"slc" SetFormula slb , cmdstr sprintf cmdstr, "%s[p][%s[4][0]][q]", wNameStr, wNameStr+"slc" SetFormula slc , cmdstr window_name="sp_"+wnamestr Display/N=$window_name/W=(200, 200, 700,500)/K=1 as ("Slice Panel "+wnamestr) AppendImage sla AppendImage /b=bb slb AppendImage /b=bc /R slc ModifyImage '' ctab= {*,*,Grays,0} ModifyImage ''#1 ctab= {*,*,Grays,0} ModifyImage ''#2 ctab= {*,*,Grays,0} ModifyGraph axisEnab(bottom)={0,0.3},axisEnab(bb)={0.33,0.63};DelayUpdate ModifyGraph axisEnab(bc)={0.66,1},freePos(bb)=0,freePos(bc)=0;DelayUpdate ModifyGraph lblPos(bb)=40,lblPos(bc)=40 ControlBar 48 //Pixel SetVariable setvar0 pos={5,4},size={120,16},title="By Pixel: Scan",limits={0,nl-1,1},value=cslc[0],proc=csl_control_fun_var SetVariable setvar1 pos={128,4},size={75,16},title="Kx",limits={0,nr-1,1},value=cslc[1],proc=csl_control_fun_var SetVariable setlevel0 pos={212,4},size={90,16},title="Level",limits={0,nc-1,1},value=cslc[4],proc=csl_control_fun_var SetVariable setrange0 pos={337,4},size={90,16},title="Range",limits={0,nr-1,1},value=cslc[5],proc=csl_control_fun_var //Units SetVariable setvar2,pos={14,27},size={111,16},title="By Units: Tilt",limits={zi,zi+(nl-1)*dz,dz},value= cslc[2],proc=csl_control_fun_var SetVariable setvar3,pos={128,27},size={75,16},title="Kx",limits={xi,xi+(nr-1)*dx,dx},value= cslc[3],proc=csl_control_fun_var SetVariable setlevel1,pos={205,27},size={97,16},title="Energy",limits={yi,yi+(nc-1)*dy,0.005},value= cslc[6],proc=csl_control_fun_var SetVariable setrange1,pos={307,27},size={120,16},title="Range (meV)",limits={0,(nc-1)*1000*dy,1000*dy},value= cslc[7],proc=csl_control_fun_var SetVariable setFL pos={438,27},size={77,16},bodyWidth=60,title="EF",limits={-inf,inf,dy},value=cslc[8],proc=csl_control_fun_var Button export_button pos={442,4},size={70,20},title="Export",proc=csl_control_fun_but setvariable setvarwname pos={1,1},size={70,20},title="wname",value=_STR:wnamestr,disable=1 //Color Options CheckBox checkinverse,pos={625,7},size={33,14},title="Inv",value= 0,proc=proc_check_3Dslc PopupMenu popupcolor,pos={519,4},size={100,21},bodyWidth=100,proc=proc_popup_3Dslc PopupMenu popupcolor,mode=1,value= #"\"*COLORTABLEPOPNONAMES*\"" SetVariable setvarmax,pos={591,27},size={69,16},bodyWidth=45,title="Max",proc=proc_setvar_3Dslc SetVariable setvarmax,value= _NUM:100 SetVariable setvarmin,pos={520,27},size={66,16},bodyWidth=45,title="Min",proc=proc_setvar_3Dslc SetVariable setvarmin,value= _NUM:0 ShowInfo/W=$window_name Cursor/M/H=1/C=(65535,65535,0) A Cursor/M/H=1/C=(0,65535,65535) B End Function proc_setvar_3Dslc(sv) : SetVariableControl STRUCT WMSetVariableAction &sv if(sv.eventCode==2||sv.eventCode==1) string wdname=sv.win,color,wname variable maxval,minval,mn,mx,imax,imin,checked ControlInfo/W=$wdname setvarmax maxval=V_Value ControlInfo/W=$wdname setvarmin minval=V_Value ControlInfo/W=$wdname popupcolor color=S_Value ControlInfo/W=$wdname setvarwname wname=S_Value ControlInfo/W=$wdname checkinverse checked=V_Value ImageStats/M=1 $(wname+"a") imin=V_min imax=V_max mx=imin+(imax-imin)*(maxval/100) mn=imin+(imax-imin)*(minval/100) ModifyImage/W=$wdname $(wname+"a") ctab={mn,mx,$color,checked} ImageStats/M=1 $(wname+"b") imin=V_min imax=V_max mx=imin+(imax-imin)*(maxval/100) mn=imin+(imax-imin)*(minval/100) ModifyImage/W=$wdname $(wname+"b") ctab={mn,mx,$color,checked} ImageStats/M=1 $(wname+"c") imin=V_min imax=V_max mx=imin+(imax-imin)*(maxval/100) mn=imin+(imax-imin)*(minval/100) ModifyImage/W=$wdname $(wname+"c") ctab={mn,mx,$color,checked} endif End Function proc_popup_3Dslc(pu) : PopupMenuControl STRUCT WMPopupAction &pu if(pu.eventCode==2) string wdname=pu.win,color,wname variable maxval,minval,mn,mx,imax,imin,checked ControlInfo/W=$wdname setvarmax maxval=V_Value ControlInfo/W=$wdname setvarmin minval=V_Value ControlInfo/W=$wdname popupcolor color=S_Value ControlInfo/W=$wdname setvarwname wname=S_Value ControlInfo/W=$wdname checkinverse checked=V_Value ImageStats/M=1 $(wname+"a") imin=V_min imax=V_max mx=imin+(imax-imin)*(maxval/100) mn=imin+(imax-imin)*(minval/100) ModifyImage/W=$wdname $(wname+"a") ctab={mn,mx,$color,checked} ImageStats/M=1 $(wname+"b") imin=V_min imax=V_max mx=imin+(imax-imin)*(maxval/100) mn=imin+(imax-imin)*(minval/100) ModifyImage/W=$wdname $(wname+"b") ctab={mn,mx,$color,checked} ImageStats/M=1 $(wname+"c") imin=V_min imax=V_max mx=imin+(imax-imin)*(maxval/100) mn=imin+(imax-imin)*(minval/100) ModifyImage/W=$wdname $(wname+"c") ctab={mn,mx,$color,checked} endif End Function proc_check_3Dslc(cb) : CheckBoxControl STRUCT WMCheckboxAction &cb if(cb.eventCode==2) string wdname=cb.win,color,wname variable checked=cb.checked variable maxval,minval,mn,mx,imax,imin ControlInfo/W=$wdname setvarmax maxval=V_Value ControlInfo/W=$wdname setvarmin minval=V_Value ControlInfo/W=$wdname popupcolor color=S_Value ControlInfo/W=$wdname setvarwname wname=S_Value ImageStats/M=1 $(wname+"a") imin=V_min imax=V_max mx=imin+(imax-imin)*(maxval/100) mn=imin+(imax-imin)*(minval/100) ModifyImage/W=$wdname $(wname+"a") ctab={mn,mx,$color,checked} ImageStats/M=1 $(wname+"b") imin=V_min imax=V_max mx=imin+(imax-imin)*(maxval/100) mn=imin+(imax-imin)*(minval/100) ModifyImage/W=$wdname $(wname+"b") ctab={mn,mx,$color,checked} ImageStats/M=1 $(wname+"c") imin=V_min imax=V_max mx=imin+(imax-imin)*(maxval/100) mn=imin+(imax-imin)*(minval/100) ModifyImage/W=$wdname $(wname+"c") ctab={mn,mx,$color,checked} endif End Function csl_control_fun_but(B_Struct) : ButtonControl STRUCT WMButtonAction &B_Struct SetDataFolder root: variable len,i string window_name=B_Struct.win string wname=window_name[3] len=strlen(B_Struct.win) for(i=4;i=DimSize($wname,1))) print "Out of Range "+wname print "Process ABORTED!" cslc[5]=0 cslc[7]=0 return -1 else For(i=-val;i<=val;i+=1) tempw+=datawave[p][cslc[4]+i][q] Endfor if(val) tempw/=(2*val+1) endif Removeimage/W=$window_name $(wname+"c") Appendimage/W=$window_name/B=bc /R tempw ModifyGraph axisEnab(bc)={0.66,1},freePos(bc)=0;DelayUpdate ModifyGraph lblPos(bc)=40 if((!cmpstr(zmin,"*"))&&(!cmpstr(zmax,"*"))) ModifyImage/W=$window_name $(wname+"c") ctab={*,*,$color,str2num(rev)} elseif(!cmpstr(zmin,"*")) ModifyImage/W=$window_name $(wname+"c") ctab={*,str2num(zmax),$color,str2num(rev)} elseif(!cmpstr(zmax,"*")) ModifyImage/W=$window_name $(wname+"c") ctab={str2num(zmin),*,$color,str2num(rev)} else ModifyImage/W=$window_name $(wname+"c") ctab={str2num(zmin),str2num(zmax),$color,str2num(rev)} endif DoWindow/R $window_name endif End