Ignore:
Timestamp:
Jul 3, 2014 10:16:55 AM (9 years ago)
Author:
mjw
Message:

Added the ability to tile 2D ascii to the Tile Raw 2D panel

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf

    r940 r945  
    19891989End 
    19901990 
     1991Function/S GetASCDataFileList() 
     1992         
     1993        //make sure that path exists 
     1994        PathInfo catPathName 
     1995        if (V_flag == 0) 
     1996                Abort "Folder path does not exist - use Pick Path button on Main Panel" 
     1997        Endif 
     1998         
     1999        String list=IndexedFile(catPathName,-1,"????") 
     2000        String newList="",item="" 
     2001        Variable num=ItemsInList(list,";"),ii 
     2002        for(ii=0;ii<num;ii+=1) 
     2003                item = StringFromList(ii, list  ,";") 
     2004                if(stringmatch(item,"*.ASC") ) 
     2005                        newlist += item + ";" 
     2006                endif 
     2007        endfor 
     2008         
     2009        newList = SortList(newList,";",0) 
     2010        return(newList) 
     2011End 
     2012                 
     2013 
     2014 
    19912015// Return the filename that represents the previous or next file. 
    19922016// Input is current filename and increment.  
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Tile_2D.ipf

    r916 r945  
    4747Proc Tile_2D() 
    4848        PauseUpdate; Silent 1           // building window... 
    49         NewPanel /W=(849,337,1248,553) /K=2 
     49        NewPanel /W=(849,337,1248,573) /K=2 
    5050        DoWindow/C Tile_2D 
    5151         
    52         ListBox fileList,pos={5,4},size={206,206} 
     52        ListBox fileList,pos={5,4},size={206,226} 
    5353        ListBox fileList,listWave=root:myGlobals:Tile_2D:fileWave 
    5454        ListBox fileList,selWave=root:myGlobals:Tile_2D:selWave,mode= 4 
    55         Button button0,pos={217,131},size={170,20},proc=AddToLayoutButtonProc,title="Add Selected To Layout" 
     55        Button button0,pos={217,161},size={170,20},proc=AddToLayoutButtonProc,title="Add Selected To Layout" 
    5656        Button button0,help={"Adds images of the selected files to the layout selected in the popup menu"} 
    57         Button button1,pos={316,182},size={50,20},proc=TileDoneButtonProc,title="Done" 
     57        Button button1,pos={316,207},size={50,20},proc=TileDoneButtonProc,title="Done" 
    5858        Button button1,help={"Closes the panel, kills the layouts, and kills images from your memory"} 
    5959        Button button3,pos={227,6},size={60,20},proc=GetListButtonProc,title="Get List" 
     
    6161        Button button4,pos={340,6},size={25,20},proc=ShowTileHelp,title="?" 
    6262        Button button4,help={"Show help file for tiling raw data files in a layout"} 
    63         Button button5,pos={217,155},size={170,20},proc=AddAllToLayout,title="Add All To Layout" 
     63        Button button5,pos={217,185},size={170,20},proc=AddAllToLayout,title="Add All To Layout" 
    6464        Button button5,help={"Adds images of all raw files, 40 per layout"} 
    65         CheckBox check0,pos={216,64},size={71,14},title="Log scaling" 
     65        CheckBox check0,pos={216,94},size={71,14},title="Log scaling" 
    6666        CheckBox check0,help={"If checked, the image color will be log scale"},value= 1 
    6767        PopupMenu popup0,pos={226,38},size={141,20},title="Layout ?" 
    6868        PopupMenu popup0,help={"Sets a new or existing layout as the destination when adding images"} 
    6969        PopupMenu popup0,mode=1,popvalue="New Layout",value= #"\"New Layout;\"+WinList(\"*\", \";\",\"WIN:4\")" 
    70         CheckBox check1,pos={216,86},size={72,14},proc=FixScale_CheckProc,title="Fixed Scale" 
     70        PopupMenu popup1,pos={226,64},size={141,20},title="Data Type?" 
     71        PopupMenu popup1,help={"Choose what data type you want ot tile."} 
     72        PopupMenu popup1,mode=1,popvalue="RAW",value= "RAW;ASC" 
     73        CheckBox check1,pos={216,116},size={72,14},proc=FixScale_CheckProc,title="Fixed Scale" 
    7174        CheckBox check1,value= 0,help={"Sets a fixed z-scale (counts) for all images in the layout. Enter the min and max values"} 
    72         SetVariable scale_0,pos={216,105},size={80,15},title="min" 
     75        SetVariable scale_0,pos={216,140},size={80,15},title="min" 
    7376        SetVariable scale_0,limits={-Inf,Inf,0},value= root:myGlobals:Tile_2D:minScale 
    7477        SetVariable scale_0,help={"Minimum mapped count value"},disable=1               //initially not visible 
    75         SetVariable scale_1,pos={300,105},size={80,15},title="max" 
     78        SetVariable scale_1,pos={300,140},size={80,15},title="max" 
    7679        SetVariable scale_1,limits={-Inf,Inf,0},value=root:myGlobals:Tile_2D:maxScale 
    7780        SetVariable scale_1,help={"Maximum mapped count value"},disable=1               //initially not visible 
     
    106109        ControlInfo popup0 
    107110        String layoutStr=S_Value        //create new layout or append to old one 
     111         
     112        ControlInfo/W=Tile_2D popup1 
     113        String DataStr=S_Value  //create new layout or append to old one 
    108114         
    109115        ControlInfo check0 
     
    150156         
    151157        do 
     158                fname=pathStr + FindValidFilename(fileWave[ii]) //in case of VAX version numbers 
     159                 
    152160                if(sel[ii] == 1) 
    153                         fname=pathStr + FindValidFilename(fileWave[ii]) //in case of VAX version numbers 
    154                         ReadHeaderAndData(fname)                //fname is the full path 
    155                         String/G root:myGlobals:gDataDisplayType="RAW"   
    156                         fRawWindowHook() 
    157                         if(makeLog) 
    158                                 err = ConvertFolderToLogScale("RAW") 
     161                        if(stringmatch(fname, "*.ASC")) 
     162                                NewDataFolder/O root:Packages:NIST:ASC 
     163                                Load_NamedASC_File(fname, "ASC") 
     164                                if(makeLog) 
     165                                        err = ConvertFolderToLogScale("ASC") 
     166                                endif                    
     167                                MakePNGforLayout(minScale,maxScale,"ASC",ind) 
     168                                ind+=1                  //a running count of all of the PNG's 
     169                        else 
     170                                ReadHeaderAndData(fname)                //fname is the full path 
     171                                String/G root:myGlobals:gDataDisplayType="RAW"   
     172                                fRawWindowHook() 
     173                                if(makeLog) 
     174                                        err = ConvertFolderToLogScale("RAW") 
     175                                endif 
     176                                MakePNGforLayout(minScale,maxScale,"RAW",ind) 
     177                                ind+=1                  //a running count of all of the PNG's 
    159178                        endif 
    160                         MakePNGforLayout(minScale,maxScale,"RAW",ind) 
    161                         ind+=1                  //a running count of all of the PNG's 
    162179                endif 
     180 
     181 
    163182                ii+=1 
    164183        while(ii<num) 
     
    174193        endif 
    175194        for(ii=startInd;ii<ind;ii+=1) 
    176                 AppendLayoutObject/F=1/R=(72,40,144,112) picture $("RAW"+num2str(ii)+"L_PNG") 
     195                AppendLayoutObject/F=1/R=(72,40,144,112) picture $(DataStr+num2str(ii)+"L_PNG") 
    177196//              ModifyLayout top($("RAW"+num2str(ii)+"L_PNG"))=(40+mod(30*ii,560))      //separate the graphics (in points) 
    178197//              ModifyLayout/I width($("RAW"+num2str(ii)+"L_PNG"))=(wd),height($("RAW"+num2str(ii)+"L_PNG"))=(wd) //(in inches) 
     
    206225        // 
    207226        for(ii=startInd;ii<ind;ii+=1) 
    208                 ModifyLayout/I width($("RAW"+num2str(ii)+"L_PNG"))=(wd),height($("RAW"+num2str(ii)+"L_PNG"))=(wd) //(in inches) 
     227                ModifyLayout/I width($(DataStr+num2str(ii)+"L_PNG"))=(wd),height($(DataStr+num2str(ii)+"L_PNG"))=(wd) //(in inches) 
    209228        endfor 
    210229         
     
    234253        ControlInfo/W=Tile_2D popup0 
    235254        String layoutStr=S_Value        //create new layout or append to old one 
     255         
     256        ControlInfo/W=Tile_2D popup1 
     257        String DataStr=S_Value  //create new layout or append to old one 
    236258         
    237259        ControlInfo/W=Tile_2D check0 
     
    284306        do 
    285307                fname=pathStr + FindValidFilename(fileWave[ii]) //in case of VAX version numbers 
    286                 ReadHeaderAndData(fname)                //fname is the full path 
    287                 String/G root:myGlobals:gDataDisplayType="RAW"   
    288                 fRawWindowHook() 
    289                 if(makeLog) 
    290                         err = ConvertFolderToLogScale("RAW") 
     308                 
     309                 
     310                //Modified for summer student 2014 by mjw 
     311                //Original is follows 
     312                // 
     313                //ReadHeaderAndData(fname)              //fname is the full path 
     314                //String/G root:myGlobals:gDataDisplayType="RAW"         
     315                //fRawWindowHook() 
     316                //if(makeLog) 
     317                //      err = ConvertFolderToLogScale("RAW") 
     318                //endif 
     319                //MakePNGforLayout(minScale,maxScale,"RAW",ind) 
     320                //ind+=1                        //a running count of all of the PNG's 
     321                // 
     322                 
     323                if(stringmatch(fname, "*.ASC")) 
     324                        NewDataFolder/O root:Packages:NIST:ASC 
     325                        Load_NamedASC_File(fname, "ASC") 
     326                        if(makeLog) 
     327                                err = ConvertFolderToLogScale("ASC") 
     328                        endif                    
     329                        MakePNGforLayout(minScale,maxScale,"ASC",ind) 
     330                        ind+=1                  //a running count of all of the PNG's 
     331                else 
     332                        ReadHeaderAndData(fname)                //fname is the full path 
     333                        String/G root:myGlobals:gDataDisplayType="RAW"   
     334                        fRawWindowHook() 
     335                        if(makeLog) 
     336                                err = ConvertFolderToLogScale("RAW") 
     337                        endif 
     338                        MakePNGforLayout(minScale,maxScale,"RAW",ind) 
     339                        ind+=1                  //a running count of all of the PNG's 
    291340                endif 
    292                 MakePNGforLayout(minScale,maxScale,"RAW",ind) 
    293                 ind+=1                  //a running count of all of the PNG's 
    294  
     341                //End Modification 
     342                 
    295343                ii+=1 
    296344        while(ii<num) 
     
    330378        endif 
    331379 
    332  
    333          
    334380        NewLayout 
    335381        DoWindow/C $("PNGLayout"+num2str(startInd)) 
     
    337383                jj=ii 
    338384                do 
    339                         AppendLayoutObject/F=1/R=(72,40,144,112) picture $("RAW"+num2str(jj)+"L_PNG") 
    340                         ModifyLayout/I width($("RAW"+num2str(jj)+"L_PNG"))=(wd),height($("RAW"+num2str(ii)+"L_PNG"))=(wd) //(in inches) 
     385                        AppendLayoutObject/F=1/R=(72,40,144,112) picture $(DataStr+num2str(jj)+"L_PNG") 
     386                        ModifyLayout/I width($(DataStr+num2str(jj)+"L_PNG"))=(wd),height($(DataStr+num2str(ii)+"L_PNG"))=(wd) //(in inches) 
    341387                        jj+=1 
    342388                while( (jj<ii+numPerLayout) && (jj<ind) )       //index in batch, keep from running over total number of PNGs 
     
    344390                //now make them square 
    345391                for(kk=ii;kk<jj;kk+=1) 
    346                         ModifyLayout/I width($("RAW"+num2str(kk)+"L_PNG"))=(wd),height($("RAW"+num2str(kk)+"L_PNG"))=(wd) //(in inches) 
     392                        ModifyLayout/I width($(DataStr+num2str(kk)+"L_PNG"))=(wd),height($(DataStr+num2str(kk)+"L_PNG"))=(wd) //(in inches) 
    347393                endfor 
    348394                 
     
    375421        Variable num 
    376422 
    377         newList = GetRawDataFileList() 
     423        ControlInfo/W=Tile_2D popup1 
     424        String DataStr=S_Value  //create new layout or append to old one 
     425 
     426         
     427        if(stringmatch(DataStr,"RAW")) 
     428                newList = GetRawDataFileList() 
     429        endif 
     430        if(stringmatch(DataStr,"ASC")) 
     431                newList = GetASCDataFileList() 
     432        endif 
    378433         
    379434        num=ItemsInList(newlist,";") 
Note: See TracChangeset for help on using the changeset viewer.