Changeset 1221


Ignore:
Timestamp:
Jul 25, 2022 3:59:52 PM (2 months ago)
Author:
ilavsky
Message:

NIka, 12IDB work. Added Transpose/flip to image import and removed Calibrated 2D data. Not sure if used at all.

Location:
trunk/User Procedures
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/User Procedures/Indra 2/IN3_SamplePlate.ipf

    r1217 r1221  
    12841284            DoIgorMenu "Edit" "Select All"
    12851285            DoIgorMenu "Edit" "Copy"
    1286             string existingProCode=GetScrapText()       // modify procedure code
    1287                 String newCode = existingProCode + "\r\roverride "+ProcedureText("IN3S_ExportHookFunction") // modify procedure code
    1288             PutScrapText newCode                                        // new code in clipboard...
    1289             DoIgorMenu "Edit" "Paste"                           //put in main proc window.
     1286            string existingProCode=GetScrapText()       // get current procedure code
     1287                String newCode = existingProCode + "\r\roverride "+ProcedureText("IN3S_ExportHookFunction")
     1288                                                                                                // this is existing + modified hook function code
     1289            PutScrapText newCode                                        // put new code in clipboard...
     1290            DoIgorMenu "Edit" "Paste"                           // put clipboard in main proc window.
    12901291            PutScrapText currScrap                      // put previous scrap text back
    12911292            Execute/P/Q/Z "COMPILEPROCEDURES "          // recompile all
  • trunk/User Procedures/Nika/NI1_ConvProc.ipf

    r1202 r1221  
    1313//2.74 ~2022 sometimes.
    1414//                      added ability to calculate transmission using semi transparent beamstop.
     15//                      removed use of calibrated data, let's see if anyone complains. I do nto think there is any use for this.
     16//                      add Transpose and flips for image after load.
    1517//2.73 5-24-2021 changed resolution to be FWHM/2, same as USAXS and as expected by Modeling package and sasView.
    1618//              modifed NI1A_CalculateQresolution to return FWHM and use only Q steps and Beam size. Pixel size used before is wrong, that is accounted for in Q stepping already, Nika cannot oversample in Q points.
     
    18661868                PathInfo Convert2Dto1DDataPath
    18671869                SVAR MainPathInfoStr=root:Packages:Convert2Dto1D:MainPathInfoStr
    1868                 MainPathInfoStr=S_path
     1870                MainPathInfoStr=S_path[strlen(S_path)-NikaLengthOfPathForPanelDisplay,strlen(S_path)-1]
    18691871                TitleBox PathInfoStr, win =NI1A_Convert2Dto1DPanel, variable=MainPathInfoStr
    18701872                NI1A_UpdateDataListBox()               
     
    37603762        TitleBox MainTitle title="\Zr1602D to 1D data conversion panel",pos={48,2},frame=0,fstyle=3,size={300,24},fColor=(1,4,52428)
    37613763        TitleBox Info1 title="\Zr120Select input data here",pos={5,72},frame=0,fstyle=1, size={130,20},fColor=(1,4,52428)
    3762         Button GetHelp,pos={335,5},size={80,15},fColor=(65535,32768,32768), proc=NI1A_ButtonProc,title="Get Help", help={"Open www manual page for this tool"}
     3764        Button GetHelp,pos={335,2},size={80,15},fColor=(65535,32768,32768), proc=NI1A_ButtonProc,title="Get Help", help={"Open www manual page for this tool"}
    37633765//first data selection part
    37643766        Button Select2DDataPath,pos={5,30},size={140,20},proc=NI1A_ButtonProc,title="Select data path"
    37653767        Button Select2DDataPath,help={"Select Data path where 2D data are"}
    3766         TitleBox PathInfoStr, pos={3,55}, size={350,20}, variable=root:Packages:Convert2Dto1D:MainPathInfoStr, frame=0, fstyle=2, fColor=(0,12800,32000)//,fSize=1.3
    3767         PopupMenu Select2DDataType,pos={290,30},size={111,21},proc=NI1A_PopMenuProc,title="Image type"
     3768        TitleBox PathInfoStr, pos={3,60}, size={300,20}, variable=root:Packages:Convert2Dto1D:MainPathInfoStr, frame=0, fstyle=2, fColor=(0,12800,32000)//,fSize=1.3
     3769        PopupMenu Select2DDataType,pos={290,20},size={111,21},proc=NI1A_PopMenuProc,title="Image type"
    37683770        PopupMenu Select2DDataType,help={"Select type of 2D images being loaded"},value= #"root:Packages:Convert2Dto1D:ListOfKnownExtensions"
    37693771        PopupMenu Select2DDataType,popmatch=DataFileExtension
    3770         CheckBox UseCalib2DData,pos={165,33},size={146,14},proc=NI1A_CheckProc,title="Calibrated 2D data?"
    3771         CheckBox UseCalib2DData,help={"Import 2D calibrated data, not raw image data"}
    3772         CheckBox UseCalib2DData,variable= root:Packages:Convert2Dto1D:UseCalib2DData
    3773         NVAR UseCalib2DData = root:Packages:Convert2Dto1D:UseCalib2DData
    3774         SVAR DataFileExtension = root:Packages:Convert2Dto1D:DataFileExtension
    3775         SVAR ListOfKnownCalibExtensions = root:Packages:Convert2Dto1D:ListOfKnownCalibExtensions
    3776         if(UseCalib2DData)
    3777                 DataFileExtension = StringFromList(0,ListOfKnownCalibExtensions)
    3778                 PopupMenu Select2DDataType,mode=2,popvalue=DataFileExtension,value= #"root:Packages:Convert2Dto1D:ListOfKnownCalibExtensions"
    3779         endif
    3780 
    3781         CheckBox ReverseBinnedData,pos={298,50},size={146,14},proc=NI1A_CheckProc,title="Unbin if needed?"
    3782         CheckBox ReverseBinnedData,help={"Reverse binning if necessary?"}, disable=!(UseCalib2DData|| !StringMatch(DataFileExtension, "canSAS/Nexus"))
    3783         CheckBox ReverseBinnedData,variable= root:Packages:Convert2Dto1D:ReverseBinnedData
     3772//      CheckBox UseCalib2DData,pos={165,33},size={146,14},proc=NI1A_CheckProc,title="Calibrated 2D data?"
     3773//      CheckBox UseCalib2DData,help={"Import 2D calibrated data, not raw image data"}
     3774//      CheckBox UseCalib2DData,variable= root:Packages:Convert2Dto1D:UseCalib2DData
     3775//      NVAR UseCalib2DData = root:Packages:Convert2Dto1D:UseCalib2DData
     3776//      SVAR DataFileExtension = root:Packages:Convert2Dto1D:DataFileExtension
     3777//      SVAR ListOfKnownCalibExtensions = root:Packages:Convert2Dto1D:ListOfKnownCalibExtensions
     3778//      if(UseCalib2DData)
     3779//              DataFileExtension = StringFromList(0,ListOfKnownCalibExtensions)
     3780//              PopupMenu Select2DDataType,mode=2,popvalue=DataFileExtension,value= #"root:Packages:Convert2Dto1D:ListOfKnownCalibExtensions"
     3781//      endif
     3782
     3783//      CheckBox ReverseBinnedData,pos={165,50},size={146,14},proc=NI1A_CheckProc,title="Unbin if needed?"
     3784//      CheckBox ReverseBinnedData,help={"Reverse binning if necessary?"}, disable=!(UseCalib2DData|| !StringMatch(DataFileExtension, "canSAS/Nexus"))
     3785//      CheckBox ReverseBinnedData,variable= root:Packages:Convert2Dto1D:ReverseBinnedData
     3786
     3787        PopupMenu RotateFLipImageOnLoad,pos={285,40},size={111,13},proc=NI1A_PopMenuProc,title="Flip/Rotate: "
     3788        PopupMenu RotateFLipImageOnLoad,help={"Rotate/Flip image on import "}
     3789        SVAR RotateFLipImageOnLoad=root:Packages:Convert2Dto1D:RotateFLipImageOnLoad
     3790        PopupMenu RotateFLipImageOnLoad,value= "No;Transpose;FlipHor;FlipVert;Tran/FlipH;"
     3791        PopupMenu RotateFLipImageOnLoad,popmatch=RotateFLipImageOnLoad
    37843792
    37853793        CheckBox InvertImages,pos={150,73},size={146,14},proc=NI1A_CheckProc,title="Invert 0, 0 corner?"
     
    48014809
    48024810        //other control on the panel...
    4803         CheckBox ReverseBinnedData, disable=!(UseCalib2DData|| StringMatch(DataFileExtension, "canSAS/Nexus")), win=NI1A_Convert2Dto1DPanel     
     4811        //CheckBox ReverseBinnedData, disable=!(UseCalib2DData|| StringMatch(DataFileExtension, "canSAS/Nexus")), win=NI1A_Convert2Dto1DPanel   
    48044812
    48054813 
     
    55165524                NI1A_TabProc("",7)
    55175525        endif
    5518         if(StringMatch("UseCalib2DData",ctrlName))
    5519                 SVAR ListOfKnownExtensions = root:Packages:Convert2Dto1D:ListOfKnownExtensions
    5520                 SVAR DataFileExtension = root:Packages:Convert2Dto1D:DataFileExtension
    5521                 SVAR ListOfKnownCalibExtensions = root:Packages:Convert2Dto1D:ListOfKnownCalibExtensions
    5522                 if(checked)
    5523                         DataFileExtension = stringfromlist(0,ListOfKnownCalibExtensions)
    5524                         PopupMenu Select2DDataType,win=NI1A_Convert2Dto1DPanel, popvalue=DataFileExtension,value= #"root:Packages:Convert2Dto1D:ListOfKnownCalibExtensions", mode=2
    5525                 else
    5526                         DataFileExtension = stringfromlist(0,ListOfKnownExtensions)
    5527                         PopupMenu Select2DDataType,win=NI1A_Convert2Dto1DPanel, popvalue=DataFileExtension,value= #"root:Packages:Convert2Dto1D:ListOfKnownExtensions", mode=2                         
    5528                 endif
    5529                 CheckBox ReverseBinnedData, disable=!(UseCalib2DData|| StringMatch(DataFileExtension, "canSAS/Nexus")), win=NI1A_Convert2Dto1DPanel     
    5530                 if(ExpCalib2DData&&UseCalib2DData)
    5531                         DoALert /T="Careful on this", 0, "Loading 2D Calibrated data and exporting them at the same time. You can overwrite your 2D data. Make sure you use different output formats or paths!"
    5532                 endif
    5533                 NI1A_TabProc("",0)
    5534                 NI1A_UpdateDataListBox()
    5535         endif
     5526//      if(StringMatch("UseCalib2DData",ctrlName))
     5527//              SVAR ListOfKnownExtensions = root:Packages:Convert2Dto1D:ListOfKnownExtensions
     5528//              SVAR DataFileExtension = root:Packages:Convert2Dto1D:DataFileExtension
     5529//              SVAR ListOfKnownCalibExtensions = root:Packages:Convert2Dto1D:ListOfKnownCalibExtensions
     5530//              if(checked)
     5531//                      DataFileExtension = stringfromlist(0,ListOfKnownCalibExtensions)
     5532//                      PopupMenu Select2DDataType,win=NI1A_Convert2Dto1DPanel, popvalue=DataFileExtension,value= #"root:Packages:Convert2Dto1D:ListOfKnownCalibExtensions", mode=2
     5533//              else
     5534//                      DataFileExtension = stringfromlist(0,ListOfKnownExtensions)
     5535//                      PopupMenu Select2DDataType,win=NI1A_Convert2Dto1DPanel, popvalue=DataFileExtension,value= #"root:Packages:Convert2Dto1D:ListOfKnownExtensions", mode=2                         
     5536//              endif
     5537//              //CheckBox ReverseBinnedData, disable=!(UseCalib2DData|| StringMatch(DataFileExtension, "canSAS/Nexus")), win=NI1A_Convert2Dto1DPanel   
     5538//              if(ExpCalib2DData&&UseCalib2DData)
     5539//                      DoALert /T="Careful on this", 0, "Loading 2D Calibrated data and exporting them at the same time. You can overwrite your 2D data. Make sure you use different output formats or paths!"
     5540//              endif
     5541//              NI1A_TabProc("",0)
     5542//              NI1A_UpdateDataListBox()
     5543//      endif
    55365544
    55375545
     
    81858193                endif   
    81868194                NEXUS_NikaCall(0)
    8187                 CheckBox ReverseBinnedData,help={"Reverse binning if necessary?"}, disable=!(UseCalib2DData && StringMatch(DataFileExtension, "canSAS/Nexus"))
     8195                //CheckBox ReverseBinnedData,help={"Reverse binning if necessary?"}, disable=!(UseCalib2DData && StringMatch(DataFileExtension, "canSAS/Nexus"))
    81888196        endif
    81898197        if(cmpstr(ctrlName,"SelectBlank2DDataType")==0)
     
    82158223                NI1A_UpdateDataListBox()
    82168224        endif
     8225        if(cmpstr(ctrlName,"RotateFLipImageOnLoad")==0)
     8226                SVAR RotateFLipImageOnLoad=root:Packages:Convert2Dto1D:RotateFLipImageOnLoad
     8227                RotateFLipImageOnLoad = popStr
     8228        endif
     8229       
    82178230       
    82188231        if(cmpstr(ctrlName,"LineProf_CurveType")==0)
  • trunk/User Procedures/Nika/NI1_FileLoaders.ipf

    r1203 r1221  
    11#pragma TextEncoding = "UTF-8"
    22#pragma rtGlobals=3             // Use modern global access method.
    3 #pragma version=2.58
     3#pragma version=2.59
    44
    55//*************************************************************************\
     
    99//*************************************************************************/
    1010
    11 //2.58 fix Eiger detecotr dimensions (lines ~800-850) - looks like dimensions of images were wrong and therefroe images did not look right. This related to tiff and cbf images, found on cbf images from user.
     11//2.59 add ability to flip/rotate image after load to let users tweak image orientation.
     12//2.58 fix Eiger detector dimensions (lines ~800-850) - looks like dimensions of images were wrong and therefroe images did not look right. This related to tiff and cbf images, found on cbf images from user.
    1213//2.57 fix reading of edf header. Works now for Xenocs Pilatus 300k header. Singificant changes due to changing line breaks characters.
    1314//2.56 add Eiger detector support, tested on 16M background image.
     
    3132//2.38 fixe3d bug in reading calibrated 2D data found by Igor 7 beta.
    3233//2.37 Created ADSC_A file type which has wavelength in A, not in nm as ADSC has.
    33 //2.36 modified PilatusHookFunction and asdded ImportedImageHookFunction function called after any image is loaded so users can modify the images after load.
     34//2.36 modified PilatusHookFunction and added ImportedImageHookFunction function called after any image is loaded so users can modify the images after load.
    3435//2.35 adds Pilatus Cbf compressed files (finally solved the problem)...
    3536//2.34 adds ability to read 2D calibrated data format from NIST - NIST-DAT-128x128 pixels. For now there is also Qz, not sure what to do about it.
     
    13411342                Abort "Uknown CCD image to load..."
    13421343        endif
     1344        wave loadedwv=$(NewWaveName)
     1345        //7-25-2022 2.59 added ability to flip/rotate images if needed
     1346        // No;Transpose;FlipHor;FlipVert, Tran/FlipH
     1347        SVAR/Z RotateFLipImageOnLoad=root:Packages:Convert2Dto1D:RotateFLipImageOnLoad
     1348        if(SVAR_Exists(RotateFLipImageOnLoad))
     1349                strswitch(RotateFLipImageOnLoad)        // string switch
     1350                        case "No":              // execute if case matches expression
     1351                                        //nothing needed here
     1352                                break                           // exit from switch
     1353                        case "Transpose":       // execute if case matches expression
     1354                                 MatrixOp/O loadedwv=loadedwv^t
     1355                                break
     1356                        case "FlipVert":        // execute if case matches expression
     1357                                 MatrixOp/O loadedwv=reverseCols(loadedwv)
     1358                                break
     1359                        case "FlipHor": // execute if case matches expression
     1360                                 MatrixOp/O loadedwv=reverseRows(loadedwv)
     1361                                break
     1362                        case "Tran/FlipH":      // execute if case matches expression
     1363                                 MatrixOp/O loadedwv=reverseRows(loadedwv^t)
     1364                                break
     1365                        default:                        // optional default expression executed
     1366                                        //nothing needed here
     1367                endswitch
     1368       
     1369        endif
     1370       
     1371       
    13431372        pathInfo $(PathName)
    13441373   if(exists("ImportedImageHookFunction")==6)
     
    13661395                print "Loaded file   " +FileNameToLoad
    13671396        endif
    1368 //      print "Created wave note: "+NewNote
     1397        //add wave to the image.
    13691398        wave NewWv=$(NewWaveName)
    13701399        note/K NewWv
  • trunk/User Procedures/Nika/NI1_InstrumentSupport.ipf

    r1180 r1221  
    18381838        //SVAR APS12IDBMask                     // = "---"                                      //default for none. User needs to create one in Nika
    18391839        //SVAR APS12IDBGeometry                 //SAXS or WAXS?
     1840
    18401841       
    18411842        SVAR DataFileExtension=root:Packages:Convert2Dto1D:DataFileExtension
     
    18451846        DataFileExtension = APS12IDBDataType
    18461847        PopupMenu Select2DDataType win=NI1A_Convert2Dto1DPanel, popmatch= APS12IDBDataType
    1847 
    1848        
    1849         //setup configuration hwo this will be dome here:
    18501848        NVAR UseSampleTransmission = root:Packages:Convert2Dto1D:UseSampleTransmission
    18511849        NVAR UseSampleThickness = root:Packages:Convert2Dto1D:UseSampleThickness
     
    18791877        NVAR ErrorCalculationsUseOld = root:Packages:Convert2Dto1D:ErrorCalculationsUseOld
    18801878       
    1881         ErrorCalculationsUseOld = 0
    1882         ErrorCalculationsUseStdDev = 0
    1883         ErrorCalculationsUseSEM = 1
    1884        
    1885         if(APS12IDBProcMethod)
    1886                 UseSampleTransmission = 1
    1887                 UseSampleThickness = 0
    1888                 UseEmptyField = 1
    1889                 UseI0ToCalibrate = 1
    1890                 DoGeometryCorrection = 1
    1891                 UseMonitorForEf = 1
    1892        
    1893                 UseSampleThicknFnct  =1
    1894                 UseSampleTransmFnct = 1
    1895         //      UseSampleThicknFnct =1
    1896                 UseSampleMonitorFnct = 1
    1897                 UseEmptyMonitorFnct = 1
     1879        NVAR NX_ReadParametersOnLoad = root:Packages:Irena_Nexus:NX_ReadParametersOnLoad
     1880
     1881        if(StringMatch(APS12IDBDataType, "12IDB_tif" ))
     1882                //setup configuration how this will be done here:
    18981883               
    1899                 UseCorrectionFactor = 0
    1900                 CorrectionFactor = 1
    1901                 UseSolidAngle = 0
     1884                ErrorCalculationsUseOld = 0
     1885                ErrorCalculationsUseStdDev = 0
     1886                ErrorCalculationsUseSEM = 1
    19021887               
    1903                 SampleTransmFnct = "NI1_12IDBGetTranmsission"
    1904                 SampleMonitorFnct = "NI1_12IDBGetSampleI0"
    1905                 EmptyMonitorFnct = "NI1_12IDBGetEmptyI0"
    1906         else //no background subtraction
    1907                 UseSampleTransmission = 0
    1908                 UseSampleThickness = 0
    1909                 UseEmptyField = 0
    1910                 UseI0ToCalibrate = 1
    1911                 DoGeometryCorrection = 1
    1912                 UseMonitorForEf = 0
    1913        
    1914                 UseSampleThicknFnct  = 0
    1915                 UseSampleTransmFnct = 0
    1916         //      UseSampleThicknFnct =1
    1917                 UseSampleMonitorFnct = 1
    1918                 UseEmptyMonitorFnct = 0
    1919 
    1920                 UseCorrectionFactor = 1
    1921                 CorrectionFactor = 2.4e-06                      //this should be fudge factor 12IDB is using to correct data to 0.1-100 intensity range...
    1922                 UseSolidAngle = 1                                               //thsi is needed for that fudge factor above.
     1888                if(APS12IDBProcMethod)
     1889                        UseSampleTransmission = 1
     1890                        UseSampleThickness = 0
     1891                        UseEmptyField = 1
     1892                        UseI0ToCalibrate = 1
     1893                        DoGeometryCorrection = 1
     1894                        UseMonitorForEf = 1
    19231895               
    1924                 SampleTransmFnct = ""
    1925                 SampleMonitorFnct = "NI1_12IDBGetSampleBS"
    1926                 EmptyMonitorFnct = ""
    1927 
    1928         endif
    1929 
     1896                        UseSampleThicknFnct  =1
     1897                        UseSampleTransmFnct = 1
     1898                //      UseSampleThicknFnct =1
     1899                        UseSampleMonitorFnct = 1
     1900                        UseEmptyMonitorFnct = 1
     1901                       
     1902                        UseCorrectionFactor = 0
     1903                        CorrectionFactor = 1
     1904                        UseSolidAngle = 0
     1905                       
     1906                        SampleTransmFnct = "NI1_12IDBGetTranmsission"
     1907                        SampleMonitorFnct = "NI1_12IDBGetSampleI0"
     1908                        EmptyMonitorFnct = "NI1_12IDBGetEmptyI0"
     1909                else //no background subtraction
     1910                        UseSampleTransmission = 0
     1911                        UseSampleThickness = 0
     1912                        UseEmptyField = 0
     1913                        UseI0ToCalibrate = 1
     1914                        DoGeometryCorrection = 1
     1915                        UseMonitorForEf = 0
     1916               
     1917                        UseSampleThicknFnct  = 0
     1918                        UseSampleTransmFnct = 0
     1919                //      UseSampleThicknFnct =1
     1920                        UseSampleMonitorFnct = 1
     1921                        UseEmptyMonitorFnct = 0
     1922       
     1923                        UseCorrectionFactor = 1
     1924                        CorrectionFactor = 2.4e-06                      //this should be fudge factor 12IDB is using to correct data to 0.1-100 intensity range...
     1925                        UseSolidAngle = 1                                               //thsi is needed for that fudge factor above.
     1926                       
     1927                        SampleTransmFnct = ""
     1928                        SampleMonitorFnct = "NI1_12IDBGetSampleBS"
     1929                        EmptyMonitorFnct = ""
     1930       
     1931                endif
     1932       
     1933       
     1934        else //NEXUS
     1935                        NEXUS_ResetParamXRef(1)
     1936                        NEXUS_GuessParamXRef()
     1937                        Wave/T ListOfParamsAndPaths = root:Packages:Irena_Nexus:ListOfParamsAndPaths
     1938                        Wave ListOfParamsAndPathsSel = root:Packages:Irena_Nexus:ListOfParamsAndPathsSel
     1939                        //configrue Nexus to match what they are using...
     1940                        ListOfParamsAndPaths[0][0]="UserSampleName"
     1941                        ListOfParamsAndPaths[0][1]=     "---"
     1942                        ListOfParamsAndPaths[1][0]="SampleThickness"
     1943                        ListOfParamsAndPaths[1][1]=     ":entry:sample:thickness"
     1944                        ListOfParamsAndPaths[2][0]="SampleTransmission"
     1945                        ListOfParamsAndPaths[2][1]=     "---"
     1946                        ListOfParamsAndPaths[3][0]="SampleI0"
     1947                        ListOfParamsAndPaths[3][1]=     ":entry:Metadata:It_phd"
     1948                        ListOfParamsAndPaths[4][0]="SampleMeasurementTime"
     1949                        ListOfParamsAndPaths[4][1]=     "---"
     1950                        ListOfParamsAndPaths[5][0]="SampleToCCDDistance"
     1951                        ListOfParamsAndPaths[5][1]=     ":entry:instrument:detector:distance"
     1952       
     1953                        ListOfParamsAndPaths[6][0]="Wavelength"
     1954                        ListOfParamsAndPaths[6][1]=     ":entry:instrument:monochromator:wavelength"
     1955                        ListOfParamsAndPaths[7][0]="XrayEnergy"
     1956                        ListOfParamsAndPaths[7][1]=     ":entry:instrument:monochromator:energy"
     1957                        ListOfParamsAndPaths[8][0]="BeamCenterX"
     1958                        ListOfParamsAndPaths[8][1]=     ":entry:instrument:detector:beam_center_x"
     1959                        ListOfParamsAndPaths[9][0]="BeamCenterY"
     1960                        ListOfParamsAndPaths[9][1]=     ":entry:instrument:detector:beam_center_y"
     1961                        ListOfParamsAndPaths[10][0]="BeamSizeX"
     1962                        ListOfParamsAndPaths[10][1]=    "---"
     1963                        ListOfParamsAndPaths[11][0]="BeamSizeY"
     1964                        ListOfParamsAndPaths[11][1]=    "---"
     1965
     1966                        ListOfParamsAndPaths[12][0]="PixelSizeX"
     1967                        ListOfParamsAndPaths[12][1]=    ":entry:instrument:detector:det_pixel_size"
     1968                        ListOfParamsAndPaths[13][0]="PixelSizeY"
     1969                        ListOfParamsAndPaths[13][1]=    ":entry:instrument:detector:det_pixel_size"
     1970                        ListOfParamsAndPaths[14][0]="HorizontalTilt"
     1971                        ListOfParamsAndPaths[14][1]=    "---"
     1972                        ListOfParamsAndPaths[15][0]="VerticalTilt"
     1973                        ListOfParamsAndPaths[15][1]=    "---"
     1974                        ListOfParamsAndPaths[16][0]="CorrectionFactor"
     1975                        ListOfParamsAndPaths[16][1]=    "---"
     1976       
     1977       
     1978                        NX_ReadParametersOnLoad = 1
     1979
     1980                        SVAR RotateFLipImageOnLoad=root:Packages:Convert2Dto1D:RotateFLipImageOnLoad
     1981                        RotateFLipImageOnLoad = "Tran/FlipH"   
     1982                ErrorCalculationsUseOld = 0
     1983                ErrorCalculationsUseStdDev = 0
     1984                ErrorCalculationsUseSEM = 1
     1985               
     1986                if(APS12IDBProcMethod)
     1987                        UseSampleTransmission = 1
     1988                        UseSampleThickness = 0
     1989                        UseEmptyField = 1
     1990                        UseI0ToCalibrate = 1
     1991                        DoGeometryCorrection = 1
     1992                        UseMonitorForEf = 1
     1993               
     1994                        UseSampleThicknFnct  =0
     1995                        UseSampleTransmFnct = 0
     1996                //      UseSampleThicknFnct =1
     1997                        UseSampleMonitorFnct = 0
     1998                        UseEmptyMonitorFnct = 0
     1999                       
     2000                        UseCorrectionFactor = 0
     2001                        CorrectionFactor = 1
     2002                        UseSolidAngle = 0
     2003                       
     2004                        SampleTransmFnct = "NI1_12IDBGetTranmsission"
     2005                        SampleMonitorFnct = "NI1_12IDBGetSampleI0"
     2006                        EmptyMonitorFnct = "NI1_12IDBGetEmptyI0"
     2007                else //no background subtraction
     2008                        UseSampleTransmission = 0
     2009                        UseSampleThickness = 0
     2010                        UseEmptyField = 0
     2011                        UseI0ToCalibrate = 1
     2012                        DoGeometryCorrection = 1
     2013                        UseMonitorForEf = 0
     2014               
     2015                        UseSampleThicknFnct  = 0
     2016                        UseSampleTransmFnct = 0
     2017                        UseSampleThicknFnct =0
     2018                        UseSampleMonitorFnct = 0
     2019                        UseEmptyMonitorFnct = 0
     2020       
     2021                        UseCorrectionFactor = 1
     2022                        CorrectionFactor = 2.4e-06                      //this should be fudge factor 12IDB is using to correct data to 0.1-100 intensity range...
     2023                        UseSolidAngle = 1                                               //thsi is needed for that fudge factor above.
     2024                       
     2025                        SampleTransmFnct = ""
     2026                        SampleMonitorFnct = "NI1_12IDBGetSampleBS"
     2027                        EmptyMonitorFnct = ""
     2028       
     2029                endif
     2030               
     2031        endif
     2032       
     2033       
    19302034        //now configure Nika to produce some data...
    19312035        NVAR DisplayDataAfterProcessing = root:Packages:Convert2Dto1D:DisplayDataAfterProcessing
     
    19392043        NVAR DoCircularAverage = root:Packages:Convert2Dto1D:DoCircularAverage
    19402044        DoCircularAverage = 1
    1941        
    19422045        NVAR QvectorMaxNumPnts = root:Packages:Convert2Dto1D:QvectorMaxNumPnts
    19432046        NVAR QbinningLogarithmic = root:Packages:Convert2Dto1D:QbinningLogarithmic
     
    19972100        //now what type of files are we using?
    19982101        string ListOfTifFiles=IndexedFile(Convert2Dto1DDataPath, -1, ".tif")
    1999         string ListOfHDF5Files=IndexedFile(Convert2Dto1DDataPath, -1, ".hdf")
     2102        string ListOfHDF5Files=IndexedFile(Convert2Dto1DDataPath, -1, ".hdf")+IndexedFile(Convert2Dto1DDataPath, -1, ".h5")
    20002103        if(itemsInList(ListOfTifFiles)>0)
    20012104                APS12IDBDataType = "12IDB_tif"
     
    20032106                APS12IDBDataType = "Nexus"
    20042107        else
    2005                 abort "Unknown image data file type. Can read .tif or .hdf (Nexus) only."
    2006         endif
    2007         //get calibration files.
    2008         //get the path to calibration and SAXS_mask2M.bmp or WAXS_mask2M.bpm, it is one level up...
    2009         string MaskPathStr= RemoveFromList(UsingWhat, DataFilePath,":")
    2010         NewPath/O/Q TempMaskUserPath, MaskPathStr
    2011         string ListOfCalibrations=GrepList(IndexedFile(TempMaskUserPath, -1, ".txt"), "(?i)calibration_parameters")
    2012         string SelectedCalibrationFile =RemoveEnding(GrepList(ListOfCalibrations,"(?i)"+UsingWhat), ";")                //this now should be saxs_calibration_parameters or waxs_calibration_parameters
    2013         print SelectedCalibrationFile
    2014         //get the mask files...
    2015         //mask may or may not exist, we need to get user to pick one or tell us it does not exist...
    2016         string ListOfBMPFiles=IndexedFile(TempMaskUserPath, -1, ".bmp")
    2017         string SelectedMaskFile = RemoveEnding(GrepList(ListOfBMPFiles,"(?i)"+UsingWhat),";")
    2018        
     2108                abort "Unknown image data file type. Can read tif or hdf (Nexus) only."
     2109        endif
     2110       
     2111        string ListOfBMPFiles
     2112        string SelectedMaskFile
    20192113        string LoadCalibration
    20202114        string LoadMaskFile
    20212115        string AlwaysReloadParameters
    20222116        string ProcessingTypeStr
    2023         //dialog...
    2024        
    2025         Prompt LoadCalibration, "Load calibration from "+SelectedCalibrationFile+"?", popup, "Yes;No;"
    2026         if(strlen(SelectedMaskFile)>0)
    2027                 Prompt LoadMaskFile, "Load BMP Mask file "+SelectedMaskFile+"?", popup, "Yes;No;"
    2028         else
    2029                 Prompt LoadMaskFile, "No Mask file found", popup, "No;"
    2030         endif
    2031         Prompt ProcessingTypeStr, "Subtract Empty/background ?", popup, "No;Yes;"
    2032         Prompt AlwaysReloadParameters, "Reload geometry for each image ?", popup, "No;Yes;"
    2033         DoPrompt "Setup parameters", ProcessingTypeStr, LoadCalibration, AlwaysReloadParameters, LoadMaskFile
    2034         if(V_Flag)
    2035                 abort
    2036         else
    2037                 //setup processing method
    2038                 if(stringMatch(ProcessingTypeStr,"Yes"))
    2039                         APS12IDBProcMethod = 1                  //subtract background (materials SAXS common).
     2117        string MaskPathStr
     2118
     2119        //this is ONLY for tiff files...
     2120        if(StringMatch(APS12IDBDataType,"12IDB_tif"))
     2121                //get calibration files.
     2122                //get the path to calibration and SAXS_mask2M.bmp or WAXS_mask2M.bpm, it is one level up...
     2123                MaskPathStr= RemoveFromList(UsingWhat, DataFilePath,":")
     2124                NewPath/O/Q TempMaskUserPath, MaskPathStr
     2125                string ListOfCalibrations=GrepList(IndexedFile(TempMaskUserPath, -1, ".txt"), "(?i)calibration_parameters")
     2126                string SelectedCalibrationFile =RemoveEnding(GrepList(ListOfCalibrations,"(?i)"+UsingWhat), ";")                //this now should be saxs_calibration_parameters or waxs_calibration_parameters
     2127                print SelectedCalibrationFile
     2128                //get the mask files...
     2129                //mask may or may not exist, we need to get user to pick one or tell us it does not exist...
     2130                ListOfBMPFiles=IndexedFile(TempMaskUserPath, -1, ".bmp")
     2131                SelectedMaskFile = RemoveEnding(GrepList(ListOfBMPFiles,"(?i)"+UsingWhat),";")
     2132               
     2133                //dialog...
     2134               
     2135                Prompt LoadCalibration, "Load calibration from "+SelectedCalibrationFile+"?", popup, "Yes;No;"
     2136                if(strlen(SelectedMaskFile)>0)
     2137                        Prompt LoadMaskFile, "Load BMP Mask file "+SelectedMaskFile+"?", popup, "Yes;No;"
    20402138                else
    2041                         APS12IDBProcMethod = 0                  //do not subtract background (bioSAXS common)
     2139                        Prompt LoadMaskFile, "No Mask file found", popup, "No;"
    20422140                endif
    2043                 //Reload metadata always?
    2044                 if(stringMatch(AlwaysReloadParameters,"Yes"))
    2045                         APS12IDBReloadPars = 1                  //reload metadata with each image?
     2141                Prompt ProcessingTypeStr, "Subtract Empty/background ?", popup, "No;Yes;"
     2142                Prompt AlwaysReloadParameters, "Reload geometry for each image ?", popup, "No;Yes;"
     2143                DoPrompt "Setup parameters", ProcessingTypeStr, LoadCalibration, AlwaysReloadParameters, LoadMaskFile
     2144                if(V_Flag)
     2145                        abort
    20462146                else
    2047                         APS12IDBReloadPars = 0                  //do not reload metadata with each image
     2147                        //setup processing method
     2148                        if(stringMatch(ProcessingTypeStr,"Yes"))
     2149                                APS12IDBProcMethod = 1                  //subtract background (materials SAXS common).
     2150                        else
     2151                                APS12IDBProcMethod = 0                  //do not subtract background (bioSAXS common)
     2152                        endif
     2153                        //Reload metadata always?
     2154                        if(stringMatch(AlwaysReloadParameters,"Yes"))
     2155                                APS12IDBReloadPars = 1                  //reload metadata with each image?
     2156                        else
     2157                                APS12IDBReloadPars = 0                  //do not reload metadata with each image
     2158                        endif
     2159                        //mask...
     2160                        if(stringmatch(LoadMaskFile,"Yes"))
     2161                                ImageLoad/T=bmp/Q/N=TMPBMPMask/Z/P=TempMaskUserPath SelectedMaskFile
     2162                                if(V_Flag)
     2163                                        print ":Loaded succesfully mask file from "+MaskPathStr+SelectedMaskFile
     2164                                else
     2165                                        DoALert/T="Could not load Mask file" 0, "Could not load selected file with mask, you need to create mask manually"
     2166                                        UseMask = 0
     2167                                endif
     2168                                Wave LoadedmaskImage = TMPBMPMask
     2169                                ImageTransform rgb2gray LoadedmaskImage
     2170                                Wave M_RGB2Gray
     2171                                ImageTransform flipCols M_RGB2Gray                      //this is correct flip needed...
     2172                                DoWIndow CCDImageToConvertFig
     2173                                if(V_Flag)
     2174                                        RemoveImage/W=CCDImageToConvertFig/Z  M_ROIMask
     2175                                endif
     2176                                KillWaves/Z M_ROIMask, TMPBMPMask
     2177                                wavestats/Q M_RGB2Gray
     2178                                M_RGB2Gray/=V_max                               //normalize to be 1 or 0, seem to be 255
     2179                                Rename M_RGB2Gray, M_ROIMask
     2180                                UseMask = 1
     2181                        else
     2182                                Wave M_ROIMask
     2183                                KillWaves/Z M_ROIMask
     2184                                UseMask = 0
     2185                                print "No Mask Loaded, user needs to setup their own "
     2186                        endif
     2187                        //parse the parameter file
     2188                        if(stringmatch(LoadCalibration,"Yes"))
     2189                                NI1_12IDBLoadTXTMetadata(MaskPathStr, SelectedCalibrationFile) 
     2190                        else
     2191                                print "No calibration file loaded. You are on your own!!!"
     2192                        endif
    20482193                endif
    2049                 //mask...
    2050                 if(stringmatch(LoadMaskFile,"Yes"))
    2051                         ImageLoad/T=bmp/Q/N=TMPBMPMask/Z/P=TempMaskUserPath SelectedMaskFile
    2052                         if(V_Flag)
    2053                                 print ":Loaded succesfully mask file from "+MaskPathStr+SelectedMaskFile
     2194        else    //this is for Nexus, different setup
     2195                //get the path to calibration and SAXS_mask2M.bmp or WAXS_mask2M.bpm, it is one level up...
     2196                MaskPathStr= RemoveFromList(UsingWhat, DataFilePath,":")
     2197                NewPath/O/Q TempMaskUserPath, MaskPathStr
     2198                //get the mask files...
     2199                //mask may or may not exist, we need to get user to pick one or tell us it does not exist...
     2200                ListOfBMPFiles=IndexedFile(TempMaskUserPath, -1, ".bmp")
     2201                SelectedMaskFile = RemoveEnding(GrepList(ListOfBMPFiles,"(?i)"+UsingWhat),";")
     2202               
     2203//              Prompt LoadCalibration, "Load calibration from "+SelectedCalibrationFile+"?", popup, "Yes;No;"
     2204                if(strlen(SelectedMaskFile)>0)
     2205                        Prompt LoadMaskFile, "Load BMP Mask file "+SelectedMaskFile+"?", popup, "Yes;No;"
     2206                else
     2207                        Prompt LoadMaskFile, "No Mask file found", popup, "No;"
     2208                endif
     2209                Prompt ProcessingTypeStr, "Subtract Empty/background ?", popup, "No;Yes;"
     2210                //Prompt AlwaysReloadParameters, "Reload geometry for each image ?", popup, "No;Yes;"
     2211                DoPrompt "Setup parameters", ProcessingTypeStr, LoadMaskFile
     2212                if(V_Flag)
     2213                        abort
     2214                else
     2215                        //setup processing method
     2216                        if(stringMatch(ProcessingTypeStr,"Yes"))
     2217                                APS12IDBProcMethod = 1                  //subtract background (materials SAXS common).
    20542218                        else
    2055                                 DoALert/T="Could not load Mask file" 0, "Could not load selected file with mask, you need to create mask manually"
     2219                                APS12IDBProcMethod = 0                  //do not subtract background (bioSAXS common)
     2220                        endif
     2221                        //Reload metadata always?
     2222                        //if(stringMatch(AlwaysReloadParameters,"Yes"))
     2223                        //      APS12IDBReloadPars = 1                  //reload metadata with each image?
     2224                        //else
     2225                        //      APS12IDBReloadPars = 0                  //do not reload metadata with each image
     2226                        //endif
     2227                        //mask...
     2228                        if(stringmatch(LoadMaskFile,"Yes"))
     2229                                ImageLoad/T=bmp/Q/N=TMPBMPMask/Z/P=TempMaskUserPath SelectedMaskFile
     2230                                if(V_Flag)
     2231                                        print ":Loaded succesfully mask file from "+MaskPathStr+SelectedMaskFile
     2232                                else
     2233                                        DoALert/T="Could not load Mask file" 0, "Could not load selected file with mask, you need to create mask manually"
     2234                                        UseMask = 0
     2235                                endif
     2236                                Wave LoadedmaskImage = TMPBMPMask
     2237                                ImageTransform rgb2gray LoadedmaskImage
     2238                                Wave M_RGB2Gray
     2239                                ImageTransform flipCols M_RGB2Gray                      //this is correct flip needed...
     2240                                DoWIndow CCDImageToConvertFig
     2241                                if(V_Flag)
     2242                                        RemoveImage/W=CCDImageToConvertFig/Z  M_ROIMask
     2243                                endif
     2244                                KillWaves/Z M_ROIMask, TMPBMPMask
     2245                                wavestats/Q M_RGB2Gray
     2246                                M_RGB2Gray/=V_max                               //normalize to be 1 or 0, seem to be 255
     2247                                Duplicate/O M_RGB2Gray, M_ROIMask; KillWaves M_RGB2Gray
     2248                                //the mask needs to be rotated...
     2249                                MatrixOp/O M_ROIMask = reverseRows(M_ROIMask)
     2250                                UseMask = 1
     2251                        else
     2252                                Wave M_ROIMask
     2253                                KillWaves/Z M_ROIMask
    20562254                                UseMask = 0
     2255                                print "No Mask Loaded, user needs to setup their own "
    20572256                        endif
    2058                         Wave LoadedmaskImage = TMPBMPMask
    2059                         ImageTransform rgb2gray LoadedmaskImage
    2060                         Wave M_RGB2Gray
    2061                         ImageTransform flipCols M_RGB2Gray                      //this is correct flip needed...
    2062                         DoWIndow CCDImageToConvertFig
    2063                         if(V_Flag)
    2064                                 RemoveImage/W=CCDImageToConvertFig/Z  M_ROIMask
    2065                         endif
    2066                         KillWaves/Z M_ROIMask, TMPBMPMask
    2067                         wavestats/Q M_RGB2Gray
    2068                         M_RGB2Gray/=V_max                               //normalize to be 1 or 0, seem to be 255
    2069                         Rename M_RGB2Gray, M_ROIMask
    2070                         UseMask = 1
    2071                 else
    2072                         Wave M_ROIMask
    2073                         KillWaves/Z M_ROIMask
    2074                         UseMask = 0
    2075                         print "No Mask Loaded, user needs to setup their own "
     2257                        //parse the parameter file
     2258                         //     if(stringmatch(LoadCalibration,"Yes"))
     2259                        //              NI1_12IDBLoadTXTMetadata(MaskPathStr, SelectedCalibrationFile) 
     2260                        //      else
     2261                        //              print "No calibration file loaded. You are on your own!!!"
     2262                        //      endif
    20762263                endif
    2077                 //parse the parameter file
    2078                 if(stringmatch(LoadCalibration,"Yes"))
    2079                         NI1_12IDBLoadTXTMetadata(MaskPathStr, SelectedCalibrationFile) 
    2080                 else
    2081                         print "No calibration file loaded. You are on your own!!!"
    2082                 endif
    2083         endif
    2084 
     2264        endif
    20852265
    20862266        setDataFolder OldDFf   
  • trunk/User Procedures/Nika/NI1_Main.ipf

    r1180 r1221  
    99constant FixBackgroundOversubScale=1.05                 //this is used to fix oversubtracted background. Adds FixBackgroundOversubScale*abs(V_min) to all intensity value.
    1010constant NikaNumberOfQCirclesDisp=15
     11constant NikaLengthOfPathForPanelDisplay=100
    1112//*************************************************************************\
    1213//* Copyright (c) 2005 - 2022, Argonne National Laboratory
     
    106107                "APS 12ID-C SAXS with Gold Detector", NI1_12IDCLoadAndSetup()
    107108                help={"Support for data from APS 12ID-C camera"}
    108                 "APS 12ID-B SAXS-WAXS ", NI1_12IDBLoadAndSetup()
     109                "APS 12ID-B SAXS-WAXS (Nexus or tiff)", NI1_12IDBLoadAndSetup()
    109110                help={"Support for data from APS 12ID-B camera"}               
    110111                "DND CAT", NI1_DNDConfigureNika()
     
    181182                NewPath/C/O/M="Select path to your data" Convert2Dto1DDataPath
    182183                PathInfo Convert2Dto1DDataPath
    183                 string pathInforStrL = S_Path
     184                string pathInforStrL = S_path[strlen(S_path)-NikaLengthOfPathForPanelDisplay,strlen(S_path)-1]
    184185                NewPath/O/Q Convert2Dto1DEmptyDarkPath, pathInforStrL           
    185186                SVAR MainPathInfoStr=root:Packages:Convert2Dto1D:MainPathInfoStr
  • trunk/User Procedures/Nika/NI1_MainPanel.ipf

    r1204 r1221  
    11#pragma TextEncoding = "UTF-8"
    22#pragma rtGlobals=3             // Use modern global access method.
    3 #pragma version=2.71
    4 Constant NI1AversionNumber = 2.72
     3#pragma version=2.73
     4Constant NI1AversionNumber = 2.73
    55
    66//*************************************************************************\
     
    1010//*************************************************************************/
    1111
     12//2.73 add ability to flip/rotate image after load to let users tweak image orientation.
    1213//2.72 add Use Transparent Beamstop transmission calculation
    1314//2.71 add Eiger types
     
    343344        ListOfStrings+="LineProf_CurveType;LineProf_KnownCurveTypes;RemoveStringFromName;"
    344345        ListOfStrings+="SampleNameMatchStr;EmptyDarkNameMatchStr;Movie_FileName;Movie_Last1DdataSet;"
     346        ListOfStrings+="RotateFLipImageOnLoad;"
    345347        //2DCalibratedDataInput & output
    346348        ListOfStrings+="RebinCalib2DDataToPnts;Calib2DDataOutputFormat;"
     
    406408       
    407409
     410        SVAR RotateFLipImageOnLoad
     411        if(strlen(RotateFLipImageOnLoad)<1)
     412                RotateFLipImageOnLoad="No"
     413        endif
    408414        SVAR RebinCalib2DDataToPnts
    409415        if(strlen(RebinCalib2DDataToPnts)<1)
  • trunk/User Procedures/Nika/NI1_USAXSSupport.ipf

    r1203 r1221  
    15341534                                PathInfo Convert2Dto1DEmptyDarkPath
    15351535                                SVAR MainPathInfoStr=root:Packages:Convert2Dto1D:MainPathInfoStr
    1536                                 MainPathInfoStr = pathInforStrL
     1536                                MainPathInfoStr = pathInforStrL[strlen(pathInforStrL)-NikaLengthOfPathForPanelDisplay,strlen(pathInforStrL)-1]
    15371537
    15381538                                SVAR BmCntrFileType=root:Packages:Convert2Dto1D:BmCntrFileType
Note: See TracChangeset for help on using the changeset viewer.