+++ /dev/null
-#
-#
-# ctfInfo
-# namespace eval CTF
-#
-namespace eval CTF {
- variable ctfInfo
- namespace export ctfInfoLoad ctfInfoSave ctfInfoGraphUpdate
-
-proc Init { { mrc __null__ } } {
- variable ctfInfo
-
- # mrcImage Information Check: set ctfInfo(mrc) $mrc
- set ctfInfo(DEBUGCOMMENT) "DEBUG"
- if { $mrc != "__null__" } {
- # New Object
- array set mrcImage $mrc
- if [ info exists mrcImage(filename) ] {
- # Set New mrcImage
- set filename $mrcImage(filename)
- set ctfInfo(mrc) $mrc
- } else { # mrc is a new filename
- # Set New file
- set filename $mrc
- catch { unset ctfInfo(mrc) }
- }
- } else {
- # No setting
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- # puts "Already FileName"
- } elseif [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- set filename $mrcImage(filename)
- } else { # mrc is filename
- set filename $mrc
- }
- }
- if [ info exists ctfInfo(filename) ] {
- if { $ctfInfo(filename) != $filename } {
- set ctfInfo(flagInit) 0
- } else {
- set ctfInfo(flagInit) 1
- }
- } else {
- set ctfInfo(flagInit) 0
- }
-
- if { $ctfInfo(flagInit) == 1 } {
- return
- } else {
- set ctfInfo(filename) $filename
- }
-
- # Start Initialization
- set ctfInfo(flagInit) 1
-
- # Molecular Envelope for signal
- #Elastic
- set ctfInfo(.defctfinfo) "./.DefCTFInfo"
- set ctfInfo(whichMolec) Gauss
- set ctfInfo(.molcEnvTable) "./carbon.table"
- set ctfInfo(MolcEnv) 8.0
- set ctfInfo(dMolcEnv) 1.0
- set ctfInfo(Elastic) 2.4912
- set ctfInfo(dElastic) 0.0000
- set ctfInfo(ElaShift) 0.0108
- set ctfInfo(dElaShift) 0.0000
- set ctfInfo(ElaWidth) 0.2226
- set ctfInfo(dElaWidth) 0.0100
- set ctfInfo(ElaRing) 1.0000
- set ctfInfo(dElaRing) 0.1000
- set ctfInfo(ElaRShift) 0.2500
- set ctfInfo(dElaRShift) 0.0100
- set ctfInfo(ElaRWidth) 0.1000
- set ctfInfo(dElaRWidth) 0.0100
- #Inelastic
- set ctfInfo(whichInElaMolec) No
- set ctfInfo(.inElaMolcEnvTable) "./carbon.table"
- set ctfInfo(InElaMolcEnv) 8.0
- set ctfInfo(dInElaMolcEnv) 1.0
- set ctfInfo(InElastic) 2.4912
- set ctfInfo(dInElastic) 0.0000
- set ctfInfo(InElaShift) 0.0108
- set ctfInfo(dInElaShift) 0.0000
- set ctfInfo(InElaWidth) 0.2226
- set ctfInfo(dInElaWidth) 0.0100
- set ctfInfo(InElaRing) 1.0000
- set ctfInfo(dInElaRing) 0.1000
- set ctfInfo(InElaRShift) 0.2500
- set ctfInfo(dInElaRShift) 0.0100
- set ctfInfo(InElaRWidth) 0.1000
- set ctfInfo(dInElaRWidth) 0.0100
- #
- #
- #
- set ctfInfo(flagScatGraph) 1
- set ctfInfo(flagScatGraphSubtraction) 0
- set ctfInfo(Imax) 0.001
- set ctfInfo(dImax) 0.0001
- set ctfInfo(Rmax) 0.10
- set ctfInfo(dRmax) 0.01
- set ctfInfo(Imin) 0.00
- set ctfInfo(dImin) 0.0001
- set ctfInfo(Rmin) 0.00
- set ctfInfo(dRmin) 0.01
- #
- #
- #
- set ctfInfo(flagZero) 1
- set ctfInfo(zeroMax) 6
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- set ctfInfo(zero$i) [ expr 0.01*$i ]
- set ctfInfo(dzero$i) 0.01
- }
- set ctfInfo(ThonRingCanvas) 0
-
- set ctfInfo(flagCTFGraph) 1
- set ctfInfo(flagCTFcoreGraph) 0
- set ctfInfo(flagCTFPower) 1
- set ctfInfo(flagLogScale) 0
-
- # Thon Ring Information
- set ctfInfo(flagpredictThonRing) 0
- set ctfInfo(flagpredictZero) 0
- set ctfInfo(flagpredictZeroMax) 1
- set ctfInfo(predictZeroMaxMax) 20
-
- ##
- set ctfInfo(defocus) 500
- set ctfInfo(ddefocus) -100
- set ctfInfo(Cs) 2.1
- set ctfInfo(dCs) 0.1
- set ctfInfo(kV) 200
- set ctfInfo(dkV) 5
- set ctfInfo(AoverP) 0.1
- set ctfInfo(dAoverP) -0.01
- set ctfInfo(Ai) 0.02
- set ctfInfo(dAi) 0.01
- set ctfInfo(Cc) 0.7
- set ctfInfo(dCc) 0.1
- set ctfInfo(dV) 0.7
- set ctfInfo(ddV) 0.1
- set ctfInfo(I) 0.015
- set ctfInfo(dI) 0.002
- set ctfInfo(SN) 0.1
- set ctfInfo(dSN) 0.1
- set ctfInfo(SN2) 0.1
- set ctfInfo(dSN2) 0.1
- set ctfInfo(Isignal) 0.015
- set ctfInfo(dIsignal) 0.002
- set ctfInfo(Inoise) 0.0015
- set ctfInfo(dInoise) 0.0002
- set ctfInfo(Inoise2) 0.0015
- set ctfInfo(dInoise2) 0.0002
- set ctfInfo(whichMTF) singleExp
-
- # MTF
- set ctfInfo(MTF) 38
- set ctfInfo(dMTF) 1
- set ctfInfo(MTF2) 38
- set ctfInfo(dMTF2) 1
- set ctfInfo(MTF2Weight) 0
- set ctfInfo(dMTF2Weight) 0.1
- set ctfInfo(Magnification) 1.0
- set ctfInfo(dMagnification) -0.005
- # Vibration
- set ctfInfo(flagVibration) 1
- set ctfInfo(BofVibration) 4.0
- set ctfInfo(VibrationMode) 0
- # Aliasing
- set ctfInfo(flagAliasing) 1
- set ctfInfo(flagSampling) 0
- set ctfInfo(NyquistFrequency) 1
-
- ## Evaluation of ctfInfo
- set ctfInfo(flagEvaluation) 0
- set ctfInfo(EvalMinMaxMethod) NULL
- # Canvas
- set ctfInfo(flagThonRingOnCanvas) 0
-
- ### Input Graph Data
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- if [ info exists mrcImage(filename) ] {
- set ctfInfo(filename) $mrcImage(filename)
- }
- }
- if [ info exists ctfInfo(filename) ] {
- puts "ANYWAY, move but strange"
- } else {
- puts "No CTFInfo File"
- flush stdout
- return
- }
- } else {
- set ctfInfo(filename) $filename
- }
- if [ file exists $ctfInfo(filename) ] {
-
- } else {
- puts "mrc file not found: Please check"
- }
-
- ### Input Default Data
- if [ string match ".fft" [ file extension $ctfInfo(filename) ] ] {
- set ctfInfo(.ctfps) [ file rootname $ctfInfo(filename) ].ctfps
- set ctfInfo(.ctfinfo) [ file rootname $ctfInfo(filename) ].ctfinfo
- } else {
- set ctfInfo(.ctfps) $ctfInfo(filename).ctfps
- set ctfInfo(.ctfinfo) $ctfInfo(filename).ctfinfo
- }
- set ctfInfo(.ctfinfoMode) "Every"
- if [ file exists $ctfInfo(.ctfinfo) ] {
- ctfInfoLoad
- } elseif [ file exists $ctfInfo(.defctfinfo) ] {
- ctfInfoLoad $ctfInfo(.defctfinfo)
- }
-
- #
- # Data Taking (Scattering)
- #
- ctfInfoScatteringCalc
-}
-
-#
-# CTF Program
-#
-proc Win { { win .ctfInfo } { filename __null__ } { extension 2 } } {
- variable ctfInfo
-
- ### Initialization
- Init
-
- if [ catch { toplevel $win -bd 4 -class CTFInfo } ] {
- raise $win
- } else {
- ### Create New Window
- set w $win
- #
- # Graph Frame
- #
- set f [ frame $w.graph ]
- # Frame for Graph
- set ctfInfo(graph) [ graph $f.graph ]
- ctfInfoGraphInfoFrameCreate $f.info top
- pack $f.graph $f.info -side left -expand true -fill both
-
- # Graph Update
- ctfInfoGraphUpdate
-
- pack $w.graph -side left -expand true -fill both
-
- }
-
- if [ catch { toplevel $win$extension -bd 4 -class CTFInfo } ] { # Window Create
- raise $win$extension
- } else {
- ### Create New Window
- set w $win$extension
-
- # ctfInfo Frame
- ctfInfoCTFInfoFrameCreate $w.ctf left
- #
- # Packing
- #
- pack $w.ctf -side left -expand true -fill both
-
- }
-
- # Marker : Thon Ring
- ctfInfoPredictedMarkerSet
- ctfInfoMarkerReset
-}
-
-#
-# GraphInfo Frame
-#
-proc ctfInfoGraphInfoFrameCreate { f side } {
- frame $f
-
- ctfInfoGraphInfoFrameCreate1 $f.f1
- ctfInfoGraphInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side -expand true -fill both
- return $f
-}
-
-#
-# Related to scattering frame
-#
-proc ctfInfoGraphInfoFrameCreate1 { f } {
- variable ctfInfo
-
- frame $f
- # Scattering Information: Scattering/SubtractScattering
- set cmd "[ namespace code {ctfInfoGraphUpdate} ]"
- set name [ namespace current ]::
-
- #
- set ff [ frame $f.graph ]
- checkbutton $ff.graph -text "Scattering" -variable [subst $name]ctfInfo(flagScatGraph) -command $cmd
- checkbutton $ff.graphsub -text "Subtract" -variable [subst $name]ctfInfo(flagScatGraphSubtraction) -command $cmd
- checkbutton $ff.log -text "Log" -variable [subst $name]ctfInfo(flagLogScale) -command $cmd
- pack $ff.graph $ff.graphsub $ff.log -side left
-
- # Scattering Graph Configure
- set ff [ frame $f.graphConfig ]
- CommandEntryWithUpDown $ff.intensity Imax 4 $cmd [subst $name]ctfInfo(Imax) [subst $name]ctfInfo(dImax) -width 10
- CommandEntryWithUpDown $ff.imin Imin 4 $cmd [subst $name]ctfInfo(Imin) [subst $name]ctfInfo(dImin) -width 10
- CommandEntryWithUpDown $ff.brmax Rmax 4 $cmd [subst $name]ctfInfo(Rmax) [subst $name]ctfInfo(dRmax) -width 10
- CommandEntryWithUpDown $ff.brmin Rmin 4 $cmd [subst $name]ctfInfo(Rmin) [subst $name]ctfInfo(dRmin) -width 10
- pack $ff.intensity $ff.imin $ff.brmax $ff.brmin -side top
-
- #
- # File Frame
- #
- set ff [ frame $f.file ]
-
- #PS
- set fff [ frame $ff.printPS ]
- button $fff.printPS -text "Save" -command "[subst $name]ctfInfoSaveAsPS"
- CommandEntry $fff.printPSEntry Graph 5 "[subst $name]ctfInfoSaveAsPS" -textvar [subst $name]ctfInfo(.ctfps)
- pack $fff.printPS $fff.printPSEntry -side left
-
- # Info
- set fff [ frame $ff.printInfo ]
- button $fff.printInfo -text "Save" -command "[subst $name]ctfInfoSave"
- CommandEntry $fff.printInfoEntry Info 5 "[subst $name]ctfInfoSave" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.printInfo $fff.printInfoEntry -side left
-
- # InfoLoad
- set fff [ frame $ff.loadInfo ]
- button $fff.loadInfo -text "Load" -command "[subst $name]ctfInfoLoad"
- CommandEntry $fff.loadInfoEntry Info 5 "[subst $name]ctfInfoLoad" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.loadInfo $fff.loadInfoEntry -side left
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- # Packing
- pack \
- $f.graph \
- $f.graphConfig \
- $f.file \
- -side top -expand true
- return $f
-}
-
-#
-# Thon Ring on canvas
-# Incomplete procedure
-#
-proc ctfInfoGraphInfoFrameCreate2 { f } {
- variable ctfInfo
-
- frame $f
-
- # Thon Ring
- set cmd ctfInfoMarkerSet
- checkbutton $f.zero -text "Thon Ring (zero)" -variable ctfInfo(flagZero) -command $cmd
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- CommandEntryWithUpDown $f.zero$i $i 4 $cmd ctfInfo(zero$i) ctfInfo(dzero$i) -width 6
- }
- button $f.zeroReset -text Reset -command ctfInfoMarkerReset
-
- pack $f.zero -side top -expand true
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- pack $f.zero$i -side top -expand true
- }
- pack $f.zeroReset -side top -expand true
-
- return $f
-}
-
-#
-# Graph Save as a PS file
-#
-proc ctfInfoSaveAsPS { } {
- variable ctfInfo
-
- puts $ctfInfo(.ctfps)
- $ctfInfo(graph) postscript output $ctfInfo(.ctfps) -center false
-}
-
-#
-# ctfInfoFile
-#
-# Save
-#
-proc ctfInfoSave { } {
- variable ctfInfo
-
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) a 0600 ]
-
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- foreach { name value } [ array get ctfInfo ] {
- if { $name == "filename" || $name=="mrc"} {
-
- } else {
- puts $fpt "$name: $value"
- }
- }
- }
- Main {
- puts $fpt "defocus: $ctfInfo(defocus)"
- puts $fpt "AoverP: $ctfInfo(AoverP)"
- puts $fpt "kV: $ctfInfo(kV)"
- puts $fpt "Cs: $ctfInfo(Cs)"
- puts $fpt "Cc: $ctfInfo(Cc)"
- puts $fpt "Ai: $ctfInfo(Ai)"
- puts $fpt "I: $ctfInfo(I)"
- puts $fpt "SN: $ctfInfo(SN)"
- puts $fpt "SN2: $ctfInfo(SN2)"
- puts $fpt "Isignal: $ctfInfo(Isignal)"
- puts $fpt "Inoise: $ctfInfo(Inoise)"
- puts $fpt "Inoise2: $ctfInfo(Inoise2)"
- puts $fpt "whichMTF: $ctfInfo(whichMTF)"
- puts $fpt "MTF: $ctfInfo(MTF)"
- puts $fpt "MTF2: $ctfInfo(MTF2)"
- puts $fpt "MTF2Weight: $ctfInfo(MTF2Weight)"
- puts $fpt "MolcEnv: $ctfInfo(MolcEnv)"
- puts $fpt "Magnification: $ctfInfo(Magnification)"
- puts $fpt "flagCTFPower: $ctfInfo(flagCTFPower)"
- puts $fpt "BofVibration: $ctfInfo(BofVibration)"
- puts $fpt "flagVibration: $ctfInfo(flagVibration)"
- puts $fpt "VibrationMode: $ctfInfo(VibrationMode)"
- puts $fpt "Imax: $ctfInfo(Imax)"
- puts $fpt "Imin: $ctfInfo(Imin)"
- puts $fpt "Rmax: $ctfInfo(Rmax)"
- puts $fpt "Rmin: $ctfInfo(Rmin)"
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
-}
-
-#
-# ctfInfoFile
-#
-# Load
-#
-proc ctfInfoLoad { { filename __null__ } } {
- variable ctfInfo
-
- if { $filename != "__null__" } {
- if [ file exists $filename ] {
- set fpt [ open $filename r ]
- }
- } else {
- if [ info exists ctfInfo ] {
- puts "ctfInfo exists"
- puts $ctfInfo(DEBUGCOMMENT)
- } else {
- puts "ctfInfo does not exist"
- return
- }
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) r ]
- }
-
- while { ! [ eof $fpt ] } {
- gets $fpt s
- set slist [ split $s ":" ]
- set name [ string trim [ lindex $slist 0 ] ]
- set value [ string trim [ lindex $slist 1 ] ]
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- if { $name == "filename" || $name=="mrc"} {
- #
- } else {
- set ctfInfo($name) $value
- }
- }
- Main {
- if {
- $name == "defocus"
- || $name == "AoverP"
- || $name == "kV"
- || $name == "Cs"
- || $name == "Cc"
- || $name == "Ai"
- || $name == "I"
- || $name == "SN"
- || $name == "SN2"
- || $name == "Isignal"
- || $name == "Inoise"
- || $name == "Inoise2"
- || $name == "whichMTF"
- || $name == "MTF"
- || $name == "MTF2"
- || $name == "MTF2Weight"
- || $name == "MolcEnv"
- || $name == "Magnification"
- || $name == "flagCTFPower"
- || $name == "BofVibration"
- || $name == "Vibration"
- || $name == "VibrationMode"
- || $name == "Imax"
- || $name == "Imin"
- || $name == "Imax"
- || $name == "Rmin" } {
- set ctfInfo($name) $value
- }
- }
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
- if [ info exists ctfInfo(graph) ] {
- if [ info exists $ctfInfo(graph) ] {
- ctfInfoGraphUpdate
- }
- }
-}
-#
-#
-#
-proc ctfInfoMolecEnvSet { } {
- variable ctfInfo
-
- # Elastic
- switch $ctfInfo(whichMolec) {
- Gauss {
- ctfInfoSet MolecEnv $ctfInfo(MolcEnv)
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet Elastic 1 $ctfInfo(Elastic) $ctfInfo(ElaShift) $ctfInfo(ElaWidth) \
- $ctfInfo(ElaRing) $ctfInfo(ElaRShift) $ctfInfo(ElaRWidth)
- ctfInfoSet MolecEnvMode 0
- }
- Table {
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvTable $ctfInfo(.molcEnvTable)
- ctfInfoSet MolecEnvMode 1
- }
- }
-
- # Inelastic
- switch $ctfInfo(whichInElaMolec) {
- No {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Gauss {
- ctfInfoSet InElasticMode 1
- ctfInfoSet InElaMolecEnv $ctfInfo(InElaMolcEnv)
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1 $ctfInfo(InElastic) $ctfInfo(InElaShift) $ctfInfo(InElaWidth) \
- $ctfInfo(InElaRing) $ctfInfo(InElaRShift) $ctfInfo(InElaRWidth)
- ctfInfoSet InElaMolecEnvMode 0
- }
- Table {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1
- ctfInfoSet InElaMolecEnvTable $ctfInfo(.inElaMolcEnvTable)
- ctfInfoSet InElaMolecEnvMode 1
- }
- }
-}
-
-#
-#
-#
-proc ctfInfoCTFInfoFrameCreate { f side } {
- # Frame for ctfInfo
- frame $f
-
- ctfInfoCTFInfoFrameCreate1 $f.f1
- ctfInfoCTFInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side
- return $f
-}
-
-proc ctfInfoCTFInfoFrameCreate1 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- frame $f
-
- # Which CTF Plot
- set ff [ frame $f.title ]
- checkbutton $ff.main -text "CTF Params" -variable [subst $name]ctfInfo(flagCTFGraph) -command $cmd
- checkbutton $ff.sub -text "Core" -variable [subst $name]ctfInfo(flagCTFcoreGraph) -command $cmd
- checkbutton $ff.power -text "Power" -variable [subst $name]ctfInfo(flagCTFPower) -command $cmd
- pack $ff.main $ff.sub $ff.power -side left -expand true
-
- # Main Parameters
- set ff [ frame $f.main ]
- CommandEntryWithUpDown $ff.defocus "defocus A " 10 $cmd [subst $name]ctfInfo(defocus) [subst $name]ctfInfo(ddefocus) -width 6
- CommandEntryWithUpDown $ff.aoverP "AoverP " 10 $cmd [subst $name]ctfInfo(AoverP) [subst $name]ctfInfo(dAoverP) -width 6
- CommandEntryWithUpDown $ff.is "Isingal " 10 $cmd [subst $name]ctfInfo(Isignal) [subst $name]ctfInfo(dIsignal) -width 6
- CommandEntryWithUpDown $ff.in "Inoise " 10 $cmd [subst $name]ctfInfo(Inoise) [subst $name]ctfInfo(dInoise) -width 6
- CommandEntryWithUpDown $ff.in2 "Inoise2 " 10 $cmd [subst $name]ctfInfo(Inoise2) [subst $name]ctfInfo(dInoise2) -width 6
- CommandEntryWithUpDown $ff.mag "Mag " 10 $cmd [subst $name]ctfInfo(Magnification) [subst $name]ctfInfo(dMagnification) -width 6
- pack $ff.defocus $ff.aoverP $ff.is $ff.in $ff.in2 $ff.mag -side top -expand true
-
- # MTF
- set ff [ frame $f.mtf ]
- RadioButtonsCreateWithPackWithCommand $ff.which MTF $cmd left [subst $name]ctfInfo(whichMTF) singleExp Lorentz BothMul BothSum Linear
- CommandEntryWithUpDown $ff.mtf "MTF A " 10 $cmd [subst $name]ctfInfo(MTF) [subst $name]ctfInfo(dMTF) -width 6
- CommandEntryWithUpDown $ff.mtf2 "MTF2 A " 10 $cmd [subst $name]ctfInfo(MTF2) [subst $name]ctfInfo(dMTF2) -width 6
- CommandEntryWithUpDown $ff.mtfw "MTF2Weight" 10 $cmd [subst $name]ctfInfo(MTF2Weight) [subst $name]ctfInfo(dMTF2Weight) -width 6
- pack $ff.which $ff.mtf $ff.mtf2 $ff.mtfw -side top
-
- # Elastic Scattering
- set ff [ frame $f.molec ]
- RadioButtonsCreateWithPackWithCommand $ff.which Elastic $cmd left [subst $name]ctfInfo(whichMolec) Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "GaussB A" 10 $cmd [subst $name]ctfInfo(MolcEnv) [subst $name]ctfInfo(dMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "E " 10 $cmd [subst $name]ctfInfo(Elastic) [subst $name]ctfInfo(dElastic) -width 6
- CommandEntryWithUpDown $ff.shift "E Shift" 10 $cmd [subst $name]ctfInfo(ElaShift) [subst $name]ctfInfo(dElaShift) -width 6
- CommandEntryWithUpDown $ff.width "E Width" 10 $cmd [subst $name]ctfInfo(ElaWidth) [subst $name]ctfInfo(dElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "E Ring " 10 $cmd [subst $name]ctfInfo(ElaRing) [subst $name]ctfInfo(dElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "E RShift" 10 $cmd [subst $name]ctfInfo(ElaRShift) [subst $name]ctfInfo(dElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "E RWidth" 10 $cmd [subst $name]ctfInfo(ElaRWidth) [subst $name]ctfInfo(dElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.molcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- # Inelastic
- set ff [ frame $f.inelamolec ]
- checkbutton $ff.use -text "With Inelastic" -variable [subst $name]ctfInfo(flagInElastic) -command $cmd
- RadioButtonsCreateWithPackWithCommand $ff.which Inelastic $cmd left [subst $name]ctfInfo(whichInElaMolec) No Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "IE Gauss B" 10 $cmd [subst $name]ctfInfo(InElaMolcEnv) [subst $name]ctfInfo(dInElaMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "IE " 10 $cmd [subst $name]ctfInfo(InElastic) [subst $name]ctfInfo(dInElastic) -width 6
- CommandEntryWithUpDown $ff.shift "IE Shift" 10 $cmd [subst $name]ctfInfo(InElaShift) [subst $name]ctfInfo(dInElaShift) -width 6
- CommandEntryWithUpDown $ff.width "IE Width" 10 $cmd [subst $name]ctfInfo(InElaWidth) [subst $name]ctfInfo(dInElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "IE Ring " 10 $cmd [subst $name]ctfInfo(InElaRing) [subst $name]ctfInfo(dInElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "IE RShift" 10 $cmd [subst $name]ctfInfo(InElaRShift) [subst $name]ctfInfo(dInElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "IE RWidth" 10 $cmd [subst $name]ctfInfo(InElaRWidth) [subst $name]ctfInfo(dInElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.inElaMolcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- set ff [ frame $f.calc ]
- button $ff.draw -text Draw -command $cmd
- button $ff.initS -text InitSearch -command [subst $name]ctfInitSearch
- button $ff.fineT -text FineTune -command [subst $name]ctfFineTuning
- pack $ff.draw $ff.initS $ff.fineT -side left -expand true
-
- pack \
- $f.title \
- $f.main \
- $f.mtf \
- $f.molec \
- $f.inelamolec \
- $f.calc \
- -side top -expand true
-
- return $f
-}
-
-proc ctfInitSearch { } {
- variable ctfInfo
-
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 1"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 0
- ctfInfoLoad
-}
-
-proc ctfFineTuning { } {
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16
- ctfInfoLoad
-}
-
-#
-# CTF Information
-#
-proc ctfInfoCTFInfoFrameCreate2 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- frame $f
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- CommandEntry $f.i "I(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(I)" -width 6
- CommandEntry $f.sN "SN(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN)" -width 6
- CommandEntry $f.sN2 "SN2(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN2)" -width 6
- CommandEntry $f.cs "Cs mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cs)" -width 6
- CommandEntry $f.kV "kV kV " 10 $cmd -textvar "[subst $name]ctfInfo(kV)" -width 6
- CommandEntry $f.ai "Ai mrad " 10 $cmd -textvar "[subst $name]ctfInfo(Ai)" -width 6
- CommandEntry $f.cc "Cc mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cc)" -width 6
- CommandEntry $f.dkV "dV eV " 10 $cmd -textvar "[subst $name]ctfInfo(dV)" -width 6
- CommandEntry $f.vib "Vibration " 10 $cmd -textvar "[subst $name]ctfInfo(BofVibration)" -width 6
- CommandEntry $f.vibMode "Vib-mode " 10 $cmd -textvar "[subst $name]ctfInfo(VibrationMode)" -width 6
- checkbutton $f.aliasing -text "Aliasing" -variable [subst $name]ctfInfo(flagAliasing) -command $cmd
- checkbutton $f.sampling -text "Sampling" -variable [subst $name]ctfInfo(flagSampling) -command $cmd
- CommandEntry $f.nyquist "Nyquist " 10 $cmd -textvar "[subst $name]ctfInfo(NyquistFrequency)" -width 6
-
- pack \
- $f.i \
- $f.sN \
- $f.sN2 \
- $f.cs \
- $f.kV \
- $f.ai \
- $f.cc \
- $f.dkV \
- $f.vib \
- $f.vibMode \
- $f.aliasing \
- $f.sampling \
- $f.nyquist \
- -side top -expand true
- return $f
-}
-
-#
-# ctfInfoMarker: Thon Ring Line
-# Movable marker for thonRingDetermine
-#
-
-# Marker Set
-proc ctfInfoMarkerSet { } {
- variable ctfInfo
-
- ctfInfoMarkerUnset
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- $ctfInfo(graph) marker create line -name zero$i \
- -coords { $ctfInfo(zero$i) 0 \
- $ctfInfo(zero$i) 1 }
- $ctfInfo(graph) marker configure zero$i -dashes { 2 2 }
- }
-}
-
-# Marker Unset
-proc ctfInfoMarkerUnset { } {
- variable ctfInfo
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete zero$i }
- }
-}
-
-#
-# Thon Ring Information
-# Predicted Marker Set for Graph
-#
-proc ctfInfoPredictedThonRing { } {
- variable ctfInfo
-
- set size [ llength $ctfInfo(R) ]
- set dR [ expr [lindex $ctfInfo(R) 1]-[lindex $ctfInfo(R) 0]]
- set RMax [ lindex $ctfInfo(R) [expr $size-1] ]
- set Zero [ ctfInfoGet Zero $RMax $ctfInfo(predictZeroMaxMax) $dR ]
- set ctfInfo(predictZeroMax) [ expr [ llength $Zero ] / 3 ]
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ctfInfo(predictZero$i) [ lindex $Zero [ expr 3*$i ] ]
- set ctfInfo(predictZeroCTF$i) [ expr 0.8*$ctfInfo(Imax) ]
- set data [ lindex $Zero [ expr 3*$i + 1 ] ]
- set data1 [ lindex $Zero [ expr 3*$i + 2 ] ]
- if { $ctfInfo(flagCTFPower) == 1 } {
- set ctfInfo(predictZeroCTF$i) [ expr $data*$data + $data1*$data1 ]
- } else {
- set ctfInfo(predictZeroCTF$i) [ expr $data + $data1 ]
- }
- }
- set ctfInfo(flagpredictThonRing) 1
-}
-
-#
-# PredictedMarker of ThonRing on canvas
-#
-proc ctfInfoPredictedMarkerOnCanvas { } {
- variable ctfInfo
-
- if [ info exists ctfInfo(mrc) ] {
- array set mainImage $ctfInfo(mrc)
- if [ info exists mainImage(mainCanvas) ] {
- puts $mainImage(mainCanvas)
- #$mainImage(mainCanvas) create oval 0 0 10 10
- .main_canvas create oval 0 0 10 10
- } else {
- puts "No canvas to draw Thon rings: in ctfInfoCTFLineCreate"
- }
- } else {
- puts "No mrc Setting"
- }
-}
-
-#
-# PredictedMarker of ThonRing on graph
-#
-proc ctfInfoPredictedMarkerSet { } {
- variable ctfInfo
-
- # Zero Point
- ctfInfoPredictedThonRing
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ymax [ expr 1.2*$ctfInfo(predictZeroCTF$i) ]
- $ctfInfo(graph) marker create line -name predictZero$i -coords {
- $ctfInfo(predictZero$i) 0 \
- $ctfInfo(predictZero$i) $ymax }
- #$ctfInfo(graph) marker configure predictZero$i -foreground black
- }
- set ctfInfo(flagpredictZero) 1
-}
-
-#
-proc ctfInfoPredictedMarkerUnset { } {
- variable ctfInfo
- if { $ctfInfo(flagpredictZero) == 1 } {
- for { set i 1 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete predictZero$i }
- }
- }
- set ctfInfo(flagpredictZero) 0
-}
-#
-proc ctfInfoMarkerReset { } {
- variable ctfInfo
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- if [ info exists ctfInfo(predictZero$i) ] {
- set ctfInfo(zero$i) $ctfInfo(predictZero$i)
- } else {
- puts "ctfInfo(zeroMax) is wrong at $i: $ctfInfo(zeroMax)"
- break
- }
- }
- ctfInfoMarkerSet
-}
-
-
-#
-# Graph Update
-#
-
-proc ctfInfoGraphUpdate { } {
- variable ctfInfo
-
- ctfInfoGraphConfiguration
- if { $ctfInfo(flagScatGraph) == 1 } {
- ctfInfoScatteringLineCreate Scattering $ctfInfo(graph) ctfInfo(R) ctfInfo(Scattering)
- } else {
- catch { $ctfInfo(graph) element delete Scattering }
- }
- if { $ctfInfo(flagScatGraphSubtraction) == 1 } {
- catch { ctfInfoScatteringLineCreate ScatteringSubtraction $ctfInfo(graph) ctfInfo(R) ctfInfo(ScatteringSubtraction) }
- } else {
- catch { $ctfInfo(graph) element delete ScatteringSubtraction }
- }
- ctfInfoCTFLineCreate $ctfInfo(graph)
-}
-
-#
-# ctfInfoScatteringLineCreate
-# Scattering Data Plotting
-#
-proc ctfInfoScatteringLineCreate { name g x y } {
- upvar $x xx
- upvar $y yy
- # Drawing Graph (Scattering)
- catch { $g element delete $name }
- $g element create $name -xdata $xx -ydata $yy
- $g element configure $name -pen scatPen
-}
-
-#
-# ctfInfoCTFLineCreate
-# CTF Graph Create
-# Elements:
-# CTF
-# CTFcore
-# Noise
-#
-proc ctfInfoCTFLineCreate { g } {
- variable ctfInfo
-
- # CTF Calc
- ctfInfoCTFCalculation
-
- # Graph Delete
- catch { $g element delete CTF }
- catch { $g element delete CTFcore }
- catch { $g element delete Noise }
-
- # Markder Unset
- ctfInfoPredictedMarkerUnset
-
- # Signal + Noise
- if { $ctfInfo(flagCTFGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) == 1 } {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTFPower)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoisePower)
- } else {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTF)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoise)
- }
- $g element configure CTF -pen ctfPen
- $g element configure Noise -pen ctfPen
-
- ctfInfoPredictedMarkerSet
- }
-
- # Signal Only
- if { $ctfInfo(flagCTFcoreGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) } {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignalPower)
- } else {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignal)
- }
- $g element configure CTFcore -pen ctfPen
- }
- if { $ctfInfo(flagThonRingOnCanvas) == 1 } {
- ctfInfoPredictedMarkerOnCanvas
- }
-
- # Configuration
- ctfInfoGraphConfiguration
-}
-
-#
-# ctfInfoGraphConfiguration
-# Axis, Title, Logscale etc.
-#
-proc ctfInfoGraphConfiguration { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
-
- $g configure -title "CTF($ctfInfo(filename))"
- $g axis configure x -title "R" -loose yes -max $ctfInfo(Rmax) -hide no
- $g axis configure y -title "Intensity" -loose yes -max $ctfInfo(Imax) -hide no
- $g legend configure -position top -hide no
- $g axis configure x -max $ctfInfo(Rmax)
- $g axis configure x -min $ctfInfo(Rmin)
- $g axis configure y -max $ctfInfo(Imax)
- $g axis configure y -min $ctfInfo(Imin)
- if { $ctfInfo(flagLogScale) == 1 } {
- if { $ctfInfo(Imin) <= 0 } {
- set ctfInfo(Imin) [ expr $ctfInfo(Imax)*1e-6 ]
- }
- $g axis configure y -logscale yes
- } else {
- $g axis configure y -logscale no
- }
- ctfInfoGraphPenCreate
-
- Blt_ZoomStack $g
- Blt_Crosshairs $g
- Blt_ActiveLegend $g
- Blt_ClosestPoint $g
-}
-
-# Pen Information
-#
-proc ctfInfoGraphPenCreate { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
- catch { $g pen create scatPen }
- $g pen configure scatPen -pixels 0 -color blue
- catch { $g pen create ctfPen }
- $g pen configure ctfPen -pixels 0 -color red
-}
-
-#
-# ctfInfoCTFInfomationSet
-#
-proc ctfInfoCTFInfomationSet { } {
- variable ctfInfo
-
- # set
- set ctfInfo(I) $ctfInfo(Isignal)
- set ctfInfo(SN) [ expr double($ctfInfo(Inoise))/double($ctfInfo(Isignal))]
- set ctfInfo(SN2) [ expr double($ctfInfo(Inoise2))/double($ctfInfo(Isignal))]
-
- #
- set size [ llength $ctfInfo(R) ]
- ctfInfoSet kV $ctfInfo(kV)
- ctfInfoSet defocus $ctfInfo(defocus)
- ctfInfoSet Cc $ctfInfo(Cc)
- ctfInfoSet dE $ctfInfo(dV)
- ctfInfoSet Cs $ctfInfo(Cs)
- ctfInfoSet Ai $ctfInfo(Ai)
- ctfInfoSet I $ctfInfo(I)
- ctfInfoSet Mag $ctfInfo(Magnification)
- ctfInfoSet AoverP $ctfInfo(AoverP)
- ctfInfoSet Mode [ expr 1 + 32 + 64 ]
- switch -exact -- $ctfInfo(whichMTF) {
- singleExp {
- ctfInfoSet MTFMode 0
- }
- Lorentz {
- ctfInfoSet MTFMode 1
- }
- BothMul {
- ctfInfoSet MTFMode 2
- }
- Linear {
- ctfInfoSet MTFMode 3
- }
- BothSum {
- ctfInfoSet MTFMode 4
- }
- default {
- puts "Not supported MTF mode: $ctfInfo(whichMTF)"
- }
- }
- ctfInfoSet MTF $ctfInfo(MTF)
- ctfInfoSet MTF2 $ctfInfo(MTF2)
- ctfInfoSet MTF2Weight $ctfInfo(MTF2Weight)
- ctfInfoSet Noise $ctfInfo(SN)
- ctfInfoSet Noise2 $ctfInfo(SN2)
- ctfInfoSet R $size $ctfInfo(R)
- ctfInfoSet VibrationMode $ctfInfo(VibrationMode)
- ctfInfoSet BofVibration $ctfInfo(BofVibration)
- ctfInfoSet flagVibration $ctfInfo(flagVibration)
- ctfInfoSet Aliasing $ctfInfo(flagAliasing) $ctfInfo(NyquistFrequency)
- ctfInfoSet Sampling $ctfInfo(flagSampling) $ctfInfo(NyquistFrequency)
-
- #
- ctfInfoMolecEnvSet
-}
-
-#
-# ctfInfoCTFCalculation
-#
-proc ctfInfoCTFCalculation { } {
- variable ctfInfo
-
- #
- #puts "ctfInfoCTFCalculation: Power: $ctfInfo(flagCTFPower)"
-
- # Information Set
- ctfInfoCTFInfomationSet
-
- # Data Unset
- catch { unset ctfInfo(CTF) }
- catch { unset ctfInfo(CTFPower) }
- catch { unset ctfInfo(CTFcore) }
- catch { unset ctfInfo(CTFcorePower) }
- catch { unset ctfInfo(CTFNoise) }
- catch { unset ctfInfo(CTFNoisePower) }
- catch { unset ctfInfo(CTFSignal) }
- catch { unset ctfInfo(CTFSignalPower) }
- catch { unset ctfInfo(ScatteringSubtraction) }
-
- # Data Set
- set size [ llength $ctfInfo(R) ]
- if { $ctfInfo(flagCTFPower) } {
- set ctfInfo(CTFPower) [ ctfInfoCalc CTFPower ]
- set ctfInfo(CTFcorePower) [ ctfInfoCalc CTFcorePower ]
- set ctfInfo(CTFNoisePower) [ ctfInfoCalc CTFNoisePower ]
- set ctfInfo(CTFSignalPower) [ ctfInfoCalc CTFSignalPower ]
- } else {
- set ctfInfo(CTF) [ ctfInfoCalc CTF ]
- set ctfInfo(CTFcore) [ ctfInfoCalc CTFcore ]
- set ctfInfo(CTFNoise) [ ctfInfoCalc CTFNoise ]
- set ctfInfo(CTFSignal) [ ctfInfoCalc CTFSignal ]
- }
- for { set i 0 } { $i < $size } { incr i } {
- set data [ lindex $ctfInfo(Scattering) $i ]
- if { $ctfInfo(flagCTFPower) } {
- set noise [ lindex $ctfInfo(CTFNoisePower) $i ]
- } else {
- set noise [ lindex $ctfInfo(CTFNoise) $i ]
- }
- lappend ctfInfo(ScatteringSubtraction) [ expr $data - $noise ]
- }
-}
-
-#
-# Scattering Data
-#
-proc ctfInfoScatteringCalc { { filename __null__ } } {
- variable ctfInfo
-
- #puts "ctfInfoScatteringCalc"
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- } else {
- puts "no file for Scattring calc."
- return
- }
- }
- set xy [ mrcInfoGet $filename Spectrum2 ]
-
- catch { unset ctfInfo(R) }
- catch { unset ctfInfo(Scattering) }
- catch { unset ctfInfo(ScatteringRoot) }
-
- foreach { x y } $xy {
- lappend ctfInfo(R) $x
- lappend ctfInfo(Scattering) $y
- lappend ctfInfo(ScatteringRoot) [ expr sqrt($y)]
- }
- set ctfInfo(NyquistFrequency) [ lindex $ctfInfo(R) end ]
-}
-
-#end of CTF namespace
-}
-
+++ /dev/null
-#
-#
-# ctfInfo
-# namespace eval CTF
-#
-namespace eval CTF {
- variable ctfInfo
- namespace export ctfInfoLoad ctfInfoSave ctfInfoGraphUpdate
-
-proc Init { { mrc __null__ } } {
- variable ctfInfo
-
- # mrcImage Information Check: set ctfInfo(mrc) $mrc
- set ctfInfo(DEBUGCOMMENT) "DEBUG"
- if { $mrc != "__null__" } {
- # New Object
- array set mrcImage $mrc
- if [ info exists mrcImage(filename) ] {
- # Set New mrcImage
- set filename $mrcImage(filename)
- set ctfInfo(mrc) $mrc
- } else { # mrc is a new filename
- # Set New file
- set filename $mrc
- catch { unset ctfInfo(mrc) }
- }
- } else {
- # No setting
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- # puts "Already FileName"
- } elseif [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- set filename $mrcImage(filename)
- } else { # mrc is filename
- set filename $mrc
- }
- }
- if [ info exists ctfInfo(filename) ] {
- if { $ctfInfo(filename) != $filename } {
- set ctfInfo(flagInit) 0
- } else {
- set ctfInfo(flagInit) 1
- }
- } else {
- set ctfInfo(flagInit) 0
- }
-
- if { $ctfInfo(flagInit) == 1 } {
- return
- } else {
- set ctfInfo(filename) $filename
- }
-
- # Start Initialization
- set ctfInfo(flagInit) 1
-
- # Molecular Envelope for signal
- #Elastic
- set ctfInfo(.defctfinfo) "./.DefCTFInfo"
- set ctfInfo(whichMolec) Gauss
- set ctfInfo(.molcEnvTable) "./carbon.table"
- set ctfInfo(MolcEnv) 8.0
- set ctfInfo(dMolcEnv) 1.0
- set ctfInfo(Elastic) 2.4912
- set ctfInfo(dElastic) 0.0000
- set ctfInfo(ElaShift) 0.0108
- set ctfInfo(dElaShift) 0.0000
- set ctfInfo(ElaWidth) 0.2226
- set ctfInfo(dElaWidth) 0.0100
- set ctfInfo(ElaRing) 1.0000
- set ctfInfo(dElaRing) 0.1000
- set ctfInfo(ElaRShift) 0.2500
- set ctfInfo(dElaRShift) 0.0100
- set ctfInfo(ElaRWidth) 0.1000
- set ctfInfo(dElaRWidth) 0.0100
- #Inelastic
- set ctfInfo(whichInElaMolec) No
- set ctfInfo(.inElaMolcEnvTable) "./carbon.table"
- set ctfInfo(InElaMolcEnv) 8.0
- set ctfInfo(dInElaMolcEnv) 1.0
- set ctfInfo(InElastic) 2.4912
- set ctfInfo(dInElastic) 0.0000
- set ctfInfo(InElaShift) 0.0108
- set ctfInfo(dInElaShift) 0.0000
- set ctfInfo(InElaWidth) 0.2226
- set ctfInfo(dInElaWidth) 0.0100
- set ctfInfo(InElaRing) 1.0000
- set ctfInfo(dInElaRing) 0.1000
- set ctfInfo(InElaRShift) 0.2500
- set ctfInfo(dInElaRShift) 0.0100
- set ctfInfo(InElaRWidth) 0.1000
- set ctfInfo(dInElaRWidth) 0.0100
- #
- #
- #
- set ctfInfo(flagScatGraph) 1
- set ctfInfo(flagScatGraphSubtraction) 0
- set ctfInfo(Imax) 0.001
- set ctfInfo(dImax) 0.0001
- set ctfInfo(Rmax) 0.10
- set ctfInfo(dRmax) 0.01
- set ctfInfo(Imin) 0.00
- set ctfInfo(dImin) 0.0001
- set ctfInfo(Rmin) 0.00
- set ctfInfo(dRmin) 0.01
- #
- #
- #
- set ctfInfo(flagZero) 1
- set ctfInfo(zeroMax) 6
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- set ctfInfo(zero$i) [ expr 0.01*$i ]
- set ctfInfo(dzero$i) 0.01
- }
- set ctfInfo(ThonRingCanvas) 0
-
- set ctfInfo(flagCTFGraph) 1
- set ctfInfo(flagCTFcoreGraph) 0
- set ctfInfo(flagCTFPower) 1
- set ctfInfo(flagLogScale) 0
-
- # Thon Ring Information
- set ctfInfo(flagpredictThonRing) 0
- set ctfInfo(flagpredictZero) 0
- set ctfInfo(flagpredictZeroMax) 1
- set ctfInfo(predictZeroMaxMax) 20
-
- ##
- set ctfInfo(defocus) 500
- set ctfInfo(ddefocus) -100
- set ctfInfo(Cs) 2.1
- set ctfInfo(dCs) 0.1
- set ctfInfo(kV) 200
- set ctfInfo(dkV) 5
- set ctfInfo(AoverP) 0.1
- set ctfInfo(dAoverP) -0.01
- set ctfInfo(Ai) 0.02
- set ctfInfo(dAi) 0.01
- set ctfInfo(Cc) 0.7
- set ctfInfo(dCc) 0.1
- set ctfInfo(dV) 0.7
- set ctfInfo(ddV) 0.1
- set ctfInfo(I) 0.015
- set ctfInfo(dI) 0.002
- set ctfInfo(SN) 0.1
- set ctfInfo(dSN) 0.1
- set ctfInfo(SN2) 0.1
- set ctfInfo(dSN2) 0.1
- set ctfInfo(Isignal) 0.015
- set ctfInfo(dIsignal) 0.002
- set ctfInfo(Inoise) 0.0015
- set ctfInfo(dInoise) 0.0002
- set ctfInfo(Inoise2) 0.0015
- set ctfInfo(dInoise2) 0.0002
- set ctfInfo(whichMTF) singleExp
-
- # MTF
- set ctfInfo(MTF) 38
- set ctfInfo(dMTF) 1
- set ctfInfo(MTF2) 38
- set ctfInfo(dMTF2) 1
- set ctfInfo(MTF2Weight) 0
- set ctfInfo(dMTF2Weight) 0.1
- set ctfInfo(Magnification) 1.0
- set ctfInfo(dMagnification) -0.005
- # Vibration
- set ctfInfo(flagVibration) 1
- set ctfInfo(BofVibration) 4.0
- set ctfInfo(VibrationMode) 0
- # Aliasing
- set ctfInfo(flagAliasing) 1
- set ctfInfo(flagSampling) 0
- set ctfInfo(NyquistFrequency) 1
-
- ## Evaluation of ctfInfo
- set ctfInfo(flagEvaluation) 0
- set ctfInfo(EvalMinMaxMethod) NULL
- # Canvas
- set ctfInfo(flagThonRingOnCanvas) 0
-
- ### Input Graph Data
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- if [ info exists mrcImage(filename) ] {
- set ctfInfo(filename) $mrcImage(filename)
- }
- }
- if [ info exists ctfInfo(filename) ] {
- puts "ANYWAY, move but strange"
- } else {
- puts "No CTFInfo File"
- flush stdout
- return
- }
- } else {
- set ctfInfo(filename) $filename
- }
- if [ file exists $ctfInfo(filename) ] {
-
- } else {
- puts "mrc file not found: Please check"
- }
-
- ### Input Default Data
- if [ string match ".fft" [ file extension $ctfInfo(filename) ] ] {
- set ctfInfo(.ctfps) [ file rootname $ctfInfo(filename) ].ctfps
- set ctfInfo(.ctfinfo) [ file rootname $ctfInfo(filename) ].ctfinfo
- } else {
- set ctfInfo(.ctfps) $ctfInfo(filename).ctfps
- set ctfInfo(.ctfinfo) $ctfInfo(filename).ctfinfo
- }
- set ctfInfo(.ctfinfoMode) "Every"
- if [ file exists $ctfInfo(.ctfinfo) ] {
- ctfInfoLoad
- } elseif [ file exists $ctfInfo(.defctfinfo) ] {
- ctfInfoLoad $ctfInfo(.defctfinfo)
- }
-
- #
- # Data Taking (Scattering)
- #
- ctfInfoScatteringCalc
-}
-
-#
-# CTF Program
-#
-proc Win { { win .ctfInfo } { filename __null__ } { extension 2 } } {
- variable ctfInfo
-
- ### Initialization
- Init
-
- if [ catch { toplevel $win -bd 4 -class CTFInfo } ] {
- raise $win
- } else {
- ### Create New Window
- set w $win
- #
- # Graph Frame
- #
- set f [ frame $w.graph ]
- # Frame for Graph
- set ctfInfo(graph) [ graph $f.graph ]
- ctfInfoGraphInfoFrameCreate $f.info top
- pack $f.graph $f.info -side left -expand true -fill both
-
- # Graph Update
- ctfInfoGraphUpdate
-
- pack $w.graph -side left -expand true -fill both
-
- }
-
- if [ catch { toplevel $win$extension -bd 4 -class CTFInfo } ] { # Window Create
- raise $win$extension
- } else {
- ### Create New Window
- set w $win$extension
-
- # ctfInfo Frame
- ctfInfoCTFInfoFrameCreate $w.ctf left
- #
- # Packing
- #
- pack $w.ctf -side left -expand true -fill both
-
- }
-
- # Marker : Thon Ring
- ctfInfoPredictedMarkerSet
- ctfInfoMarkerReset
-}
-
-#
-# GraphInfo Frame
-#
-proc ctfInfoGraphInfoFrameCreate { f side } {
- frame $f
-
- ctfInfoGraphInfoFrameCreate1 $f.f1
- ctfInfoGraphInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side -expand true -fill both
- return $f
-}
-
-#
-# Related to scattering frame
-#
-proc ctfInfoGraphInfoFrameCreate1 { f } {
- variable ctfInfo
-
- frame $f
- # Scattering Information: Scattering/SubtractScattering
- set cmd "[ namespace code {ctfInfoGraphUpdate} ]"
- set name [ namespace current ]::
-
- #
- set ff [ frame $f.graph ]
- checkbutton $ff.graph -text "Scattering" -variable [subst $name]ctfInfo(flagScatGraph) -command $cmd
- checkbutton $ff.graphsub -text "Subtract" -variable [subst $name]ctfInfo(flagScatGraphSubtraction) -command $cmd
- checkbutton $ff.log -text "Log" -variable [subst $name]ctfInfo(flagLogScale) -command $cmd
- pack $ff.graph $ff.graphsub $ff.log -side left
-
- # Scattering Graph Configure
- set ff [ frame $f.graphConfig ]
- CommandEntryWithUpDown $ff.intensity Imax 4 $cmd [subst $name]ctfInfo(Imax) [subst $name]ctfInfo(dImax) -width 10
- CommandEntryWithUpDown $ff.imin Imin 4 $cmd [subst $name]ctfInfo(Imin) [subst $name]ctfInfo(dImin) -width 10
- CommandEntryWithUpDown $ff.brmax Rmax 4 $cmd [subst $name]ctfInfo(Rmax) [subst $name]ctfInfo(dRmax) -width 10
- CommandEntryWithUpDown $ff.brmin Rmin 4 $cmd [subst $name]ctfInfo(Rmin) [subst $name]ctfInfo(dRmin) -width 10
- pack $ff.intensity $ff.imin $ff.brmax $ff.brmin -side top
-
- #
- # File Frame
- #
- set ff [ frame $f.file ]
-
- #PS
- set fff [ frame $ff.printPS ]
- button $fff.printPS -text "Save" -command "[subst $name]ctfInfoSaveAsPS"
- CommandEntry $fff.printPSEntry Graph 5 "[subst $name]ctfInfoSaveAsPS" -textvar [subst $name]ctfInfo(.ctfps)
- pack $fff.printPS $fff.printPSEntry -side left
-
- # Info
- set fff [ frame $ff.printInfo ]
- button $fff.printInfo -text "Save" -command "[subst $name]ctfInfoSave"
- CommandEntry $fff.printInfoEntry Info 5 "[subst $name]ctfInfoSave" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.printInfo $fff.printInfoEntry -side left
-
- # InfoLoad
- set fff [ frame $ff.loadInfo ]
- button $fff.loadInfo -text "Load" -command "[subst $name]ctfInfoLoad"
- CommandEntry $fff.loadInfoEntry Info 5 "[subst $name]ctfInfoLoad" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.loadInfo $fff.loadInfoEntry -side left
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- # Packing
- pack \
- $f.graph \
- $f.graphConfig \
- $f.file \
- -side top -expand true
- return $f
-}
-
-#
-# Thon Ring on canvas
-# Incomplete procedure
-#
-proc ctfInfoGraphInfoFrameCreate2 { f } {
- variable ctfInfo
-
- frame $f
-
- # Thon Ring
- set cmd ctfInfoMarkerSet
- checkbutton $f.zero -text "Thon Ring (zero)" -variable ctfInfo(flagZero) -command $cmd
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- CommandEntryWithUpDown $f.zero$i $i 4 $cmd ctfInfo(zero$i) ctfInfo(dzero$i) -width 6
- }
- button $f.zeroReset -text Reset -command ctfInfoMarkerReset
-
- pack $f.zero -side top -expand true
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- pack $f.zero$i -side top -expand true
- }
- pack $f.zeroReset -side top -expand true
-
- return $f
-}
-
-#
-# Graph Save as a PS file
-#
-proc ctfInfoSaveAsPS { } {
- variable ctfInfo
-
- puts $ctfInfo(.ctfps)
- $ctfInfo(graph) postscript output $ctfInfo(.ctfps) -center false
-}
-
-#
-# ctfInfoFile
-#
-# Save
-#
-proc ctfInfoSave { } {
- variable ctfInfo
-
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) a 0600 ]
-
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- foreach { name value } [ array get ctfInfo ] {
- if { $name == "filename" || $name=="mrc"} {
-
- } else {
- puts $fpt "$name: $value"
- }
- }
- }
- Main {
- puts $fpt "defocus: $ctfInfo(defocus)"
- puts $fpt "AoverP: $ctfInfo(AoverP)"
- puts $fpt "kV: $ctfInfo(kV)"
- puts $fpt "Cs: $ctfInfo(Cs)"
- puts $fpt "Cc: $ctfInfo(Cc)"
- puts $fpt "Ai: $ctfInfo(Ai)"
- puts $fpt "I: $ctfInfo(I)"
- puts $fpt "SN: $ctfInfo(SN)"
- puts $fpt "SN2: $ctfInfo(SN2)"
- puts $fpt "Isignal: $ctfInfo(Isignal)"
- puts $fpt "Inoise: $ctfInfo(Inoise)"
- puts $fpt "Inoise2: $ctfInfo(Inoise2)"
- puts $fpt "whichMTF: $ctfInfo(whichMTF)"
- puts $fpt "MTF: $ctfInfo(MTF)"
- puts $fpt "MTF2: $ctfInfo(MTF2)"
- puts $fpt "MTF2Weight: $ctfInfo(MTF2Weight)"
- puts $fpt "MolcEnv: $ctfInfo(MolcEnv)"
- puts $fpt "Magnification: $ctfInfo(Magnification)"
- puts $fpt "flagCTFPower: $ctfInfo(flagCTFPower)"
- puts $fpt "BofVibration: $ctfInfo(BofVibration)"
- puts $fpt "flagVibration: $ctfInfo(flagVibration)"
- puts $fpt "VibrationMode: $ctfInfo(VibrationMode)"
- puts $fpt "Imax: $ctfInfo(Imax)"
- puts $fpt "Imin: $ctfInfo(Imin)"
- puts $fpt "Rmax: $ctfInfo(Rmax)"
- puts $fpt "Rmin: $ctfInfo(Rmin)"
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
-}
-
-#
-# ctfInfoFile
-#
-# Load
-#
-proc ctfInfoLoad { { filename __null__ } } {
- variable ctfInfo
-
- if { $filename != "__null__" } {
- if [ file exists $filename ] {
- set fpt [ open $filename r ]
- }
- } else {
- if [ info exists ctfInfo ] {
- puts "ctfInfo exists"
- puts $ctfInfo(DEBUGCOMMENT)
- } else {
- puts "ctfInfo does not exist"
- return
- }
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) r ]
- }
-
- while { ! [ eof $fpt ] } {
- gets $fpt s
- set slist [ split $s ":" ]
- set name [ string trim [ lindex $slist 0 ] ]
- set value [ string trim [ lindex $slist 1 ] ]
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- if { $name == "filename" || $name=="mrc"} {
- #
- } else {
- set ctfInfo($name) $value
- }
- }
- Main {
- if {
- $name == "defocus"
- || $name == "AoverP"
- || $name == "kV"
- || $name == "Cs"
- || $name == "Cc"
- || $name == "Ai"
- || $name == "I"
- || $name == "SN"
- || $name == "SN2"
- || $name == "Isignal"
- || $name == "Inoise"
- || $name == "Inoise2"
- || $name == "whichMTF"
- || $name == "MTF"
- || $name == "MTF2"
- || $name == "MTF2Weight"
- || $name == "MolcEnv"
- || $name == "Magnification"
- || $name == "flagCTFPower"
- || $name == "BofVibration"
- || $name == "Vibration"
- || $name == "VibrationMode"
- || $name == "Imax"
- || $name == "Imin"
- || $name == "Imax"
- || $name == "Rmin" } {
- set ctfInfo($name) $value
- }
- }
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
- if [ info exists ctfInfo(graph) ] {
- if [ info exists $ctfInfo(graph) ] {
- ctfInfoGraphUpdate
- }
- }
-}
-#
-#
-#
-proc ctfInfoMolecEnvSet { } {
- variable ctfInfo
-
- # Elastic
- switch $ctfInfo(whichMolec) {
- Gauss {
- ctfInfoSet MolecEnv $ctfInfo(MolcEnv)
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet Elastic 1 $ctfInfo(Elastic) $ctfInfo(ElaShift) $ctfInfo(ElaWidth) \
- $ctfInfo(ElaRing) $ctfInfo(ElaRShift) $ctfInfo(ElaRWidth)
- ctfInfoSet MolecEnvMode 0
- }
- Table {
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvTable $ctfInfo(.molcEnvTable)
- ctfInfoSet MolecEnvMode 1
- }
- }
-
- # Inelastic
- switch $ctfInfo(whichInElaMolec) {
- No {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Gauss {
- ctfInfoSet InElasticMode 1
- ctfInfoSet InElaMolecEnv $ctfInfo(InElaMolcEnv)
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1 $ctfInfo(InElastic) $ctfInfo(InElaShift) $ctfInfo(InElaWidth) \
- $ctfInfo(InElaRing) $ctfInfo(InElaRShift) $ctfInfo(InElaRWidth)
- ctfInfoSet InElaMolecEnvMode 0
- }
- Table {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1
- ctfInfoSet InElaMolecEnvTable $ctfInfo(.inElaMolcEnvTable)
- ctfInfoSet InElaMolecEnvMode 1
- }
- }
-}
-
-#
-#
-#
-proc ctfInfoCTFInfoFrameCreate { f side } {
- # Frame for ctfInfo
- frame $f
-
- ctfInfoCTFInfoFrameCreate1 $f.f1
- ctfInfoCTFInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side
- return $f
-}
-
-proc ctfInfoCTFInfoFrameCreate1 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- frame $f
-
- # Which CTF Plot
- set ff [ frame $f.title ]
- checkbutton $ff.main -text "CTF Params" -variable [subst $name]ctfInfo(flagCTFGraph) -command $cmd
- checkbutton $ff.sub -text "Core" -variable [subst $name]ctfInfo(flagCTFcoreGraph) -command $cmd
- checkbutton $ff.power -text "Power" -variable [subst $name]ctfInfo(flagCTFPower) -command $cmd
- pack $ff.main $ff.sub $ff.power -side left -expand true
-
- # Main Parameters
- set ff [ frame $f.main ]
- CommandEntryWithUpDown $ff.defocus "defocus A " 10 $cmd [subst $name]ctfInfo(defocus) [subst $name]ctfInfo(ddefocus) -width 6
- CommandEntryWithUpDown $ff.aoverP "AoverP " 10 $cmd [subst $name]ctfInfo(AoverP) [subst $name]ctfInfo(dAoverP) -width 6
- CommandEntryWithUpDown $ff.is "Isingal " 10 $cmd [subst $name]ctfInfo(Isignal) [subst $name]ctfInfo(dIsignal) -width 6
- CommandEntryWithUpDown $ff.in "Inoise " 10 $cmd [subst $name]ctfInfo(Inoise) [subst $name]ctfInfo(dInoise) -width 6
- CommandEntryWithUpDown $ff.in2 "Inoise2 " 10 $cmd [subst $name]ctfInfo(Inoise2) [subst $name]ctfInfo(dInoise2) -width 6
- CommandEntryWithUpDown $ff.mag "Mag " 10 $cmd [subst $name]ctfInfo(Magnification) [subst $name]ctfInfo(dMagnification) -width 6
- pack $ff.defocus $ff.aoverP $ff.is $ff.in $ff.in2 $ff.mag -side top -expand true
-
- # MTF
- set ff [ frame $f.mtf ]
- RadioButtonsCreateWithPackWithCommand $ff.which MTF $cmd left [subst $name]ctfInfo(whichMTF) singleExp Lorentz BothMul BothSum Linear Polynomial
- CommandEntryWithUpDown $ff.mtf "MTF A " 10 $cmd [subst $name]ctfInfo(MTF) [subst $name]ctfInfo(dMTF) -width 6
- CommandEntryWithUpDown $ff.mtf2 "MTF2 A " 10 $cmd [subst $name]ctfInfo(MTF2) [subst $name]ctfInfo(dMTF2) -width 6
- CommandEntryWithUpDown $ff.mtfw "MTF2Weight" 10 $cmd [subst $name]ctfInfo(MTF2Weight) [subst $name]ctfInfo(dMTF2Weight) -width 6
- pack $ff.which $ff.mtf $ff.mtf2 $ff.mtfw -side top
-
- # Elastic Scattering
- set ff [ frame $f.molec ]
- RadioButtonsCreateWithPackWithCommand $ff.which Elastic $cmd left [subst $name]ctfInfo(whichMolec) Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "GaussB A" 10 $cmd [subst $name]ctfInfo(MolcEnv) [subst $name]ctfInfo(dMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "E " 10 $cmd [subst $name]ctfInfo(Elastic) [subst $name]ctfInfo(dElastic) -width 6
- CommandEntryWithUpDown $ff.shift "E Shift" 10 $cmd [subst $name]ctfInfo(ElaShift) [subst $name]ctfInfo(dElaShift) -width 6
- CommandEntryWithUpDown $ff.width "E Width" 10 $cmd [subst $name]ctfInfo(ElaWidth) [subst $name]ctfInfo(dElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "E Ring " 10 $cmd [subst $name]ctfInfo(ElaRing) [subst $name]ctfInfo(dElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "E RShift" 10 $cmd [subst $name]ctfInfo(ElaRShift) [subst $name]ctfInfo(dElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "E RWidth" 10 $cmd [subst $name]ctfInfo(ElaRWidth) [subst $name]ctfInfo(dElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.molcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- # Inelastic
- set ff [ frame $f.inelamolec ]
- checkbutton $ff.use -text "With Inelastic" -variable [subst $name]ctfInfo(flagInElastic) -command $cmd
- RadioButtonsCreateWithPackWithCommand $ff.which Inelastic $cmd left [subst $name]ctfInfo(whichInElaMolec) No Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "IE Gauss B" 10 $cmd [subst $name]ctfInfo(InElaMolcEnv) [subst $name]ctfInfo(dInElaMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "IE " 10 $cmd [subst $name]ctfInfo(InElastic) [subst $name]ctfInfo(dInElastic) -width 6
- CommandEntryWithUpDown $ff.shift "IE Shift" 10 $cmd [subst $name]ctfInfo(InElaShift) [subst $name]ctfInfo(dInElaShift) -width 6
- CommandEntryWithUpDown $ff.width "IE Width" 10 $cmd [subst $name]ctfInfo(InElaWidth) [subst $name]ctfInfo(dInElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "IE Ring " 10 $cmd [subst $name]ctfInfo(InElaRing) [subst $name]ctfInfo(dInElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "IE RShift" 10 $cmd [subst $name]ctfInfo(InElaRShift) [subst $name]ctfInfo(dInElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "IE RWidth" 10 $cmd [subst $name]ctfInfo(InElaRWidth) [subst $name]ctfInfo(dInElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.inElaMolcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- set ff [ frame $f.calc ]
- button $ff.draw -text Draw -command $cmd
- button $ff.initS -text InitSearch -command [subst $name]ctfInitSearch
- button $ff.fineT -text FineTune -command [subst $name]ctfFineTuning
- pack $ff.draw $ff.initS $ff.fineT -side left -expand true
-
- pack \
- $f.title \
- $f.main \
- $f.mtf \
- $f.molec \
- $f.inelamolec \
- $f.calc \
- -side top -expand true
-
- return $f
-}
-
-proc ctfInitSearch { } {
- variable ctfInfo
-
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 1"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 0
- ctfInfoLoad
-}
-
-proc ctfFineTuning { } {
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16
- ctfInfoLoad
-}
-
-#
-# CTF Information
-#
-proc ctfInfoCTFInfoFrameCreate2 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- frame $f
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- CommandEntry $f.i "I(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(I)" -width 6
- CommandEntry $f.sN "SN(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN)" -width 6
- CommandEntry $f.sN2 "SN2(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN2)" -width 6
- CommandEntry $f.cs "Cs mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cs)" -width 6
- CommandEntry $f.kV "kV kV " 10 $cmd -textvar "[subst $name]ctfInfo(kV)" -width 6
- CommandEntry $f.ai "Ai mrad " 10 $cmd -textvar "[subst $name]ctfInfo(Ai)" -width 6
- CommandEntry $f.cc "Cc mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cc)" -width 6
- CommandEntry $f.dkV "dV eV " 10 $cmd -textvar "[subst $name]ctfInfo(dV)" -width 6
- CommandEntry $f.vib "Vibration " 10 $cmd -textvar "[subst $name]ctfInfo(BofVibration)" -width 6
- CommandEntry $f.vibMode "Vib-mode " 10 $cmd -textvar "[subst $name]ctfInfo(VibrationMode)" -width 6
- checkbutton $f.aliasing -text "Aliasing" -variable [subst $name]ctfInfo(flagAliasing) -command $cmd
- checkbutton $f.sampling -text "Sampling" -variable [subst $name]ctfInfo(flagSampling) -command $cmd
- CommandEntry $f.nyquist "Nyquist " 10 $cmd -textvar "[subst $name]ctfInfo(NyquistFrequency)" -width 6
-
- pack \
- $f.i \
- $f.sN \
- $f.sN2 \
- $f.cs \
- $f.kV \
- $f.ai \
- $f.cc \
- $f.dkV \
- $f.vib \
- $f.vibMode \
- $f.aliasing \
- $f.sampling \
- $f.nyquist \
- -side top -expand true
- return $f
-}
-
-#
-# ctfInfoMarker: Thon Ring Line
-# Movable marker for thonRingDetermine
-#
-
-# Marker Set
-proc ctfInfoMarkerSet { } {
- variable ctfInfo
-
- ctfInfoMarkerUnset
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- $ctfInfo(graph) marker create line -name zero$i \
- -coords { $ctfInfo(zero$i) 0 \
- $ctfInfo(zero$i) 1 }
- $ctfInfo(graph) marker configure zero$i -dashes { 2 2 }
- }
-}
-
-# Marker Unset
-proc ctfInfoMarkerUnset { } {
- variable ctfInfo
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete zero$i }
- }
-}
-
-#
-# Thon Ring Information
-# Predicted Marker Set for Graph
-#
-proc ctfInfoPredictedThonRing { } {
- variable ctfInfo
-
- set size [ llength $ctfInfo(R) ]
- set dR [ expr [lindex $ctfInfo(R) 1]-[lindex $ctfInfo(R) 0]]
- set RMax [ lindex $ctfInfo(R) [expr $size-1] ]
- set Zero [ ctfInfoGet Zero $RMax $ctfInfo(predictZeroMaxMax) $dR ]
- set ctfInfo(predictZeroMax) [ expr [ llength $Zero ] / 3 ]
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ctfInfo(predictZero$i) [ lindex $Zero [ expr 3*$i ] ]
- set ctfInfo(predictZeroCTF$i) [ expr 0.8*$ctfInfo(Imax) ]
- set data [ lindex $Zero [ expr 3*$i + 1 ] ]
- set data1 [ lindex $Zero [ expr 3*$i + 2 ] ]
- if { $ctfInfo(flagCTFPower) == 1 } {
- set ctfInfo(predictZeroCTF$i) [ expr $data*$data + $data1*$data1 ]
- } else {
- set ctfInfo(predictZeroCTF$i) [ expr $data + $data1 ]
- }
- }
- set ctfInfo(flagpredictThonRing) 1
-}
-
-#
-# PredictedMarker of ThonRing on canvas
-#
-proc ctfInfoPredictedMarkerOnCanvas { } {
- variable ctfInfo
-
- if [ info exists ctfInfo(mrc) ] {
- array set mainImage $ctfInfo(mrc)
- if [ info exists mainImage(mainCanvas) ] {
- puts $mainImage(mainCanvas)
- #$mainImage(mainCanvas) create oval 0 0 10 10
- .main_canvas create oval 0 0 10 10
- } else {
- puts "No canvas to draw Thon rings: in ctfInfoCTFLineCreate"
- }
- } else {
- puts "No mrc Setting"
- }
-}
-
-#
-# PredictedMarker of ThonRing on graph
-#
-proc ctfInfoPredictedMarkerSet { } {
- variable ctfInfo
-
- # Zero Point
- ctfInfoPredictedThonRing
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ymax [ expr 1.2*$ctfInfo(predictZeroCTF$i) ]
- $ctfInfo(graph) marker create line -name predictZero$i -coords {
- $ctfInfo(predictZero$i) 0 \
- $ctfInfo(predictZero$i) $ymax }
- #$ctfInfo(graph) marker configure predictZero$i -foreground black
- }
- set ctfInfo(flagpredictZero) 1
-}
-
-#
-proc ctfInfoPredictedMarkerUnset { } {
- variable ctfInfo
- if { $ctfInfo(flagpredictZero) == 1 } {
- for { set i 1 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete predictZero$i }
- }
- }
- set ctfInfo(flagpredictZero) 0
-}
-#
-proc ctfInfoMarkerReset { } {
- variable ctfInfo
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- if [ info exists ctfInfo(predictZero$i) ] {
- set ctfInfo(zero$i) $ctfInfo(predictZero$i)
- } else {
- puts "ctfInfo(zeroMax) is wrong at $i: $ctfInfo(zeroMax)"
- break
- }
- }
- ctfInfoMarkerSet
-}
-
-
-#
-# Graph Update
-#
-
-proc ctfInfoGraphUpdate { } {
- variable ctfInfo
-
- ctfInfoGraphConfiguration
- if { $ctfInfo(flagScatGraph) == 1 } {
- ctfInfoScatteringLineCreate Scattering $ctfInfo(graph) ctfInfo(R) ctfInfo(Scattering)
- } else {
- catch { $ctfInfo(graph) element delete Scattering }
- }
- if { $ctfInfo(flagScatGraphSubtraction) == 1 } {
- catch { ctfInfoScatteringLineCreate ScatteringSubtraction $ctfInfo(graph) ctfInfo(R) ctfInfo(ScatteringSubtraction) }
- } else {
- catch { $ctfInfo(graph) element delete ScatteringSubtraction }
- }
- ctfInfoCTFLineCreate $ctfInfo(graph)
-}
-
-#
-# ctfInfoScatteringLineCreate
-# Scattering Data Plotting
-#
-proc ctfInfoScatteringLineCreate { name g x y } {
- upvar $x xx
- upvar $y yy
- # Drawing Graph (Scattering)
- catch { $g element delete $name }
- $g element create $name -xdata $xx -ydata $yy
- $g element configure $name -pen scatPen
-}
-
-#
-# ctfInfoCTFLineCreate
-# CTF Graph Create
-# Elements:
-# CTF
-# CTFcore
-# Noise
-#
-proc ctfInfoCTFLineCreate { g } {
- variable ctfInfo
-
- # CTF Calc
- ctfInfoCTFCalculation
-
- # Graph Delete
- catch { $g element delete CTF }
- catch { $g element delete CTFcore }
- catch { $g element delete Noise }
-
- # Markder Unset
- ctfInfoPredictedMarkerUnset
-
- # Signal + Noise
- if { $ctfInfo(flagCTFGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) == 1 } {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTFPower)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoisePower)
- } else {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTF)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoise)
- }
- $g element configure CTF -pen ctfPen
- $g element configure Noise -pen ctfPen
-
- ctfInfoPredictedMarkerSet
- }
-
- # Signal Only
- if { $ctfInfo(flagCTFcoreGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) } {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignalPower)
- } else {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignal)
- }
- $g element configure CTFcore -pen ctfPen
- }
- if { $ctfInfo(flagThonRingOnCanvas) == 1 } {
- ctfInfoPredictedMarkerOnCanvas
- }
-
- # Configuration
- ctfInfoGraphConfiguration
-}
-
-#
-# ctfInfoGraphConfiguration
-# Axis, Title, Logscale etc.
-#
-proc ctfInfoGraphConfiguration { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
-
- $g configure -title "CTF($ctfInfo(filename))"
- $g axis configure x -title "R" -loose yes -max $ctfInfo(Rmax) -hide no
- $g axis configure y -title "Intensity" -loose yes -max $ctfInfo(Imax) -hide no
- $g legend configure -position top -hide no
- $g axis configure x -max $ctfInfo(Rmax)
- $g axis configure x -min $ctfInfo(Rmin)
- $g axis configure y -max $ctfInfo(Imax)
- $g axis configure y -min $ctfInfo(Imin)
- if { $ctfInfo(flagLogScale) == 1 } {
- if { $ctfInfo(Imin) <= 0 } {
- set ctfInfo(Imin) [ expr $ctfInfo(Imax)*1e-6 ]
- }
- $g axis configure y -logscale yes
- } else {
- $g axis configure y -logscale no
- }
- ctfInfoGraphPenCreate
-
- Blt_ZoomStack $g
- Blt_Crosshairs $g
- Blt_ActiveLegend $g
- Blt_ClosestPoint $g
-}
-
-# Pen Information
-#
-proc ctfInfoGraphPenCreate { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
- catch { $g pen create scatPen }
- $g pen configure scatPen -pixels 0 -color blue
- catch { $g pen create ctfPen }
- $g pen configure ctfPen -pixels 0 -color red
-}
-
-#
-# ctfInfoCTFInfomationSet
-#
-proc ctfInfoCTFInfomationSet { } {
- variable ctfInfo
-
- # set
- set ctfInfo(I) $ctfInfo(Isignal)
- set ctfInfo(SN) [ expr double($ctfInfo(Inoise))/double($ctfInfo(Isignal))]
- set ctfInfo(SN2) [ expr double($ctfInfo(Inoise2))/double($ctfInfo(Isignal))]
-
- #
- set size [ llength $ctfInfo(R) ]
- ctfInfoSet kV $ctfInfo(kV)
- ctfInfoSet defocus $ctfInfo(defocus)
- ctfInfoSet Cc $ctfInfo(Cc)
- ctfInfoSet dE $ctfInfo(dV)
- ctfInfoSet Cs $ctfInfo(Cs)
- ctfInfoSet Ai $ctfInfo(Ai)
- ctfInfoSet I $ctfInfo(I)
- ctfInfoSet Mag $ctfInfo(Magnification)
- ctfInfoSet AoverP $ctfInfo(AoverP)
- ctfInfoSet Mode [ expr 1 + 32 + 64 ]
- switch -exact -- $ctfInfo(whichMTF) {
- singleExp {
- ctfInfoSet MTFMode 0
- }
- Lorentz {
- ctfInfoSet MTFMode 1
- }
- BothMul {
- ctfInfoSet MTFMode 2
- }
- Linear {
- ctfInfoSet MTFMode 3
- }
- BothSum {
- ctfInfoSet MTFMode 4
- }
- Polynomial {
- ctfInfoSet MTFMode 5
- }
- default {
- puts "Not supported MTF mode: $ctfInfo(whichMTF)"
- }
- }
- ctfInfoSet MTF $ctfInfo(MTF)
- ctfInfoSet MTF2 $ctfInfo(MTF2)
- ctfInfoSet MTF2Weight $ctfInfo(MTF2Weight)
- ctfInfoSet Noise $ctfInfo(SN)
- ctfInfoSet Noise2 $ctfInfo(SN2)
- ctfInfoSet R $size $ctfInfo(R)
- ctfInfoSet VibrationMode $ctfInfo(VibrationMode)
- ctfInfoSet BofVibration $ctfInfo(BofVibration)
- ctfInfoSet flagVibration $ctfInfo(flagVibration)
- ctfInfoSet Aliasing $ctfInfo(flagAliasing) $ctfInfo(NyquistFrequency)
- ctfInfoSet Sampling $ctfInfo(flagSampling) $ctfInfo(NyquistFrequency)
-
- #
- ctfInfoMolecEnvSet
-}
-
-#
-# ctfInfoCTFCalculation
-#
-proc ctfInfoCTFCalculation { } {
- variable ctfInfo
-
- #
- #puts "ctfInfoCTFCalculation: Power: $ctfInfo(flagCTFPower)"
-
- # Information Set
- ctfInfoCTFInfomationSet
-
- # Data Unset
- catch { unset ctfInfo(CTF) }
- catch { unset ctfInfo(CTFPower) }
- catch { unset ctfInfo(CTFcore) }
- catch { unset ctfInfo(CTFcorePower) }
- catch { unset ctfInfo(CTFNoise) }
- catch { unset ctfInfo(CTFNoisePower) }
- catch { unset ctfInfo(CTFSignal) }
- catch { unset ctfInfo(CTFSignalPower) }
- catch { unset ctfInfo(ScatteringSubtraction) }
-
- # Data Set
- set size [ llength $ctfInfo(R) ]
- if { $ctfInfo(flagCTFPower) } {
- set ctfInfo(CTFPower) [ ctfInfoCalc CTFPower ]
- set ctfInfo(CTFcorePower) [ ctfInfoCalc CTFcorePower ]
- set ctfInfo(CTFNoisePower) [ ctfInfoCalc CTFNoisePower ]
- set ctfInfo(CTFSignalPower) [ ctfInfoCalc CTFSignalPower ]
- } else {
- set ctfInfo(CTF) [ ctfInfoCalc CTF ]
- set ctfInfo(CTFcore) [ ctfInfoCalc CTFcore ]
- set ctfInfo(CTFNoise) [ ctfInfoCalc CTFNoise ]
- set ctfInfo(CTFSignal) [ ctfInfoCalc CTFSignal ]
- }
- for { set i 0 } { $i < $size } { incr i } {
- set data [ lindex $ctfInfo(Scattering) $i ]
- if { $ctfInfo(flagCTFPower) } {
- set noise [ lindex $ctfInfo(CTFNoisePower) $i ]
- } else {
- set noise [ lindex $ctfInfo(CTFNoise) $i ]
- }
- lappend ctfInfo(ScatteringSubtraction) [ expr $data - $noise ]
- }
-}
-
-#
-# Scattering Data
-#
-proc ctfInfoScatteringCalc { { filename __null__ } } {
- variable ctfInfo
-
- #puts "ctfInfoScatteringCalc"
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- } else {
- puts "no file for Scattring calc."
- return
- }
- }
- set xy [ mrcInfoGet $filename Spectrum2 ]
-
- catch { unset ctfInfo(R) }
- catch { unset ctfInfo(Scattering) }
- catch { unset ctfInfo(ScatteringRoot) }
-
- foreach { x y } $xy {
- lappend ctfInfo(R) $x
- lappend ctfInfo(Scattering) $y
- lappend ctfInfo(ScatteringRoot) [ expr sqrt($y)]
- }
- set ctfInfo(NyquistFrequency) [ lindex $ctfInfo(R) end ]
-}
-
-#end of CTF namespace
-}
-
+++ /dev/null
-#
-#
-# ctfInfo
-# namespace eval CTF
-#
-namespace eval CTF {
- variable ctfInfo
- namespace export ctfInfoLoad ctfInfoSave ctfInfoGraphUpdate
-
-proc Init { { mrc __null__ } } {
- variable ctfInfo
-
- # mrcImage Information Check: set ctfInfo(mrc) $mrc
- set ctfInfo(DEBUGCOMMENT) "DEBUG"
- if { $mrc != "__null__" } {
- # New Object
- array set mrcImage $mrc
- if [ info exists mrcImage(filename) ] {
- # Set New mrcImage
- set filename $mrcImage(filename)
- set ctfInfo(mrc) $mrc
- } else { # mrc is a new filename
- # Set New file
- set filename $mrc
- catch { unset ctfInfo(mrc) }
- }
- } else {
- # No setting
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- # puts "Already FileName"
- } elseif [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- set filename $mrcImage(filename)
- } else { # mrc is filename
- set filename $mrc
- }
- }
- if [ info exists ctfInfo(filename) ] {
- if { $ctfInfo(filename) != $filename } {
- set ctfInfo(flagInit) 0
- } else {
- set ctfInfo(flagInit) 1
- }
- } else {
- set ctfInfo(flagInit) 0
- }
-
- if { $ctfInfo(flagInit) == 1 } {
- return
- } else {
- set ctfInfo(filename) $filename
- }
-
- # Start Initialization
- set ctfInfo(flagInit) 1
-
- # Molecular Envelope for signal
- #Elastic
- set ctfInfo(.defctfinfo) "./.DefCTFInfo"
- set ctfInfo(whichMolec) Gauss
- set ctfInfo(.molcEnvTable) "./carbon.table"
- set ctfInfo(MolcEnv) 8.0
- set ctfInfo(dMolcEnv) 1.0
- set ctfInfo(Elastic) 2.4912
- set ctfInfo(dElastic) 0.0000
- set ctfInfo(ElaShift) 0.0108
- set ctfInfo(dElaShift) 0.0000
- set ctfInfo(ElaWidth) 0.2226
- set ctfInfo(dElaWidth) 0.0100
- set ctfInfo(ElaRing) 1.0000
- set ctfInfo(dElaRing) 0.1000
- set ctfInfo(ElaRShift) 0.2500
- set ctfInfo(dElaRShift) 0.0100
- set ctfInfo(ElaRWidth) 0.1000
- set ctfInfo(dElaRWidth) 0.0100
- #Inelastic
- set ctfInfo(whichInElaMolec) No
- set ctfInfo(.inElaMolcEnvTable) "./carbon.table"
- set ctfInfo(InElaMolcEnv) 8.0
- set ctfInfo(dInElaMolcEnv) 1.0
- set ctfInfo(InElastic) 2.4912
- set ctfInfo(dInElastic) 0.0000
- set ctfInfo(InElaShift) 0.0108
- set ctfInfo(dInElaShift) 0.0000
- set ctfInfo(InElaWidth) 0.2226
- set ctfInfo(dInElaWidth) 0.0100
- set ctfInfo(InElaRing) 1.0000
- set ctfInfo(dInElaRing) 0.1000
- set ctfInfo(InElaRShift) 0.2500
- set ctfInfo(dInElaRShift) 0.0100
- set ctfInfo(InElaRWidth) 0.1000
- set ctfInfo(dInElaRWidth) 0.0100
- #
- #
- #
- set ctfInfo(flagScatGraph) 1
- set ctfInfo(flagScatGraphSubtraction) 0
- set ctfInfo(Imax) 0.001
- set ctfInfo(dImax) 0.0001
- set ctfInfo(Rmax) 0.10
- set ctfInfo(dRmax) 0.01
- set ctfInfo(Imin) 0.00
- set ctfInfo(dImin) 0.0001
- set ctfInfo(Rmin) 0.00
- set ctfInfo(dRmin) 0.01
- #
- #
- #
- set ctfInfo(flagZero) 1
- set ctfInfo(zeroMax) 6
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- set ctfInfo(zero$i) [ expr 0.01*$i ]
- set ctfInfo(dzero$i) 0.01
- }
- set ctfInfo(ThonRingCanvas) 0
-
- set ctfInfo(flagCTFGraph) 1
- set ctfInfo(flagCTFcoreGraph) 0
- set ctfInfo(flagCTFPower) 1
- set ctfInfo(flagLogScale) 0
-
- # Thon Ring Information
- set ctfInfo(flagpredictThonRing) 0
- set ctfInfo(flagpredictZero) 0
- set ctfInfo(flagpredictZeroMax) 1
- set ctfInfo(predictZeroMaxMax) 20
-
- ##
- set ctfInfo(defocus) 500
- set ctfInfo(ddefocus) -100
- set ctfInfo(Cs) 2.1
- set ctfInfo(dCs) 0.1
- set ctfInfo(kV) 200
- set ctfInfo(dkV) 5
- set ctfInfo(AoverP) 0.1
- set ctfInfo(dAoverP) -0.01
- set ctfInfo(Ai) 0.02
- set ctfInfo(dAi) 0.01
- set ctfInfo(Cc) 0.7
- set ctfInfo(dCc) 0.1
- set ctfInfo(dV) 0.7
- set ctfInfo(ddV) 0.1
- set ctfInfo(I) 0.015
- set ctfInfo(dI) 0.002
- set ctfInfo(SN) 0.1
- set ctfInfo(dSN) 0.1
- set ctfInfo(SN2) 0.1
- set ctfInfo(dSN2) 0.1
- set ctfInfo(Isignal) 0.015
- set ctfInfo(dIsignal) 0.002
- set ctfInfo(Inoise) 0.0015
- set ctfInfo(dInoise) 0.0002
- set ctfInfo(Inoise2) 0.0015
- set ctfInfo(dInoise2) 0.0002
- set ctfInfo(whichMTF) singleExp
-
- # MTF
- set ctfInfo(MTF) 38
- set ctfInfo(dMTF) 1
-
- set ctfInfo(MTFd3) 40
- set ctfInfo(dMTFd3) 1
- set ctfInfo(MTFd4) 35
- set ctfInfo(dMTFd4) 1
- set ctfInfo(MTFd5) 34
- set ctfInfo(dMTFd5) 1
- set ctfInfo(MTFd6) 10
- set ctfInfo(dMTFd6) 1
-
- set ctfInfo(MTF2) 38
- set ctfInfo(dMTF2) 1
- set ctfInfo(MTF2Weight) 0
- set ctfInfo(dMTF2Weight) 0.1
- set ctfInfo(Magnification) 1.0
- set ctfInfo(dMagnification) -0.005
- # Vibration
- set ctfInfo(flagVibration) 1
- set ctfInfo(BofVibration) 4.0
- set ctfInfo(VibrationMode) 0
- # Aliasing
- set ctfInfo(flagAliasing) 1
- set ctfInfo(flagSampling) 0
- set ctfInfo(NyquistFrequency) 1
-
- ## Evaluation of ctfInfo
- set ctfInfo(flagEvaluation) 0
- set ctfInfo(EvalMinMaxMethod) NULL
- # Canvas
- set ctfInfo(flagThonRingOnCanvas) 0
-
- ### Input Graph Data
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- if [ info exists mrcImage(filename) ] {
- set ctfInfo(filename) $mrcImage(filename)
- }
- }
- if [ info exists ctfInfo(filename) ] {
- puts "ANYWAY, move but strange"
- } else {
- puts "No CTFInfo File"
- flush stdout
- return
- }
- } else {
- set ctfInfo(filename) $filename
- }
- if [ file exists $ctfInfo(filename) ] {
-
- } else {
- puts "mrc file not found: Please check"
- }
-
- ### Input Default Data
- if [ string match ".fft" [ file extension $ctfInfo(filename) ] ] {
- set ctfInfo(.ctfps) [ file rootname $ctfInfo(filename) ].ctfps
- set ctfInfo(.ctfinfo) [ file rootname $ctfInfo(filename) ].ctfinfo
- } else {
- set ctfInfo(.ctfps) $ctfInfo(filename).ctfps
- set ctfInfo(.ctfinfo) $ctfInfo(filename).ctfinfo
- }
- set ctfInfo(.ctfinfoMode) "Every"
- if [ file exists $ctfInfo(.ctfinfo) ] {
- ctfInfoLoad
- } elseif [ file exists $ctfInfo(.defctfinfo) ] {
- ctfInfoLoad $ctfInfo(.defctfinfo)
- }
-
- #
- # Data Taking (Scattering)
- #
- ctfInfoScatteringCalc
-}
-
-#
-# CTF Program
-#
-proc Win { { win .ctfInfo } { filename __null__ } { extension 2 } } {
- variable ctfInfo
-
- ### Initialization
- Init
-
- if [ catch { toplevel $win -bd 4 -class CTFInfo } ] {
- raise $win
- } else {
- ### Create New Window
- set w $win
- #
- # Graph Frame
- #
- set f [ frame $w.graph ]
- # Frame for Graph
- set ctfInfo(graph) [ graph $f.graph ]
- ctfInfoGraphInfoFrameCreate $f.info top
- pack $f.graph $f.info -side left -expand true -fill both
-
- # Graph Update
- ctfInfoGraphUpdate
-
- pack $w.graph -side left -expand true -fill both
-
- }
-
- if [ catch { toplevel $win$extension -bd 4 -class CTFInfo } ] { # Window Create
- raise $win$extension
- } else {
- ### Create New Window
- set w $win$extension
-
- # ctfInfo Frame
- ctfInfoCTFInfoFrameCreate $w.ctf left
- #
- # Packing
- #
- pack $w.ctf -side left -expand true -fill both
-
- }
-
- # Marker : Thon Ring
- ctfInfoPredictedMarkerSet
- ctfInfoMarkerReset
-}
-
-#
-# GraphInfo Frame
-#
-proc ctfInfoGraphInfoFrameCreate { f side } {
- frame $f
-
- ctfInfoGraphInfoFrameCreate1 $f.f1
- ctfInfoGraphInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side -expand true -fill both
- return $f
-}
-
-#
-# Related to scattering frame
-#
-proc ctfInfoGraphInfoFrameCreate1 { f } {
- variable ctfInfo
-
- frame $f
- # Scattering Information: Scattering/SubtractScattering
- set cmd "[ namespace code {ctfInfoGraphUpdate} ]"
- set name [ namespace current ]::
-
- #
- set ff [ frame $f.graph ]
- checkbutton $ff.graph -text "Scattering" -variable [subst $name]ctfInfo(flagScatGraph) -command $cmd
- checkbutton $ff.graphsub -text "Subtract" -variable [subst $name]ctfInfo(flagScatGraphSubtraction) -command $cmd
- checkbutton $ff.log -text "Log" -variable [subst $name]ctfInfo(flagLogScale) -command $cmd
- pack $ff.graph $ff.graphsub $ff.log -side left
-
- # Scattering Graph Configure
- set ff [ frame $f.graphConfig ]
- CommandEntryWithUpDown $ff.intensity Imax 4 $cmd [subst $name]ctfInfo(Imax) [subst $name]ctfInfo(dImax) -width 10
- CommandEntryWithUpDown $ff.imin Imin 4 $cmd [subst $name]ctfInfo(Imin) [subst $name]ctfInfo(dImin) -width 10
- CommandEntryWithUpDown $ff.brmax Rmax 4 $cmd [subst $name]ctfInfo(Rmax) [subst $name]ctfInfo(dRmax) -width 10
- CommandEntryWithUpDown $ff.brmin Rmin 4 $cmd [subst $name]ctfInfo(Rmin) [subst $name]ctfInfo(dRmin) -width 10
- pack $ff.intensity $ff.imin $ff.brmax $ff.brmin -side top
-
- #
- # File Frame
- #
- set ff [ frame $f.file ]
-
- #PS
- set fff [ frame $ff.printPS ]
- button $fff.printPS -text "Save" -command "[subst $name]ctfInfoSaveAsPS"
- CommandEntry $fff.printPSEntry Graph 5 "[subst $name]ctfInfoSaveAsPS" -textvar [subst $name]ctfInfo(.ctfps)
- pack $fff.printPS $fff.printPSEntry -side left
-
- # Info
- set fff [ frame $ff.printInfo ]
- button $fff.printInfo -text "Save" -command "[subst $name]ctfInfoSave"
- CommandEntry $fff.printInfoEntry Info 5 "[subst $name]ctfInfoSave" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.printInfo $fff.printInfoEntry -side left
-
- # InfoLoad
- set fff [ frame $ff.loadInfo ]
- button $fff.loadInfo -text "Load" -command "[subst $name]ctfInfoLoad"
- CommandEntry $fff.loadInfoEntry Info 5 "[subst $name]ctfInfoLoad" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.loadInfo $fff.loadInfoEntry -side left
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- # Packing
- pack \
- $f.graph \
- $f.graphConfig \
- $f.file \
- -side top -expand true
- return $f
-}
-
-#
-# Thon Ring on canvas
-# Incomplete procedure
-#
-proc ctfInfoGraphInfoFrameCreate2 { f } {
- variable ctfInfo
-
- frame $f
-
- # Thon Ring
- set cmd ctfInfoMarkerSet
- checkbutton $f.zero -text "Thon Ring (zero)" -variable ctfInfo(flagZero) -command $cmd
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- CommandEntryWithUpDown $f.zero$i $i 4 $cmd ctfInfo(zero$i) ctfInfo(dzero$i) -width 6
- }
- button $f.zeroReset -text Reset -command ctfInfoMarkerReset
-
- pack $f.zero -side top -expand true
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- pack $f.zero$i -side top -expand true
- }
- pack $f.zeroReset -side top -expand true
-
- return $f
-}
-
-#
-# Graph Save as a PS file
-#
-proc ctfInfoSaveAsPS { } {
- variable ctfInfo
-
- puts $ctfInfo(.ctfps)
- $ctfInfo(graph) postscript output $ctfInfo(.ctfps) -center false
-}
-
-#
-# ctfInfoFile
-#
-# Save
-#
-proc ctfInfoSave { } {
- variable ctfInfo
-
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) a 0600 ]
-
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- foreach { name value } [ array get ctfInfo ] {
- if { $name == "filename" || $name=="mrc"} {
-
- } else {
- puts $fpt "$name: $value"
- }
- }
- }
- Main {
- puts $fpt "defocus: $ctfInfo(defocus)"
- puts $fpt "AoverP: $ctfInfo(AoverP)"
- puts $fpt "kV: $ctfInfo(kV)"
- puts $fpt "Cs: $ctfInfo(Cs)"
- puts $fpt "Cc: $ctfInfo(Cc)"
- puts $fpt "Ai: $ctfInfo(Ai)"
- puts $fpt "I: $ctfInfo(I)"
- puts $fpt "SN: $ctfInfo(SN)"
- puts $fpt "SN2: $ctfInfo(SN2)"
- puts $fpt "Isignal: $ctfInfo(Isignal)"
- puts $fpt "Inoise: $ctfInfo(Inoise)"
- puts $fpt "Inoise2: $ctfInfo(Inoise2)"
- puts $fpt "whichMTF: $ctfInfo(whichMTF)"
- puts $fpt "MTF: $ctfInfo(MTF)"
- puts $fpt "MTF2: $ctfInfo(MTF2)"
- puts $fpt "MTF2Weight: $ctfInfo(MTF2Weight)"
- puts $fpt "MolcEnv: $ctfInfo(MolcEnv)"
- puts $fpt "Magnification: $ctfInfo(Magnification)"
- puts $fpt "flagCTFPower: $ctfInfo(flagCTFPower)"
- puts $fpt "BofVibration: $ctfInfo(BofVibration)"
- puts $fpt "flagVibration: $ctfInfo(flagVibration)"
- puts $fpt "VibrationMode: $ctfInfo(VibrationMode)"
- puts $fpt "Imax: $ctfInfo(Imax)"
- puts $fpt "Imin: $ctfInfo(Imin)"
- puts $fpt "Rmax: $ctfInfo(Rmax)"
- puts $fpt "Rmin: $ctfInfo(Rmin)"
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
-}
-
-#
-# ctfInfoFile
-#
-# Load
-#
-proc ctfInfoLoad { { filename __null__ } } {
- variable ctfInfo
-
- if { $filename != "__null__" } {
- if [ file exists $filename ] {
- set fpt [ open $filename r ]
- }
- } else {
- if [ info exists ctfInfo ] {
- puts "ctfInfo exists"
- puts $ctfInfo(DEBUGCOMMENT)
- } else {
- puts "ctfInfo does not exist"
- return
- }
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) r ]
- }
-
- while { ! [ eof $fpt ] } {
- gets $fpt s
- set slist [ split $s ":" ]
- set name [ string trim [ lindex $slist 0 ] ]
- set value [ string trim [ lindex $slist 1 ] ]
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- if { $name == "filename" || $name=="mrc"} {
- #
- } else {
- set ctfInfo($name) $value
- }
- }
- Main {
- if {
- $name == "defocus"
- || $name == "AoverP"
- || $name == "kV"
- || $name == "Cs"
- || $name == "Cc"
- || $name == "Ai"
- || $name == "I"
- || $name == "SN"
- || $name == "SN2"
- || $name == "Isignal"
- || $name == "Inoise"
- || $name == "Inoise2"
- || $name == "whichMTF"
- || $name == "MTF"
- || $name == "MTF2"
- || $name == "MTF2Weight"
- || $name == "MolcEnv"
- || $name == "Magnification"
- || $name == "flagCTFPower"
- || $name == "BofVibration"
- || $name == "Vibration"
- || $name == "VibrationMode"
- || $name == "Imax"
- || $name == "Imin"
- || $name == "Imax"
- || $name == "Rmin" } {
- set ctfInfo($name) $value
- }
- }
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
- if [ info exists ctfInfo(graph) ] {
- if [ info exists $ctfInfo(graph) ] {
- ctfInfoGraphUpdate
- }
- }
-}
-#
-#
-#
-proc ctfInfoMolecEnvSet { } {
- variable ctfInfo
-
- # Elastic
- switch $ctfInfo(whichMolec) {
- Gauss {
- ctfInfoSet MolecEnv $ctfInfo(MolcEnv)
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet Elastic 1 $ctfInfo(Elastic) $ctfInfo(ElaShift) $ctfInfo(ElaWidth) \
- $ctfInfo(ElaRing) $ctfInfo(ElaRShift) $ctfInfo(ElaRWidth)
- ctfInfoSet MolecEnvMode 0
- }
- Table {
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvTable $ctfInfo(.molcEnvTable)
- ctfInfoSet MolecEnvMode 1
- }
- }
-
- # Inelastic
- switch $ctfInfo(whichInElaMolec) {
- No {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Gauss {
- ctfInfoSet InElasticMode 1
- ctfInfoSet InElaMolecEnv $ctfInfo(InElaMolcEnv)
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1 $ctfInfo(InElastic) $ctfInfo(InElaShift) $ctfInfo(InElaWidth) \
- $ctfInfo(InElaRing) $ctfInfo(InElaRShift) $ctfInfo(InElaRWidth)
- ctfInfoSet InElaMolecEnvMode 0
- }
- Table {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1
- ctfInfoSet InElaMolecEnvTable $ctfInfo(.inElaMolcEnvTable)
- ctfInfoSet InElaMolecEnvMode 1
- }
- }
-}
-
-#
-#
-#
-proc ctfInfoCTFInfoFrameCreate { f side } {
- # Frame for ctfInfo
- frame $f
-
- ctfInfoCTFInfoFrameCreate1 $f.f1
- ctfInfoCTFInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side
- return $f
-}
-
-proc ctfInfoCTFInfoFrameCreate1 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- frame $f
-
- # Which CTF Plot
- set ff [ frame $f.title ]
- checkbutton $ff.main -text "CTF Params" -variable [subst $name]ctfInfo(flagCTFGraph) -command $cmd
- checkbutton $ff.sub -text "Core" -variable [subst $name]ctfInfo(flagCTFcoreGraph) -command $cmd
- checkbutton $ff.power -text "Power" -variable [subst $name]ctfInfo(flagCTFPower) -command $cmd
- pack $ff.main $ff.sub $ff.power -side left -expand true
-
- # Main Parameters
- set ff [ frame $f.main ]
- CommandEntryWithUpDown $ff.defocus "defocus A " 10 $cmd [subst $name]ctfInfo(defocus) [subst $name]ctfInfo(ddefocus) -width 6
- CommandEntryWithUpDown $ff.aoverP "AoverP " 10 $cmd [subst $name]ctfInfo(AoverP) [subst $name]ctfInfo(dAoverP) -width 6
- CommandEntryWithUpDown $ff.is "Isingal " 10 $cmd [subst $name]ctfInfo(Isignal) [subst $name]ctfInfo(dIsignal) -width 6
- CommandEntryWithUpDown $ff.in "Inoise " 10 $cmd [subst $name]ctfInfo(Inoise) [subst $name]ctfInfo(dInoise) -width 6
- CommandEntryWithUpDown $ff.in2 "Inoise2 " 10 $cmd [subst $name]ctfInfo(Inoise2) [subst $name]ctfInfo(dInoise2) -width 6
- CommandEntryWithUpDown $ff.mag "Mag " 10 $cmd [subst $name]ctfInfo(Magnification) [subst $name]ctfInfo(dMagnification) -width 6
- pack $ff.defocus $ff.aoverP $ff.is $ff.in $ff.in2 $ff.mag -side top -expand true
-
- # MTF
- set ff [ frame $f.mtf ]
- RadioButtonsCreateWithPackWithCommand $ff.which MTF $cmd left [subst $name]ctfInfo(whichMTF) singleExp Lorentz BothMul BothSum Linear Polynomial
- CommandEntryWithUpDown $ff.mtf "MTF A " 10 $cmd [subst $name]ctfInfo(MTF) [subst $name]ctfInfo(dMTF) -width 6
- CommandEntryWithUpDown $ff.mtf2 "MTF2 A " 10 $cmd [subst $name]ctfInfo(MTF2) [subst $name]ctfInfo(dMTF2) -width 6
- CommandEntryWithUpDown $ff.mtfw "MTF2Weight" 10 $cmd [subst $name]ctfInfo(MTF2Weight) [subst $name]ctfInfo(dMTF2Weight) -width 6
- pack $ff.which $ff.mtf $ff.mtf2 $ff.mtfw -side top
-
- set ff [ frame $f.pol ]
- CommandEntryWithUpDown $ff.mtfd3 "MTF A d3" 10 $cmd [subst $name]ctfInfo(MTFd3) [subst $name]ctfInfo(dMTFd3) -width 6
- CommandEntryWithUpDown $ff.mtfd4 "MTF A d4" 10 $cmd [subst $name]ctfInfo(MTFd4) [subst $name]ctfInfo(dMTFd4) -width 6
- CommandEntryWithUpDown $ff.mtfd5 "MTF A d5" 10 $cmd [subst $name]ctfInfo(MTFd5) [subst $name]ctfInfo(dMTFd5) -width 6
- CommandEntryWithUpDown $ff.mtfd6 "MTF A d6" 10 $cmd [subst $name]ctfInfo(MTFd6) [subst $name]ctfInfo(dMTFd6) -width 6
- pack $ff.mtfd3 $ff.mtfd4 $ff.mtfd5 $ff.mtfd6 -side top
-
- #set ff [ frame $f.mtfpol ]
- #pack $f.mtf $f.pol -side left
-
- # Elastic Scattering
- set ff [ frame $f.molec ]
- RadioButtonsCreateWithPackWithCommand $ff.which Elastic $cmd left [subst $name]ctfInfo(whichMolec) Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "GaussB A" 10 $cmd [subst $name]ctfInfo(MolcEnv) [subst $name]ctfInfo(dMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "E " 10 $cmd [subst $name]ctfInfo(Elastic) [subst $name]ctfInfo(dElastic) -width 6
- CommandEntryWithUpDown $ff.shift "E Shift" 10 $cmd [subst $name]ctfInfo(ElaShift) [subst $name]ctfInfo(dElaShift) -width 6
- CommandEntryWithUpDown $ff.width "E Width" 10 $cmd [subst $name]ctfInfo(ElaWidth) [subst $name]ctfInfo(dElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "E Ring " 10 $cmd [subst $name]ctfInfo(ElaRing) [subst $name]ctfInfo(dElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "E RShift" 10 $cmd [subst $name]ctfInfo(ElaRShift) [subst $name]ctfInfo(dElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "E RWidth" 10 $cmd [subst $name]ctfInfo(ElaRWidth) [subst $name]ctfInfo(dElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.molcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- # Inelastic
- set ff [ frame $f.inelamolec ]
- checkbutton $ff.use -text "With Inelastic" -variable [subst $name]ctfInfo(flagInElastic) -command $cmd
- RadioButtonsCreateWithPackWithCommand $ff.which Inelastic $cmd left [subst $name]ctfInfo(whichInElaMolec) No Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "IE Gauss B" 10 $cmd [subst $name]ctfInfo(InElaMolcEnv) [subst $name]ctfInfo(dInElaMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "IE " 10 $cmd [subst $name]ctfInfo(InElastic) [subst $name]ctfInfo(dInElastic) -width 6
- CommandEntryWithUpDown $ff.shift "IE Shift" 10 $cmd [subst $name]ctfInfo(InElaShift) [subst $name]ctfInfo(dInElaShift) -width 6
- CommandEntryWithUpDown $ff.width "IE Width" 10 $cmd [subst $name]ctfInfo(InElaWidth) [subst $name]ctfInfo(dInElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "IE Ring " 10 $cmd [subst $name]ctfInfo(InElaRing) [subst $name]ctfInfo(dInElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "IE RShift" 10 $cmd [subst $name]ctfInfo(InElaRShift) [subst $name]ctfInfo(dInElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "IE RWidth" 10 $cmd [subst $name]ctfInfo(InElaRWidth) [subst $name]ctfInfo(dInElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.inElaMolcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- set ff [ frame $f.calc ]
- button $ff.draw -text Draw -command $cmd
- button $ff.initS -text InitSearch -command [subst $name]ctfInitSearch
- button $ff.fineT -text FineTune -command [subst $name]ctfFineTuning
- pack $ff.draw $ff.initS $ff.fineT -side left -expand true
-
- pack \
- $f.title \
- $f.main \
- $f.mtf \
- $f.molec \
- $f.inelamolec \
- $f.calc \
- -side top -expand true
-
- return $f
-}
-
-proc ctfInitSearch { } {
- variable ctfInfo
-
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 1"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 0
- ctfInfoLoad
-}
-
-proc ctfFineTuning { } {
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16
- ctfInfoLoad
-}
-
-#
-# CTF Information
-#
-proc ctfInfoCTFInfoFrameCreate2 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- frame $f
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- CommandEntry $f.i "I(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(I)" -width 6
- CommandEntry $f.sN "SN(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN)" -width 6
- CommandEntry $f.sN2 "SN2(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN2)" -width 6
- CommandEntry $f.cs "Cs mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cs)" -width 6
- CommandEntry $f.kV "kV kV " 10 $cmd -textvar "[subst $name]ctfInfo(kV)" -width 6
- CommandEntry $f.ai "Ai mrad " 10 $cmd -textvar "[subst $name]ctfInfo(Ai)" -width 6
- CommandEntry $f.cc "Cc mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cc)" -width 6
- CommandEntry $f.dkV "dV eV " 10 $cmd -textvar "[subst $name]ctfInfo(dV)" -width 6
- CommandEntry $f.vib "Vibration " 10 $cmd -textvar "[subst $name]ctfInfo(BofVibration)" -width 6
- CommandEntry $f.vibMode "Vib-mode " 10 $cmd -textvar "[subst $name]ctfInfo(VibrationMode)" -width 6
- checkbutton $f.aliasing -text "Aliasing" -variable [subst $name]ctfInfo(flagAliasing) -command $cmd
- checkbutton $f.sampling -text "Sampling" -variable [subst $name]ctfInfo(flagSampling) -command $cmd
- CommandEntry $f.nyquist "Nyquist " 10 $cmd -textvar "[subst $name]ctfInfo(NyquistFrequency)" -width 6
-
- pack \
- $f.i \
- $f.sN \
- $f.sN2 \
- $f.cs \
- $f.kV \
- $f.ai \
- $f.cc \
- $f.dkV \
- $f.vib \
- $f.vibMode \
- $f.aliasing \
- $f.sampling \
- $f.nyquist \
- -side top -expand true
- return $f
-}
-
-#
-# ctfInfoMarker: Thon Ring Line
-# Movable marker for thonRingDetermine
-#
-
-# Marker Set
-proc ctfInfoMarkerSet { } {
- variable ctfInfo
-
- ctfInfoMarkerUnset
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- $ctfInfo(graph) marker create line -name zero$i \
- -coords { $ctfInfo(zero$i) 0 \
- $ctfInfo(zero$i) 1 }
- $ctfInfo(graph) marker configure zero$i -dashes { 2 2 }
- }
-}
-
-# Marker Unset
-proc ctfInfoMarkerUnset { } {
- variable ctfInfo
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete zero$i }
- }
-}
-
-#
-# Thon Ring Information
-# Predicted Marker Set for Graph
-#
-proc ctfInfoPredictedThonRing { } {
- variable ctfInfo
-
- set size [ llength $ctfInfo(R) ]
- set dR [ expr [lindex $ctfInfo(R) 1]-[lindex $ctfInfo(R) 0]]
- set RMax [ lindex $ctfInfo(R) [expr $size-1] ]
- set Zero [ ctfInfoGet Zero $RMax $ctfInfo(predictZeroMaxMax) $dR ]
- set ctfInfo(predictZeroMax) [ expr [ llength $Zero ] / 3 ]
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ctfInfo(predictZero$i) [ lindex $Zero [ expr 3*$i ] ]
- set ctfInfo(predictZeroCTF$i) [ expr 0.8*$ctfInfo(Imax) ]
- set data [ lindex $Zero [ expr 3*$i + 1 ] ]
- set data1 [ lindex $Zero [ expr 3*$i + 2 ] ]
- if { $ctfInfo(flagCTFPower) == 1 } {
- set ctfInfo(predictZeroCTF$i) [ expr $data*$data + $data1*$data1 ]
- } else {
- set ctfInfo(predictZeroCTF$i) [ expr $data + $data1 ]
- }
- }
- set ctfInfo(flagpredictThonRing) 1
-}
-
-#
-# PredictedMarker of ThonRing on canvas
-#
-proc ctfInfoPredictedMarkerOnCanvas { } {
- variable ctfInfo
-
- if [ info exists ctfInfo(mrc) ] {
- array set mainImage $ctfInfo(mrc)
- if [ info exists mainImage(mainCanvas) ] {
- puts $mainImage(mainCanvas)
- #$mainImage(mainCanvas) create oval 0 0 10 10
- .main_canvas create oval 0 0 10 10
- } else {
- puts "No canvas to draw Thon rings: in ctfInfoCTFLineCreate"
- }
- } else {
- puts "No mrc Setting"
- }
-}
-
-#
-# PredictedMarker of ThonRing on graph
-#
-proc ctfInfoPredictedMarkerSet { } {
- variable ctfInfo
-
- # Zero Point
- ctfInfoPredictedThonRing
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ymax [ expr 1.2*$ctfInfo(predictZeroCTF$i) ]
- $ctfInfo(graph) marker create line -name predictZero$i -coords {
- $ctfInfo(predictZero$i) 0 \
- $ctfInfo(predictZero$i) $ymax }
- #$ctfInfo(graph) marker configure predictZero$i -foreground black
- }
- set ctfInfo(flagpredictZero) 1
-}
-
-#
-proc ctfInfoPredictedMarkerUnset { } {
- variable ctfInfo
- if { $ctfInfo(flagpredictZero) == 1 } {
- for { set i 1 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete predictZero$i }
- }
- }
- set ctfInfo(flagpredictZero) 0
-}
-#
-proc ctfInfoMarkerReset { } {
- variable ctfInfo
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- if [ info exists ctfInfo(predictZero$i) ] {
- set ctfInfo(zero$i) $ctfInfo(predictZero$i)
- } else {
- puts "ctfInfo(zeroMax) is wrong at $i: $ctfInfo(zeroMax)"
- break
- }
- }
- ctfInfoMarkerSet
-}
-
-
-#
-# Graph Update
-#
-
-proc ctfInfoGraphUpdate { } {
- variable ctfInfo
-
- ctfInfoGraphConfiguration
- if { $ctfInfo(flagScatGraph) == 1 } {
- ctfInfoScatteringLineCreate Scattering $ctfInfo(graph) ctfInfo(R) ctfInfo(Scattering)
- } else {
- catch { $ctfInfo(graph) element delete Scattering }
- }
- if { $ctfInfo(flagScatGraphSubtraction) == 1 } {
- catch { ctfInfoScatteringLineCreate ScatteringSubtraction $ctfInfo(graph) ctfInfo(R) ctfInfo(ScatteringSubtraction) }
- } else {
- catch { $ctfInfo(graph) element delete ScatteringSubtraction }
- }
- ctfInfoCTFLineCreate $ctfInfo(graph)
-}
-
-#
-# ctfInfoScatteringLineCreate
-# Scattering Data Plotting
-#
-proc ctfInfoScatteringLineCreate { name g x y } {
- upvar $x xx
- upvar $y yy
- # Drawing Graph (Scattering)
- catch { $g element delete $name }
- $g element create $name -xdata $xx -ydata $yy
- $g element configure $name -pen scatPen
-}
-
-#
-# ctfInfoCTFLineCreate
-# CTF Graph Create
-# Elements:
-# CTF
-# CTFcore
-# Noise
-#
-proc ctfInfoCTFLineCreate { g } {
- variable ctfInfo
-
- # CTF Calc
- ctfInfoCTFCalculation
-
- # Graph Delete
- catch { $g element delete CTF }
- catch { $g element delete CTFcore }
- catch { $g element delete Noise }
-
- # Markder Unset
- ctfInfoPredictedMarkerUnset
-
- # Signal + Noise
- if { $ctfInfo(flagCTFGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) == 1 } {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTFPower)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoisePower)
- } else {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTF)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoise)
- }
- $g element configure CTF -pen ctfPen
- $g element configure Noise -pen ctfPen
-
- ctfInfoPredictedMarkerSet
- }
-
- # Signal Only
- if { $ctfInfo(flagCTFcoreGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) } {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignalPower)
- } else {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignal)
- }
- $g element configure CTFcore -pen ctfPen
- }
- if { $ctfInfo(flagThonRingOnCanvas) == 1 } {
- ctfInfoPredictedMarkerOnCanvas
- }
-
- # Configuration
- ctfInfoGraphConfiguration
-}
-
-#
-# ctfInfoGraphConfiguration
-# Axis, Title, Logscale etc.
-#
-proc ctfInfoGraphConfiguration { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
-
- $g configure -title "CTF($ctfInfo(filename))"
- $g axis configure x -title "R" -loose yes -max $ctfInfo(Rmax) -hide no
- $g axis configure y -title "Intensity" -loose yes -max $ctfInfo(Imax) -hide no
- $g legend configure -position top -hide no
- $g axis configure x -max $ctfInfo(Rmax)
- $g axis configure x -min $ctfInfo(Rmin)
- $g axis configure y -max $ctfInfo(Imax)
- $g axis configure y -min $ctfInfo(Imin)
- if { $ctfInfo(flagLogScale) == 1 } {
- if { $ctfInfo(Imin) <= 0 } {
- set ctfInfo(Imin) [ expr $ctfInfo(Imax)*1e-6 ]
- }
- $g axis configure y -logscale yes
- } else {
- $g axis configure y -logscale no
- }
- ctfInfoGraphPenCreate
-
- Blt_ZoomStack $g
- Blt_Crosshairs $g
- Blt_ActiveLegend $g
- Blt_ClosestPoint $g
-}
-
-# Pen Information
-#
-proc ctfInfoGraphPenCreate { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
- catch { $g pen create scatPen }
- $g pen configure scatPen -pixels 0 -color blue
- catch { $g pen create ctfPen }
- $g pen configure ctfPen -pixels 0 -color red
-}
-
-#
-# ctfInfoCTFInfomationSet
-#
-proc ctfInfoCTFInfomationSet { } {
- variable ctfInfo
-
- # set
- set ctfInfo(I) $ctfInfo(Isignal)
- set ctfInfo(SN) [ expr double($ctfInfo(Inoise))/double($ctfInfo(Isignal))]
- set ctfInfo(SN2) [ expr double($ctfInfo(Inoise2))/double($ctfInfo(Isignal))]
-
- #
- set size [ llength $ctfInfo(R) ]
- ctfInfoSet kV $ctfInfo(kV)
- ctfInfoSet defocus $ctfInfo(defocus)
- ctfInfoSet Cc $ctfInfo(Cc)
- ctfInfoSet dE $ctfInfo(dV)
- ctfInfoSet Cs $ctfInfo(Cs)
- ctfInfoSet Ai $ctfInfo(Ai)
- ctfInfoSet I $ctfInfo(I)
- ctfInfoSet Mag $ctfInfo(Magnification)
- ctfInfoSet AoverP $ctfInfo(AoverP)
- ctfInfoSet Mode [ expr 1 + 32 + 64 ]
- switch -exact -- $ctfInfo(whichMTF) {
- singleExp {
- ctfInfoSet MTFMode 0
- }
- Lorentz {
- ctfInfoSet MTFMode 1
- }
- BothMul {
- ctfInfoSet MTFMode 2
- }
- Linear {
- ctfInfoSet MTFMode 3
- }
- BothSum {
- ctfInfoSet MTFMode 4
- }
- Polynomial {
- ctfInfoSet MTFMode 5
- }
- default {
- puts "Not supported MTF mode: $ctfInfo(whichMTF)"
- }
- }
- ctfInfoSet MTF $ctfInfo(MTF)
- ctfInfoSet MTF2 $ctfInfo(MTF2)
- ctfInfoSet MTF2Weight $ctfInfo(MTF2Weight)
- ctfInfoSet Noise $ctfInfo(SN)
- ctfInfoSet Noise2 $ctfInfo(SN2)
- ctfInfoSet R $size $ctfInfo(R)
- ctfInfoSet VibrationMode $ctfInfo(VibrationMode)
- ctfInfoSet BofVibration $ctfInfo(BofVibration)
- ctfInfoSet flagVibration $ctfInfo(flagVibration)
- ctfInfoSet Aliasing $ctfInfo(flagAliasing) $ctfInfo(NyquistFrequency)
- ctfInfoSet Sampling $ctfInfo(flagSampling) $ctfInfo(NyquistFrequency)
-
- #
- ctfInfoMolecEnvSet
-}
-
-#
-# ctfInfoCTFCalculation
-#
-proc ctfInfoCTFCalculation { } {
- variable ctfInfo
-
- #
- #puts "ctfInfoCTFCalculation: Power: $ctfInfo(flagCTFPower)"
-
- # Information Set
- ctfInfoCTFInfomationSet
-
- # Data Unset
- catch { unset ctfInfo(CTF) }
- catch { unset ctfInfo(CTFPower) }
- catch { unset ctfInfo(CTFcore) }
- catch { unset ctfInfo(CTFcorePower) }
- catch { unset ctfInfo(CTFNoise) }
- catch { unset ctfInfo(CTFNoisePower) }
- catch { unset ctfInfo(CTFSignal) }
- catch { unset ctfInfo(CTFSignalPower) }
- catch { unset ctfInfo(ScatteringSubtraction) }
-
- # Data Set
- set size [ llength $ctfInfo(R) ]
- if { $ctfInfo(flagCTFPower) } {
- set ctfInfo(CTFPower) [ ctfInfoCalc CTFPower ]
- set ctfInfo(CTFcorePower) [ ctfInfoCalc CTFcorePower ]
- set ctfInfo(CTFNoisePower) [ ctfInfoCalc CTFNoisePower ]
- set ctfInfo(CTFSignalPower) [ ctfInfoCalc CTFSignalPower ]
- } else {
- set ctfInfo(CTF) [ ctfInfoCalc CTF ]
- set ctfInfo(CTFcore) [ ctfInfoCalc CTFcore ]
- set ctfInfo(CTFNoise) [ ctfInfoCalc CTFNoise ]
- set ctfInfo(CTFSignal) [ ctfInfoCalc CTFSignal ]
- }
- for { set i 0 } { $i < $size } { incr i } {
- set data [ lindex $ctfInfo(Scattering) $i ]
- if { $ctfInfo(flagCTFPower) } {
- set noise [ lindex $ctfInfo(CTFNoisePower) $i ]
- } else {
- set noise [ lindex $ctfInfo(CTFNoise) $i ]
- }
- lappend ctfInfo(ScatteringSubtraction) [ expr $data - $noise ]
- }
-}
-
-#
-# Scattering Data
-#
-proc ctfInfoScatteringCalc { { filename __null__ } } {
- variable ctfInfo
-
- #puts "ctfInfoScatteringCalc"
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- } else {
- puts "no file for Scattring calc."
- return
- }
- }
- set xy [ mrcInfoGet $filename Spectrum2 ]
-
- catch { unset ctfInfo(R) }
- catch { unset ctfInfo(Scattering) }
- catch { unset ctfInfo(ScatteringRoot) }
-
- foreach { x y } $xy {
- lappend ctfInfo(R) $x
- lappend ctfInfo(Scattering) $y
- lappend ctfInfo(ScatteringRoot) [ expr sqrt($y)]
- }
- set ctfInfo(NyquistFrequency) [ lindex $ctfInfo(R) end ]
-}
-
-#end of CTF namespace
-}
-
+++ /dev/null
-#
-#
-# ctfInfo
-# namespace eval CTF
-#
-namespace eval CTF {
- variable ctfInfo
- namespace export ctfInfoLoad ctfInfoSave ctfInfoGraphUpdate
-
-proc Init { { mrc __null__ } } {
- variable ctfInfo
-
- # mrcImage Information Check: set ctfInfo(mrc) $mrc
- set ctfInfo(DEBUGCOMMENT) "DEBUG"
- if { $mrc != "__null__" } {
- # New Object
- array set mrcImage $mrc
- if [ info exists mrcImage(filename) ] {
- # Set New mrcImage
- set filename $mrcImage(filename)
- set ctfInfo(mrc) $mrc
- } else { # mrc is a new filename
- # Set New file
- set filename $mrc
- catch { unset ctfInfo(mrc) }
- }
- } else {
- # No setting
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- # puts "Already FileName"
- } elseif [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- set filename $mrcImage(filename)
- } else { # mrc is filename
- set filename $mrc
- }
- }
- if [ info exists ctfInfo(filename) ] {
- if { $ctfInfo(filename) != $filename } {
- set ctfInfo(flagInit) 0
- } else {
- set ctfInfo(flagInit) 1
- }
- } else {
- set ctfInfo(flagInit) 0
- }
-
- if { $ctfInfo(flagInit) == 1 } {
- return
- } else {
- set ctfInfo(filename) $filename
- }
-
- # Start Initialization
- set ctfInfo(flagInit) 1
-
- # Molecular Envelope for signal
- #Elastic
- set ctfInfo(.defctfinfo) "./.DefCTFInfo"
- set ctfInfo(whichMolec) Gauss
- set ctfInfo(.molcEnvTable) "./carbon.table"
- set ctfInfo(MolcEnv) 8.0
- set ctfInfo(dMolcEnv) 1.0
- set ctfInfo(Elastic) 2.4912
- set ctfInfo(dElastic) 0.0000
- set ctfInfo(ElaShift) 0.0108
- set ctfInfo(dElaShift) 0.0000
- set ctfInfo(ElaWidth) 0.2226
- set ctfInfo(dElaWidth) 0.0100
- set ctfInfo(ElaRing) 1.0000
- set ctfInfo(dElaRing) 0.1000
- set ctfInfo(ElaRShift) 0.2500
- set ctfInfo(dElaRShift) 0.0100
- set ctfInfo(ElaRWidth) 0.1000
- set ctfInfo(dElaRWidth) 0.0100
- #Inelastic
- set ctfInfo(whichInElaMolec) No
- set ctfInfo(.inElaMolcEnvTable) "./carbon.table"
- set ctfInfo(InElaMolcEnv) 8.0
- set ctfInfo(dInElaMolcEnv) 1.0
- set ctfInfo(InElastic) 2.4912
- set ctfInfo(dInElastic) 0.0000
- set ctfInfo(InElaShift) 0.0108
- set ctfInfo(dInElaShift) 0.0000
- set ctfInfo(InElaWidth) 0.2226
- set ctfInfo(dInElaWidth) 0.0100
- set ctfInfo(InElaRing) 1.0000
- set ctfInfo(dInElaRing) 0.1000
- set ctfInfo(InElaRShift) 0.2500
- set ctfInfo(dInElaRShift) 0.0100
- set ctfInfo(InElaRWidth) 0.1000
- set ctfInfo(dInElaRWidth) 0.0100
- #
- #
- #
- set ctfInfo(flagScatGraph) 1
- set ctfInfo(flagScatGraphSubtraction) 0
- set ctfInfo(Imax) 0.001
- set ctfInfo(dImax) 0.0001
- set ctfInfo(Rmax) 0.20
- set ctfInfo(dRmax) 0.01
- set ctfInfo(Imin) 0.00
- set ctfInfo(dImin) 0.0001
- set ctfInfo(Rmin) 0.00
- set ctfInfo(dRmin) 0.01
- #
- #
- #
- set ctfInfo(flagZero) 1
- set ctfInfo(zeroMax) 6
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- set ctfInfo(zero$i) [ expr 0.01*$i ]
- set ctfInfo(dzero$i) 0.01
- }
- set ctfInfo(ThonRingCanvas) 0
-
- set ctfInfo(flagCTFGraph) 1
- set ctfInfo(flagCTFcoreGraph) 0
- set ctfInfo(flagCTFPower) 1
- set ctfInfo(flagLogScale) 0
-
- # Thon Ring Information
- set ctfInfo(flagpredictThonRing) 0
- set ctfInfo(flagpredictZero) 0
- set ctfInfo(flagpredictZeroMax) 1
- set ctfInfo(predictZeroMaxMax) 30
-
- ##
- set ctfInfo(defocus) 500
- set ctfInfo(ddefocus) -100
- set ctfInfo(Cs) 2.1
- set ctfInfo(dCs) 0.1
- set ctfInfo(kV) 200
- set ctfInfo(dkV) 5
- set ctfInfo(AoverP) 0.1
- set ctfInfo(dAoverP) -0.01
- set ctfInfo(Ai) 0.02
- set ctfInfo(dAi) 0.01
- set ctfInfo(Cc) 0.7
- set ctfInfo(dCc) 0.1
- set ctfInfo(dV) 0.7
- set ctfInfo(ddV) 0.1
- set ctfInfo(I) 0.015
- set ctfInfo(dI) 0.002
- set ctfInfo(SN) 0.1
- set ctfInfo(dSN) 0.1
- set ctfInfo(SN2) 0.1
- set ctfInfo(dSN2) 0.1
- set ctfInfo(Isignal) 0.015
- set ctfInfo(dIsignal) 0.002
- set ctfInfo(Inoise) 0.0015
- set ctfInfo(dInoise) 0.0002
- set ctfInfo(Inoise2) 0.0015
- set ctfInfo(dInoise2) 0.0002
- set ctfInfo(whichMTF) singleExp
-
- # MTF
- set ctfInfo(MTF) 38
- set ctfInfo(dMTF) 1
-
- set ctfInfo(MTFd2) 0
- set ctfInfo(dMTFd2) 1
- set ctfInfo(MTFd3) 0
- set ctfInfo(dMTFd3) 1
- set ctfInfo(MTFd4) 0
- set ctfInfo(dMTFd4) 1
- set ctfInfo(MTFd5) 0
- set ctfInfo(dMTFd5) 1
- set ctfInfo(MTFd6) 0
- set ctfInfo(dMTFd6) 1
-
- set ctfInfo(MTF2) 38
- set ctfInfo(dMTF2) 1
- set ctfInfo(MTF2Weight) 0
- set ctfInfo(dMTF2Weight) 0.1
- set ctfInfo(Magnification) 1.0
- set ctfInfo(dMagnification) -0.005
- # Vibration
- set ctfInfo(flagVibration) 1
- set ctfInfo(BofVibration) 4.0
- set ctfInfo(VibrationMode) 0
- # Aliasing
- set ctfInfo(flagAliasing) 1
- set ctfInfo(flagSampling) 0
- set ctfInfo(NyquistFrequency) 1
-
- ## Evaluation of ctfInfo
- set ctfInfo(flagEvaluation) 0
- set ctfInfo(EvalMinMaxMethod) NULL
- # Canvas
- set ctfInfo(flagThonRingOnCanvas) 0
-
- ### Input Graph Data
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- if [ info exists mrcImage(filename) ] {
- set ctfInfo(filename) $mrcImage(filename)
- }
- }
- if [ info exists ctfInfo(filename) ] {
- puts "ANYWAY, move but strange"
- } else {
- puts "No CTFInfo File"
- flush stdout
- return
- }
- } else {
- set ctfInfo(filename) $filename
- }
- if [ file exists $ctfInfo(filename) ] {
-
- } else {
- puts "mrc file not found: Please check"
- }
-
- ### Input Default Data
- if [ string match ".fft" [ file extension $ctfInfo(filename) ] ] {
- set ctfInfo(.ctfps) [ file rootname $ctfInfo(filename) ].ctfps
- set ctfInfo(.ctfinfo) [ file rootname $ctfInfo(filename) ].ctfinfo
- } else {
- set ctfInfo(.ctfps) $ctfInfo(filename).ctfps
- set ctfInfo(.ctfinfo) $ctfInfo(filename).ctfinfo
- }
- set ctfInfo(.ctfinfoMode) "Every"
- if [ file exists $ctfInfo(.ctfinfo) ] {
- ctfInfoLoad
- } elseif [ file exists $ctfInfo(.defctfinfo) ] {
- ctfInfoLoad $ctfInfo(.defctfinfo)
- }
-
- #
- # Data Taking (Scattering)
- #
- ctfInfoScatteringCalc
-}
-
-#
-# CTF Program
-#
-proc Win { { win .ctfInfo } { filename __null__ } { extension 2 } } {
- variable ctfInfo
-
- ### Initialization
- Init
-
- if [ catch { toplevel $win -bd 4 -class CTFInfo } ] {
- raise $win
- } else {
- ### Create New Window
- set w $win
- #
- # Graph Frame
- #
- set f [ frame $w.graph ]
- # Frame for Graph
- set ctfInfo(graph) [ graph $f.graph ]
- ctfInfoGraphInfoFrameCreate $f.info top
- pack $f.graph $f.info -side left -expand true -fill both
-
- # Graph Update
- ctfInfoGraphUpdate
-
- pack $w.graph -side left -expand true -fill both
-
- }
-
- if [ catch { toplevel $win$extension -bd 4 -class CTFInfo } ] { # Window Create
- raise $win$extension
- } else {
- ### Create New Window
- set w $win$extension
-
- # ctfInfo Frame
- ctfInfoCTFInfoFrameCreate $w.ctf left
- #
- # Packing
- #
- pack $w.ctf -side left -expand true -fill both
-
- }
-
- # Marker : Thon Ring
- ctfInfoPredictedMarkerSet
- ctfInfoMarkerReset
-}
-
-#
-# GraphInfo Frame
-#
-proc ctfInfoGraphInfoFrameCreate { f side } {
- frame $f
-
- ctfInfoGraphInfoFrameCreate1 $f.f1
- ctfInfoGraphInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side -expand true -fill both
- return $f
-}
-
-#
-# Related to scattering frame
-#
-proc ctfInfoGraphInfoFrameCreate1 { f } {
- variable ctfInfo
-
- frame $f
- # Scattering Information: Scattering/SubtractScattering
- set cmd "[ namespace code {ctfInfoGraphUpdate} ]"
- set name [ namespace current ]::
-
- #
- set ff [ frame $f.graph ]
- checkbutton $ff.graph -text "Scattering" -variable [subst $name]ctfInfo(flagScatGraph) -command $cmd
- checkbutton $ff.graphsub -text "Subtract" -variable [subst $name]ctfInfo(flagScatGraphSubtraction) -command $cmd
- checkbutton $ff.log -text "Log" -variable [subst $name]ctfInfo(flagLogScale) -command $cmd
- pack $ff.graph $ff.graphsub $ff.log -side left
-
- # Scattering Graph Configure
- set ff [ frame $f.graphConfig ]
- CommandEntryWithUpDown $ff.intensity Imax 4 $cmd [subst $name]ctfInfo(Imax) [subst $name]ctfInfo(dImax) -width 10
- CommandEntryWithUpDown $ff.imin Imin 4 $cmd [subst $name]ctfInfo(Imin) [subst $name]ctfInfo(dImin) -width 10
- CommandEntryWithUpDown $ff.brmax Rmax 4 $cmd [subst $name]ctfInfo(Rmax) [subst $name]ctfInfo(dRmax) -width 10
- CommandEntryWithUpDown $ff.brmin Rmin 4 $cmd [subst $name]ctfInfo(Rmin) [subst $name]ctfInfo(dRmin) -width 10
- pack $ff.intensity $ff.imin $ff.brmax $ff.brmin -side top
-
- #
- # File Frame
- #
- set ff [ frame $f.file ]
-
- #PS
- set fff [ frame $ff.printPS ]
- button $fff.printPS -text "Save" -command "[subst $name]ctfInfoSaveAsPS"
- CommandEntry $fff.printPSEntry Graph 5 "[subst $name]ctfInfoSaveAsPS" -textvar [subst $name]ctfInfo(.ctfps)
- pack $fff.printPS $fff.printPSEntry -side left
-
- # Info
- set fff [ frame $ff.printInfo ]
- button $fff.printInfo -text "Save" -command "[subst $name]ctfInfoSave"
- CommandEntry $fff.printInfoEntry Info 5 "[subst $name]ctfInfoSave" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.printInfo $fff.printInfoEntry -side left
-
- # InfoLoad
- set fff [ frame $ff.loadInfo ]
- button $fff.loadInfo -text "Load" -command "[subst $name]ctfInfoLoad"
- CommandEntry $fff.loadInfoEntry Info 5 "[subst $name]ctfInfoLoad" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.loadInfo $fff.loadInfoEntry -side left
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- # Packing
- pack \
- $f.graph \
- $f.graphConfig \
- $f.file \
- -side top -expand true
- return $f
-}
-
-#
-# Thon Ring on canvas
-# Incomplete procedure
-#
-proc ctfInfoGraphInfoFrameCreate2 { f } {
- variable ctfInfo
-
- frame $f
-
- # Thon Ring
- set cmd ctfInfoMarkerSet
- checkbutton $f.zero -text "Thon Ring (zero)" -variable ctfInfo(flagZero) -command $cmd
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- CommandEntryWithUpDown $f.zero$i $i 4 $cmd ctfInfo(zero$i) ctfInfo(dzero$i) -width 6
- }
- button $f.zeroReset -text Reset -command ctfInfoMarkerReset
-
- pack $f.zero -side top -expand true
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- pack $f.zero$i -side top -expand true
- }
- pack $f.zeroReset -side top -expand true
-
- return $f
-}
-
-#
-# Graph Save as a PS file
-#
-proc ctfInfoSaveAsPS { } {
- variable ctfInfo
-
- puts $ctfInfo(.ctfps)
- $ctfInfo(graph) postscript output $ctfInfo(.ctfps) -center false
-}
-
-#
-# ctfInfoFile
-#
-# Save
-#
-proc ctfInfoSave { } {
- variable ctfInfo
-
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) a 0600 ]
-
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- foreach { name value } [ array get ctfInfo ] {
- if { $name == "filename" || $name=="mrc"} {
-
- } else {
- puts $fpt "$name: $value"
- }
- }
- }
- Main {
- puts $fpt "defocus: $ctfInfo(defocus)"
- puts $fpt "AoverP: $ctfInfo(AoverP)"
- puts $fpt "kV: $ctfInfo(kV)"
- puts $fpt "Cs: $ctfInfo(Cs)"
- puts $fpt "Cc: $ctfInfo(Cc)"
- puts $fpt "Ai: $ctfInfo(Ai)"
- puts $fpt "I: $ctfInfo(I)"
- puts $fpt "SN: $ctfInfo(SN)"
- puts $fpt "SN2: $ctfInfo(SN2)"
- puts $fpt "Isignal: $ctfInfo(Isignal)"
- puts $fpt "Inoise: $ctfInfo(Inoise)"
- puts $fpt "Inoise2: $ctfInfo(Inoise2)"
- puts $fpt "whichMTF: $ctfInfo(whichMTF)"
- puts $fpt "MTF: $ctfInfo(MTF)"
- puts $fpt "MTF2: $ctfInfo(MTF2)"
- puts $fpt "MTF2Weight: $ctfInfo(MTF2Weight)"
- puts $fpt "MolcEnv: $ctfInfo(MolcEnv)"
- puts $fpt "Magnification: $ctfInfo(Magnification)"
- puts $fpt "flagCTFPower: $ctfInfo(flagCTFPower)"
- puts $fpt "BofVibration: $ctfInfo(BofVibration)"
- puts $fpt "flagVibration: $ctfInfo(flagVibration)"
- puts $fpt "VibrationMode: $ctfInfo(VibrationMode)"
- puts $fpt "Imax: $ctfInfo(Imax)"
- puts $fpt "Imin: $ctfInfo(Imin)"
- puts $fpt "Rmax: $ctfInfo(Rmax)"
- puts $fpt "Rmin: $ctfInfo(Rmin)"
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
-}
-
-#
-# ctfInfoFile
-#
-# Load
-#
-proc ctfInfoLoad { { filename __null__ } } {
- variable ctfInfo
-
- if { $filename != "__null__" } {
- if [ file exists $filename ] {
- set fpt [ open $filename r ]
- }
- } else {
- if [ info exists ctfInfo ] {
- puts "ctfInfo exists"
- puts $ctfInfo(DEBUGCOMMENT)
- } else {
- puts "ctfInfo does not exist"
- return
- }
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) r ]
- }
-
- while { ! [ eof $fpt ] } {
- gets $fpt s
- set slist [ split $s ":" ]
- set name [ string trim [ lindex $slist 0 ] ]
- set value [ string trim [ lindex $slist 1 ] ]
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- if { $name == "filename" || $name=="mrc"} {
- #
- } else {
- set ctfInfo($name) $value
- }
- }
- Main {
- if {
- $name == "defocus"
- || $name == "AoverP"
- || $name == "kV"
- || $name == "Cs"
- || $name == "Cc"
- || $name == "Ai"
- || $name == "I"
- || $name == "SN"
- || $name == "SN2"
- || $name == "Isignal"
- || $name == "Inoise"
- || $name == "Inoise2"
- || $name == "whichMTF"
- || $name == "MTF"
- || $name == "MTF2"
- || $name == "MTF2Weight"
- || $name == "MolcEnv"
- || $name == "Magnification"
- || $name == "flagCTFPower"
- || $name == "BofVibration"
- || $name == "Vibration"
- || $name == "VibrationMode"
- || $name == "Imax"
- || $name == "Imin"
- || $name == "Imax"
- || $name == "Rmin"
- || $name == "MTFd2"
- || $name == "MTFd3"
- || $name == "MTFd4"
- || $name == "MTFd5"
- || $name == "MTFd6"} {
- set ctfInfo($name) $value
- }
- }
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
- if [ info exists ctfInfo(graph) ] {
- if [ info exists $ctfInfo(graph) ] {
- ctfInfoGraphUpdate
- }
- }
-}
-#
-#
-#
-proc ctfInfoMolecEnvSet { } {
- variable ctfInfo
-
- # Elastic
- switch $ctfInfo(whichMolec) {
- Gauss {
- ctfInfoSet MolecEnv $ctfInfo(MolcEnv)
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet Elastic 1 $ctfInfo(Elastic) $ctfInfo(ElaShift) $ctfInfo(ElaWidth) \
- $ctfInfo(ElaRing) $ctfInfo(ElaRShift) $ctfInfo(ElaRWidth)
- ctfInfoSet MolecEnvMode 0
- }
- Table {
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvTable $ctfInfo(.molcEnvTable)
- ctfInfoSet MolecEnvMode 1
- }
- }
-
- # Inelastic
- switch $ctfInfo(whichInElaMolec) {
- No {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Gauss {
- ctfInfoSet InElasticMode 1
- ctfInfoSet InElaMolecEnv $ctfInfo(InElaMolcEnv)
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1 $ctfInfo(InElastic) $ctfInfo(InElaShift) $ctfInfo(InElaWidth) \
- $ctfInfo(InElaRing) $ctfInfo(InElaRShift) $ctfInfo(InElaRWidth)
- ctfInfoSet InElaMolecEnvMode 0
- }
- Table {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1
- ctfInfoSet InElaMolecEnvTable $ctfInfo(.inElaMolcEnvTable)
- ctfInfoSet InElaMolecEnvMode 1
- }
- }
-}
-
-#
-#
-#
-proc ctfInfoCTFInfoFrameCreate { f side } {
- # Frame for ctfInfo
- frame $f
-
- ctfInfoCTFInfoFrameCreate1 $f.f1
- ctfInfoCTFInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side
- return $f
-}
-
-proc ctfInfoCTFInfoFrameCreate1 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- frame $f
-
- # Which CTF Plot
- set ff [ frame $f.title ]
- checkbutton $ff.main -text "CTF Params" -variable [subst $name]ctfInfo(flagCTFGraph) -command $cmd
- checkbutton $ff.sub -text "Core" -variable [subst $name]ctfInfo(flagCTFcoreGraph) -command $cmd
- checkbutton $ff.power -text "Power" -variable [subst $name]ctfInfo(flagCTFPower) -command $cmd
- pack $ff.main $ff.sub $ff.power -side left -expand true
-
- # Main Parameters
- set ff [ frame $f.main ]
- CommandEntryWithUpDown $ff.defocus "defocus A " 10 $cmd [subst $name]ctfInfo(defocus) [subst $name]ctfInfo(ddefocus) -width 6
- CommandEntryWithUpDown $ff.aoverP "AoverP " 10 $cmd [subst $name]ctfInfo(AoverP) [subst $name]ctfInfo(dAoverP) -width 6
- CommandEntryWithUpDown $ff.is "Isingal " 10 $cmd [subst $name]ctfInfo(Isignal) [subst $name]ctfInfo(dIsignal) -width 6
- CommandEntryWithUpDown $ff.in "Inoise " 10 $cmd [subst $name]ctfInfo(Inoise) [subst $name]ctfInfo(dInoise) -width 6
- CommandEntryWithUpDown $ff.in2 "Inoise2 " 10 $cmd [subst $name]ctfInfo(Inoise2) [subst $name]ctfInfo(dInoise2) -width 6
- CommandEntryWithUpDown $ff.mag "Mag " 10 $cmd [subst $name]ctfInfo(Magnification) [subst $name]ctfInfo(dMagnification) -width 6
- pack $ff.defocus $ff.aoverP $ff.is $ff.in $ff.in2 $ff.mag -side top -expand true
-
- # MTF
- set ff [ frame $f.mtf ]
- RadioButtonsCreateWithPackWithCommand $ff.which MTF $cmd left [subst $name]ctfInfo(whichMTF) singleExp Lorentz BothMul BothSum Linear Polynomial
- CommandEntryWithUpDown $ff.mtf "MTF A " 10 $cmd [subst $name]ctfInfo(MTF) [subst $name]ctfInfo(dMTF) -width 6
- CommandEntryWithUpDown $ff.mtf2 "MTF2 A " 10 $cmd [subst $name]ctfInfo(MTF2) [subst $name]ctfInfo(dMTF2) -width 6
- CommandEntryWithUpDown $ff.mtfw "MTF2Weight" 10 $cmd [subst $name]ctfInfo(MTF2Weight) [subst $name]ctfInfo(dMTF2Weight) -width 6
- pack $ff.which $ff.mtf $ff.mtf2 $ff.mtfw -side top
-
- set ff [ frame $f.pol ]
- CommandEntryWithUpDown $ff.mtfd2 "MTF A d2" 10 $cmd [subst $name]ctfInfo(MTFd2) [subst $name]ctfInfo(dMTFd2) -width 6
- CommandEntryWithUpDown $ff.mtfd3 "MTF A d3" 10 $cmd [subst $name]ctfInfo(MTFd3) [subst $name]ctfInfo(dMTFd3) -width 6
- CommandEntryWithUpDown $ff.mtfd4 "MTF A d4" 10 $cmd [subst $name]ctfInfo(MTFd4) [subst $name]ctfInfo(dMTFd4) -width 6
- CommandEntryWithUpDown $ff.mtfd5 "MTF A d5" 10 $cmd [subst $name]ctfInfo(MTFd5) [subst $name]ctfInfo(dMTFd5) -width 6
- CommandEntryWithUpDown $ff.mtfd6 "MTF A d6" 10 $cmd [subst $name]ctfInfo(MTFd6) [subst $name]ctfInfo(dMTFd6) -width 6
- pack $ff.mtfd2 $ff.mtfd3 $ff.mtfd4 $ff.mtfd5 $ff.mtfd6 -side top
-
- # Elastic Scattering
- set ff [ frame $f.molec ]
- RadioButtonsCreateWithPackWithCommand $ff.which Elastic $cmd left [subst $name]ctfInfo(whichMolec) Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "GaussB A" 10 $cmd [subst $name]ctfInfo(MolcEnv) [subst $name]ctfInfo(dMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "E " 10 $cmd [subst $name]ctfInfo(Elastic) [subst $name]ctfInfo(dElastic) -width 6
- CommandEntryWithUpDown $ff.shift "E Shift" 10 $cmd [subst $name]ctfInfo(ElaShift) [subst $name]ctfInfo(dElaShift) -width 6
- CommandEntryWithUpDown $ff.width "E Width" 10 $cmd [subst $name]ctfInfo(ElaWidth) [subst $name]ctfInfo(dElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "E Ring " 10 $cmd [subst $name]ctfInfo(ElaRing) [subst $name]ctfInfo(dElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "E RShift" 10 $cmd [subst $name]ctfInfo(ElaRShift) [subst $name]ctfInfo(dElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "E RWidth" 10 $cmd [subst $name]ctfInfo(ElaRWidth) [subst $name]ctfInfo(dElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.molcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- # Inelastic
- set ff [ frame $f.inelamolec ]
- checkbutton $ff.use -text "With Inelastic" -variable [subst $name]ctfInfo(flagInElastic) -command $cmd
- RadioButtonsCreateWithPackWithCommand $ff.which Inelastic $cmd left [subst $name]ctfInfo(whichInElaMolec) No Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "IE Gauss B" 10 $cmd [subst $name]ctfInfo(InElaMolcEnv) [subst $name]ctfInfo(dInElaMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "IE " 10 $cmd [subst $name]ctfInfo(InElastic) [subst $name]ctfInfo(dInElastic) -width 6
- CommandEntryWithUpDown $ff.shift "IE Shift" 10 $cmd [subst $name]ctfInfo(InElaShift) [subst $name]ctfInfo(dInElaShift) -width 6
- CommandEntryWithUpDown $ff.width "IE Width" 10 $cmd [subst $name]ctfInfo(InElaWidth) [subst $name]ctfInfo(dInElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "IE Ring " 10 $cmd [subst $name]ctfInfo(InElaRing) [subst $name]ctfInfo(dInElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "IE RShift" 10 $cmd [subst $name]ctfInfo(InElaRShift) [subst $name]ctfInfo(dInElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "IE RWidth" 10 $cmd [subst $name]ctfInfo(InElaRWidth) [subst $name]ctfInfo(dInElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.inElaMolcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- set ff [ frame $f.calc ]
- button $ff.draw -text Draw -command $cmd
- button $ff.initS -text InitSearch -command [subst $name]ctfInitSearch
- button $ff.fineT -text FineTune -command [subst $name]ctfFineTuning
- pack $ff.draw $ff.initS $ff.fineT -side left -expand true
-
- pack \
- $f.title \
- $f.main \
- $f.mtf \
- $f.molec \
- $f.inelamolec \
- $f.calc \
- -side top -expand true
-
- return $f
-}
-
-proc ctfInitSearch { } {
- variable ctfInfo
-
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 1"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 0
- ctfInfoLoad
-}
-
-proc ctfFineTuning { } {
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16
- ctfInfoLoad
-}
-
-#
-# CTF Information
-#
-proc ctfInfoCTFInfoFrameCreate2 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- frame $f
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- CommandEntry $f.i "I(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(I)" -width 6
- CommandEntry $f.sN "SN(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN)" -width 6
- CommandEntry $f.sN2 "SN2(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN2)" -width 6
- CommandEntry $f.cs "Cs mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cs)" -width 6
- CommandEntry $f.kV "kV kV " 10 $cmd -textvar "[subst $name]ctfInfo(kV)" -width 6
- CommandEntry $f.ai "Ai mrad " 10 $cmd -textvar "[subst $name]ctfInfo(Ai)" -width 6
- CommandEntry $f.cc "Cc mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cc)" -width 6
- CommandEntry $f.dkV "dV eV " 10 $cmd -textvar "[subst $name]ctfInfo(dV)" -width 6
- CommandEntry $f.vib "Vibration " 10 $cmd -textvar "[subst $name]ctfInfo(BofVibration)" -width 6
- CommandEntry $f.vibMode "Vib-mode " 10 $cmd -textvar "[subst $name]ctfInfo(VibrationMode)" -width 6
- checkbutton $f.aliasing -text "Aliasing" -variable [subst $name]ctfInfo(flagAliasing) -command $cmd
- checkbutton $f.sampling -text "Sampling" -variable [subst $name]ctfInfo(flagSampling) -command $cmd
- CommandEntry $f.nyquist "Nyquist " 10 $cmd -textvar "[subst $name]ctfInfo(NyquistFrequency)" -width 6
-
- pack \
- $f.i \
- $f.sN \
- $f.sN2 \
- $f.cs \
- $f.kV \
- $f.ai \
- $f.cc \
- $f.dkV \
- $f.vib \
- $f.vibMode \
- $f.aliasing \
- $f.sampling \
- $f.nyquist \
- -side top -expand true
- return $f
-}
-
-#
-# ctfInfoMarker: Thon Ring Line
-# Movable marker for thonRingDetermine
-#
-
-# Marker Set
-proc ctfInfoMarkerSet { } {
- variable ctfInfo
-
- ctfInfoMarkerUnset
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- $ctfInfo(graph) marker create line -name zero$i \
- -coords { $ctfInfo(zero$i) 0 \
- $ctfInfo(zero$i) 1 }
- $ctfInfo(graph) marker configure zero$i -dashes { 2 2 }
- }
-}
-
-# Marker Unset
-proc ctfInfoMarkerUnset { } {
- variable ctfInfo
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete zero$i }
- }
-}
-
-#
-# Thon Ring Information
-# Predicted Marker Set for Graph
-#
-proc ctfInfoPredictedThonRing { } {
- variable ctfInfo
-
- set size [ llength $ctfInfo(R) ]
- set dR [ expr [lindex $ctfInfo(R) 1]-[lindex $ctfInfo(R) 0]]
- set RMax [ lindex $ctfInfo(R) [expr $size-1] ]
- set Zero [ ctfInfoGet Zero $RMax $ctfInfo(predictZeroMaxMax) $dR ]
- set ctfInfo(predictZeroMax) [ expr [ llength $Zero ] / 3 ]
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ctfInfo(predictZero$i) [ lindex $Zero [ expr 3*$i ] ]
- set ctfInfo(predictZeroCTF$i) [ expr 0.8*$ctfInfo(Imax) ]
- set data [ lindex $Zero [ expr 3*$i + 1 ] ]
- set data1 [ lindex $Zero [ expr 3*$i + 2 ] ]
- if { $ctfInfo(flagCTFPower) == 1 } {
- set ctfInfo(predictZeroCTF$i) [ expr $data*$data + $data1*$data1 ]
- } else {
- set ctfInfo(predictZeroCTF$i) [ expr $data + $data1 ]
- }
- }
- set ctfInfo(flagpredictThonRing) 1
-}
-
-#
-# PredictedMarker of ThonRing on canvas
-#
-proc ctfInfoPredictedMarkerOnCanvas { } {
- variable ctfInfo
-
- if [ info exists ctfInfo(mrc) ] {
- array set mainImage $ctfInfo(mrc)
- if [ info exists mainImage(mainCanvas) ] {
- puts $mainImage(mainCanvas)
- #$mainImage(mainCanvas) create oval 0 0 10 10
- .main_canvas create oval 0 0 10 10
- } else {
- puts "No canvas to draw Thon rings: in ctfInfoCTFLineCreate"
- }
- } else {
- puts "No mrc Setting"
- }
-}
-
-#
-# PredictedMarker of ThonRing on graph
-#
-proc ctfInfoPredictedMarkerSet { } {
- variable ctfInfo
-
- # Zero Point
- ctfInfoPredictedThonRing
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ymax [ expr 1.2*$ctfInfo(predictZeroCTF$i) ]
- $ctfInfo(graph) marker create line -name predictZero$i -coords {
- $ctfInfo(predictZero$i) 0 \
- $ctfInfo(predictZero$i) $ymax }
- #$ctfInfo(graph) marker configure predictZero$i -foreground black
- }
- set ctfInfo(flagpredictZero) 1
-}
-
-#
-proc ctfInfoPredictedMarkerUnset { } {
- variable ctfInfo
- if { $ctfInfo(flagpredictZero) == 1 } {
- for { set i 1 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete predictZero$i }
- }
- }
- set ctfInfo(flagpredictZero) 0
-}
-#
-proc ctfInfoMarkerReset { } {
- variable ctfInfo
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- if [ info exists ctfInfo(predictZero$i) ] {
- set ctfInfo(zero$i) $ctfInfo(predictZero$i)
- } else {
- puts "ctfInfo(zeroMax) is wrong at $i: $ctfInfo(zeroMax)"
- break
- }
- }
- ctfInfoMarkerSet
-}
-
-
-#
-# Graph Update
-#
-
-proc ctfInfoGraphUpdate { } {
- variable ctfInfo
-
- ctfInfoGraphConfiguration
- if { $ctfInfo(flagScatGraph) == 1 } {
- ctfInfoScatteringLineCreate Scattering $ctfInfo(graph) ctfInfo(R) ctfInfo(Scattering)
- } else {
- catch { $ctfInfo(graph) element delete Scattering }
- }
- if { $ctfInfo(flagScatGraphSubtraction) == 1 } {
- catch { ctfInfoScatteringLineCreate ScatteringSubtraction $ctfInfo(graph) ctfInfo(R) ctfInfo(ScatteringSubtraction) }
- } else {
- catch { $ctfInfo(graph) element delete ScatteringSubtraction }
- }
- ctfInfoCTFLineCreate $ctfInfo(graph)
-}
-
-#
-# ctfInfoScatteringLineCreate
-# Scattering Data Plotting
-#
-proc ctfInfoScatteringLineCreate { name g x y } {
- upvar $x xx
- upvar $y yy
- # Drawing Graph (Scattering)
- catch { $g element delete $name }
- $g element create $name -xdata $xx -ydata $yy
- $g element configure $name -pen scatPen
-}
-
-#
-# ctfInfoCTFLineCreate
-# CTF Graph Create
-# Elements:
-# CTF
-# CTFcore
-# Noise
-#
-proc ctfInfoCTFLineCreate { g } {
- variable ctfInfo
-
- # CTF Calc
- ctfInfoCTFCalculation
-
- # Graph Delete
- catch { $g element delete CTF }
- catch { $g element delete CTFcore }
- catch { $g element delete Noise }
-
- # Markder Unset
- ctfInfoPredictedMarkerUnset
-
- # Signal + Noise
- if { $ctfInfo(flagCTFGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) == 1 } {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTFPower)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoisePower)
- } else {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTF)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoise)
- }
- $g element configure CTF -pen ctfPen
- $g element configure Noise -pen ctfPen
-
- ctfInfoPredictedMarkerSet
- }
-
- # Signal Only
- if { $ctfInfo(flagCTFcoreGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) } {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignalPower)
- } else {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignal)
- }
- $g element configure CTFcore -pen ctfPen
- }
- if { $ctfInfo(flagThonRingOnCanvas) == 1 } {
- ctfInfoPredictedMarkerOnCanvas
- }
-
- # Configuration
- ctfInfoGraphConfiguration
-}
-
-#
-# ctfInfoGraphConfiguration
-# Axis, Title, Logscale etc.
-#
-proc ctfInfoGraphConfiguration { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
-
- $g configure -title "CTF($ctfInfo(filename))"
- $g axis configure x -title "R" -loose yes -max $ctfInfo(Rmax) -hide no
- $g axis configure y -title "Intensity" -loose yes -max $ctfInfo(Imax) -hide no
- $g legend configure -position top -hide no
- $g axis configure x -max $ctfInfo(Rmax)
- $g axis configure x -min $ctfInfo(Rmin)
- $g axis configure y -max $ctfInfo(Imax)
- $g axis configure y -min $ctfInfo(Imin)
- if { $ctfInfo(flagLogScale) == 1 } {
- if { $ctfInfo(Imin) <= 0 } {
- set ctfInfo(Imin) [ expr $ctfInfo(Imax)*1e-6 ]
- }
- $g axis configure y -logscale yes
- } else {
- $g axis configure y -logscale no
- }
- ctfInfoGraphPenCreate
-
- Blt_ZoomStack $g
- Blt_Crosshairs $g
- Blt_ActiveLegend $g
- Blt_ClosestPoint $g
-}
-
-# Pen Information
-#
-proc ctfInfoGraphPenCreate { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
- catch { $g pen create scatPen }
- $g pen configure scatPen -pixels 0 -color blue
- catch { $g pen create ctfPen }
- $g pen configure ctfPen -pixels 0 -color red
-}
-
-#
-# ctfInfoCTFInfomationSet
-#
-proc ctfInfoCTFInfomationSet { } {
- variable ctfInfo
-
- # set
- set ctfInfo(I) $ctfInfo(Isignal)
- set ctfInfo(SN) [ expr double($ctfInfo(Inoise))/double($ctfInfo(Isignal))]
- set ctfInfo(SN2) [ expr double($ctfInfo(Inoise2))/double($ctfInfo(Isignal))]
-
- #
- set size [ llength $ctfInfo(R) ]
- ctfInfoSet kV $ctfInfo(kV)
- ctfInfoSet defocus $ctfInfo(defocus)
- ctfInfoSet Cc $ctfInfo(Cc)
- ctfInfoSet dE $ctfInfo(dV)
- ctfInfoSet Cs $ctfInfo(Cs)
- ctfInfoSet Ai $ctfInfo(Ai)
- ctfInfoSet I $ctfInfo(I)
- ctfInfoSet Mag $ctfInfo(Magnification)
- ctfInfoSet AoverP $ctfInfo(AoverP)
- ctfInfoSet Mode [ expr 1 + 32 + 64 ]
- switch -exact -- $ctfInfo(whichMTF) {
- singleExp {
- ctfInfoSet MTFMode 0
- }
- Lorentz {
- ctfInfoSet MTFMode 1
- }
- BothMul {
- ctfInfoSet MTFMode 2
- }
- Linear {
- ctfInfoSet MTFMode 3
- }
- BothSum {
- ctfInfoSet MTFMode 4
- }
- Polynomial {
- ctfInfoSet MTFMode 5
- }
- default {
- puts "Not supported MTF mode: $ctfInfo(whichMTF)"
- }
- }
- ctfInfoSet MTF $ctfInfo(MTF)
- ctfInfoSet MTF2 $ctfInfo(MTF2)
- ctfInfoSet MTF2Weight $ctfInfo(MTF2Weight)
- ctfInfoSet Noise $ctfInfo(SN)
- ctfInfoSet Noise2 $ctfInfo(SN2)
- ctfInfoSet R $size $ctfInfo(R)
- ctfInfoSet VibrationMode $ctfInfo(VibrationMode)
- ctfInfoSet BofVibration $ctfInfo(BofVibration)
- ctfInfoSet flagVibration $ctfInfo(flagVibration)
- ctfInfoSet Aliasing $ctfInfo(flagAliasing) $ctfInfo(NyquistFrequency)
- ctfInfoSet Sampling $ctfInfo(flagSampling) $ctfInfo(NyquistFrequency)
- ctfInfoSet MTFd2 $ctfInfo(MTFd2)
- ctfInfoSet MTFd3 $ctfInfo(MTFd3)
- ctfInfoSet MTFd4 $ctfInfo(MTFd4)
- ctfInfoSet MTFd5 $ctfInfo(MTFd5)
- ctfInfoSet MTFd6 $ctfInfo(MTFd6)
-
- #
- ctfInfoMolecEnvSet
-}
-
-#
-# ctfInfoCTFCalculation
-#
-proc ctfInfoCTFCalculation { } {
- variable ctfInfo
-
- #
- #puts "ctfInfoCTFCalculation: Power: $ctfInfo(flagCTFPower)"
-
- # Information Set
- ctfInfoCTFInfomationSet
-
- # Data Unset
- catch { unset ctfInfo(CTF) }
- catch { unset ctfInfo(CTFPower) }
- catch { unset ctfInfo(CTFcore) }
- catch { unset ctfInfo(CTFcorePower) }
- catch { unset ctfInfo(CTFNoise) }
- catch { unset ctfInfo(CTFNoisePower) }
- catch { unset ctfInfo(CTFSignal) }
- catch { unset ctfInfo(CTFSignalPower) }
- catch { unset ctfInfo(ScatteringSubtraction) }
-
- # Data Set
- set size [ llength $ctfInfo(R) ]
- if { $ctfInfo(flagCTFPower) } {
- set ctfInfo(CTFPower) [ ctfInfoCalc CTFPower ]
- set ctfInfo(CTFcorePower) [ ctfInfoCalc CTFcorePower ]
- set ctfInfo(CTFNoisePower) [ ctfInfoCalc CTFNoisePower ]
- set ctfInfo(CTFSignalPower) [ ctfInfoCalc CTFSignalPower ]
- } else {
- set ctfInfo(CTF) [ ctfInfoCalc CTF ]
- set ctfInfo(CTFcore) [ ctfInfoCalc CTFcore ]
- set ctfInfo(CTFNoise) [ ctfInfoCalc CTFNoise ]
- set ctfInfo(CTFSignal) [ ctfInfoCalc CTFSignal ]
- }
- for { set i 0 } { $i < $size } { incr i } {
- set data [ lindex $ctfInfo(Scattering) $i ]
- if { $ctfInfo(flagCTFPower) } {
- set noise [ lindex $ctfInfo(CTFNoisePower) $i ]
- } else {
- set noise [ lindex $ctfInfo(CTFNoise) $i ]
- }
- lappend ctfInfo(ScatteringSubtraction) [ expr $data - $noise ]
- }
-}
-
-#
-# Scattering Data
-#
-proc ctfInfoScatteringCalc { { filename __null__ } } {
- variable ctfInfo
-
- #puts "ctfInfoScatteringCalc"
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- } else {
- puts "no file for Scattring calc."
- return
- }
- }
- set xy [ mrcInfoGet $filename Spectrum2 ]
-
- catch { unset ctfInfo(R) }
- catch { unset ctfInfo(Scattering) }
- catch { unset ctfInfo(ScatteringRoot) }
-
- foreach { x y } $xy {
- lappend ctfInfo(R) $x
- lappend ctfInfo(Scattering) $y
- lappend ctfInfo(ScatteringRoot) [ expr sqrt($y)]
- }
- set ctfInfo(NyquistFrequency) [ lindex $ctfInfo(R) end ]
-}
-
-#end of CTF namespace
-}
-
+++ /dev/null
-#
-#
-# ctfInfo
-# namespace eval CTF
-#
-namespace eval CTF {
- variable ctfInfo
- namespace export ctfInfoLoad ctfInfoSave ctfInfoSaveAsPS ctfInfoGraphUpdate
-
-proc Init { { mrc __null__ } } {
- variable ctfInfo
-
- #puts "Init"
- # mrcImage Information Check: set ctfInfo(mrc) $mrc
- set ctfInfo(DEBUGCOMMENT) "DEBUG"
- if { $mrc != "__null__" } {
- # New Object
- array set mrcImage $mrc
- puts "name: $mrcImage(filename)"
- if [ info exists mrcImage(filename) ] {
- # Set New mrcImage
- set filename $mrcImage(filename)
- set ctfInfo(mrc) $mrc
- } else { # mrc is a new filename
- # Set New file
- set filename $mrc
- catch { unset ctfInfo(mrc) }
- }
- } else {
- # No setting
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- # puts "Already FileName"
- } elseif [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- set filename $mrcImage(filename)
- } else { # mrc is filename
- set filename $mrc
- }
- }
-
- if [ info exists ctfInfo(filename) ] {
- if { $ctfInfo(filename) != $filename } {
- set ctfInfo(flagInit) 0
- } else {
- set ctfInfo(flagInit) 1
- }
- } else {
- set ctfInfo(flagInit) 0
- }
-
- if { $ctfInfo(flagInit) == 1 } {
- return
- } else {
- set ctfInfo(filename) $filename
- }
-
- # Start Initialization
- set ctfInfo(flagInit) 1
-
- # Molecular Envelope for signal
- #Elastic
- set ctfInfo(.defctfinfo) "./.DefCTFInfo"
- set ctfInfo(whichMolec) Gauss
- set ctfInfo(.molcEnvTable) "./carbon.table"
- set ctfInfo(MolcEnv) 8.0
- set ctfInfo(dMolcEnv) 1.0
- set ctfInfo(Elastic) 2.4912
- set ctfInfo(dElastic) 0.0000
- set ctfInfo(ElaShift) 0.0108
- set ctfInfo(dElaShift) 0.0000
- set ctfInfo(ElaWidth) 0.2226
- set ctfInfo(dElaWidth) 0.0100
- set ctfInfo(ElaRing) 1.0000
- set ctfInfo(dElaRing) 0.1000
- set ctfInfo(ElaRShift) 0.2500
- set ctfInfo(dElaRShift) 0.0100
- set ctfInfo(ElaRWidth) 0.1000
- set ctfInfo(dElaRWidth) 0.0100
- #Inelastic
- set ctfInfo(whichInElaMolec) No
- set ctfInfo(.inElaMolcEnvTable) "./carbon.table"
- set ctfInfo(InElaMolcEnv) 8.0
- set ctfInfo(dInElaMolcEnv) 1.0
- set ctfInfo(InElastic) 2.4912
- set ctfInfo(dInElastic) 0.0000
- set ctfInfo(InElaShift) 0.0108
- set ctfInfo(dInElaShift) 0.0000
- set ctfInfo(InElaWidth) 0.2226
- set ctfInfo(dInElaWidth) 0.0100
- set ctfInfo(InElaRing) 1.0000
- set ctfInfo(dInElaRing) 0.1000
- set ctfInfo(InElaRShift) 0.2500
- set ctfInfo(dInElaRShift) 0.0100
- set ctfInfo(InElaRWidth) 0.1000
- set ctfInfo(dInElaRWidth) 0.0100
- #
- #
- #
- set ctfInfo(flagScatGraph) 1
- set ctfInfo(flagScatGraphSubtraction) 0
- set ctfInfo(Imax) 0.001
- set ctfInfo(dImax) 0.0001
- set ctfInfo(Rmax) 0.20
- set ctfInfo(dRmax) 0.01
- set ctfInfo(Imin) 0.00
- set ctfInfo(dImin) 0.0001
- set ctfInfo(Rmin) 0.00
- set ctfInfo(dRmin) 0.01
- #
- #
- #
- set ctfInfo(flagZero) 1
- set ctfInfo(zeroMax) 6
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- set ctfInfo(zero$i) [ expr 0.01*$i ]
- set ctfInfo(dzero$i) 0.01
- }
- set ctfInfo(ThonRingCanvas) 0
-
- set ctfInfo(flagCTFGraph) 1
- set ctfInfo(flagCTFcoreGraph) 0
- set ctfInfo(flagCTFPower) 1
- set ctfInfo(flagLogScale) 0
-
- # Thon Ring Information
- set ctfInfo(flagpredictThonRing) 0
- set ctfInfo(flagpredictZero) 0
- set ctfInfo(flagpredictZeroMax) 1
- set ctfInfo(predictZeroMaxMax) 30
-
- ##
- set ctfInfo(defocus) 500
- set ctfInfo(ddefocus) -100
- set ctfInfo(defocus2D0) 0
- set ctfInfo(ddefocus2D0) -100
- set ctfInfo(defocus2D1) 0
- set ctfInfo(ddefocus2D1) -100
- set ctfInfo(defocus0axis) 0
- set ctfInfo(ddefocus0axis) -10
- set ctfInfo(Cs) 2.1
- set ctfInfo(dCs) 0.1
- set ctfInfo(kV) 200
- set ctfInfo(dkV) 5
- set ctfInfo(AoverP) 0.1
- set ctfInfo(dAoverP) -0.01
- set ctfInfo(Ai) 0.02
- set ctfInfo(dAi) 0.01
- set ctfInfo(Cc) 0.7
- set ctfInfo(dCc) 0.1
- set ctfInfo(dV) 0.7
- set ctfInfo(ddV) 0.1
- set ctfInfo(I) 0.015
- set ctfInfo(dI) 0.002
- set ctfInfo(SN) 0.1
- set ctfInfo(dSN) 0.1
- set ctfInfo(SN2) 0.1
- set ctfInfo(dSN2) 0.1
- set ctfInfo(Isignal) 0.015
- set ctfInfo(dIsignal) 0.002
- set ctfInfo(Inoise) 0.0015
- set ctfInfo(dInoise) 0.0002
- set ctfInfo(Inoise2) 0.0015
- set ctfInfo(dInoise2) 0.0002
- set ctfInfo(whichMTF) singleExp
-
- # MTF
- set ctfInfo(MTF) 38
- set ctfInfo(dMTF) 1
-
- set ctfInfo(MTFd2) 0
- set ctfInfo(dMTFd2) 1
- set ctfInfo(MTFd3) 0
- set ctfInfo(dMTFd3) 1
- set ctfInfo(MTFd4) 0
- set ctfInfo(dMTFd4) 1
- set ctfInfo(MTFd5) 0
- set ctfInfo(dMTFd5) 1
- set ctfInfo(MTFd6) 0
- set ctfInfo(dMTFd6) 1
-
- set ctfInfo(MTF2) 38
- set ctfInfo(dMTF2) 1
- set ctfInfo(MTF2Weight) 0
- set ctfInfo(dMTF2Weight) 0.1
- set ctfInfo(Magnification) 1.0
- set ctfInfo(dMagnification) -0.005
- # Vibration
- set ctfInfo(flagVibration) 1
- set ctfInfo(BofVibration) 4.0
- set ctfInfo(VibrationMode) 0
- # Aliasing
- set ctfInfo(flagAliasing) 1
- set ctfInfo(flagSampling) 0
- set ctfInfo(NyquistFrequency) 1
-
- ## Evaluation of ctfInfo
- set ctfInfo(flagEvaluation) 0
- set ctfInfo(EvalMinMaxMethod) NULL
- # Canvas
- set ctfInfo(flagThonRingOnCanvas) 0
-
- set ctfInfo(.ctfinfoMode) "Every"
-
- ### Input Graph Data
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(mrc) ] {
- array set mrcImage $ctfInfo(mrc)
- if [ info exists mrcImage(filename) ] {
- set ctfInfo(filename) $mrcImage(filename)
- }
- }
- if [ info exists ctfInfo(filename) ] {
- puts "ANYWAY, move but strange"
- } else {
- puts "No CTFInfo File"
- flush stdout
- return
- }
- } else {
- set ctfInfo(filename) $filename
- }
- if [ file exists $ctfInfo(filename) ] {
-
- } else {
- puts "mrc file not found: Please check; $filename"
- }
-
- ### Input Default Data
- if [ string match ".fft" [ file extension $ctfInfo(filename) ] ] {
- set ctfInfo(.ctfps) [ file rootname $ctfInfo(filename) ].ctfps
- set ctfInfo(.ctfinfo) [ file rootname $ctfInfo(filename) ].ctfinfo
- } else {
- set ctfInfo(.ctfps) $ctfInfo(filename).ctfps
- set ctfInfo(.ctfinfo) $ctfInfo(filename).ctfinfo
- }
- set ctfInfo(.ctfinfoMode) "Every"
- #puts "ctfinfoMode: $ctfInfo(.ctfinfoMode) "
-
- if [ file exists $ctfInfo(.ctfinfo) ] {
- ctfInfoLoad
- } elseif [ file exists $ctfInfo(.defctfinfo) ] {
- ctfInfoLoad $ctfInfo(.defctfinfo)
- }
-
- #
- # Data Taking (Scattering)
- #
- ctfInfoScatteringCalc
-
- #puts "InitEnd"
-}
-
-#
-# CTF Program
-#
-proc Win { { win .ctfInfo } { filename __null__ } { extension 2 } } {
- variable ctfInfo
-
- ### Initialization
- Init
-
- if [ catch { toplevel $win -bd 4 -class CTFInfo } ] {
- raise $win
- } else {
- ### Create New Window
- set w $win
- #
- # Graph Frame
- #
- set f [ frame $w.graph ]
- # Frame for Graph
- set ctfInfo(graph) [ graph $f.graph ]
- ctfInfoGraphInfoFrameCreate $f.info top
- pack $f.graph $f.info -side left -expand true -fill both
-
- # Graph Update
- ctfInfoGraphUpdate
-
- pack $w.graph -side left -expand true -fill both
-
- }
-
- if [ catch { toplevel $win$extension -bd 4 -class CTFInfo } ] { # Window Create
- raise $win$extension
- } else {
- ### Create New Window
- set w $win$extension
-
- # ctfInfo Frame
- ctfInfoCTFInfoFrameCreate $w.ctf left
- #
- # Packing
- #
- pack $w.ctf -side left -expand true -fill both
-
- }
-
- # Marker : Thon Ring
- ctfInfoPredictedMarkerSet
- ctfInfoMarkerReset
-}
-
-#
-# GraphInfo Frame
-#
-proc ctfInfoGraphInfoFrameCreate { f side } {
- frame $f
-
- ctfInfoGraphInfoFrameCreate1 $f.f1
- ctfInfoGraphInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side -expand true -fill both
- return $f
-}
-
-#
-# Related to scattering frame
-#
-proc ctfInfoGraphInfoFrameCreate1 { f } {
- variable ctfInfo
-
- frame $f
- # Scattering Information: Scattering/SubtractScattering
- set cmd "[ namespace code {ctfInfoGraphUpdate} ]"
- set name [ namespace current ]::
-
- #
- set ff [ frame $f.graph ]
- checkbutton $ff.graph -text "Scattering" -variable [subst $name]ctfInfo(flagScatGraph) -command $cmd
- checkbutton $ff.graphsub -text "Subtract" -variable [subst $name]ctfInfo(flagScatGraphSubtraction) -command $cmd
- checkbutton $ff.log -text "Log" -variable [subst $name]ctfInfo(flagLogScale) -command $cmd
- pack $ff.graph $ff.graphsub $ff.log -side left
-
- # Scattering Graph Configure
- set ff [ frame $f.graphConfig ]
- CommandEntryWithUpDown $ff.intensity Imax 4 $cmd [subst $name]ctfInfo(Imax) [subst $name]ctfInfo(dImax) -width 10
- CommandEntryWithUpDown $ff.imin Imin 4 $cmd [subst $name]ctfInfo(Imin) [subst $name]ctfInfo(dImin) -width 10
- CommandEntryWithUpDown $ff.brmax Rmax 4 $cmd [subst $name]ctfInfo(Rmax) [subst $name]ctfInfo(dRmax) -width 10
- CommandEntryWithUpDown $ff.brmin Rmin 4 $cmd [subst $name]ctfInfo(Rmin) [subst $name]ctfInfo(dRmin) -width 10
- pack $ff.intensity $ff.imin $ff.brmax $ff.brmin -side top
-
- #
- # File Frame
- #
- set ff [ frame $f.file ]
-
- #PS
- set fff [ frame $ff.printPS ]
- button $fff.printPS -text "Save" -command "[subst $name]ctfInfoSaveAsPS"
- CommandEntry $fff.printPSEntry Graph 5 "[subst $name]ctfInfoSaveAsPS" -textvar [subst $name]ctfInfo(.ctfps)
- pack $fff.printPS $fff.printPSEntry -side left
-
- # Info
- set fff [ frame $ff.printInfo ]
- button $fff.printInfo -text "Save" -command "[subst $name]ctfInfoSave"
- CommandEntry $fff.printInfoEntry Info 5 "[subst $name]ctfInfoSave" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.printInfo $fff.printInfoEntry -side left
-
- # InfoLoad
- set fff [ frame $ff.loadInfo ]
- button $fff.loadInfo -text "Load" -command "[subst $name]ctfInfoLoad"
- CommandEntry $fff.loadInfoEntry Info 5 "[subst $name]ctfInfoLoad" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.loadInfo $fff.loadInfoEntry -side left
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
-
- # Packing
- pack \
- $f.graph \
- $f.graphConfig \
- $f.file \
- -side top -expand true
- return $f
-}
-
-#
-# Thon Ring on canvas
-# Incomplete procedure
-#
-proc ctfInfoGraphInfoFrameCreate2 { f } {
- variable ctfInfo
-
- frame $f
-
- # Thon Ring
- set cmd ctfInfoMarkerSet
- checkbutton $f.zero -text "Thon Ring (zero)" -variable ctfInfo(flagZero) -command $cmd
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- CommandEntryWithUpDown $f.zero$i $i 4 $cmd ctfInfo(zero$i) ctfInfo(dzero$i) -width 6
- }
- button $f.zeroReset -text Reset -command ctfInfoMarkerReset
-
- pack $f.zero -side top -expand true
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- pack $f.zero$i -side top -expand true
- }
- pack $f.zeroReset -side top -expand true
-
- return $f
-}
-
-#
-# Graph Save as a PS file
-#
-proc ctfInfoSaveAsPS { } {
- variable ctfInfo
-
- #puts $ctfInfo(.ctfps)
- $ctfInfo(graph) postscript output $ctfInfo(.ctfps) -center false
-}
-
-#
-# ctfInfoFile
-#
-# Save
-#
-proc ctfInfoSave { { filename __null__ } } {
- variable ctfInfo
-
- if { $filename != "__null__" } {
- set ctfInfo(.ctfinfo) $filename
- }
- #puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) a 0600 ]
-
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- foreach { name value } [ array get ctfInfo ] {
- if { $name == "filename" || $name=="mrc" || $name=="" } {
-
- } else {
- puts -nonewline $fpt "$name:"
- foreach v $value {
- if [ string is double $v ] {
- puts -nonewline $fpt [ format " %g" $v ]
- } else {
- puts -nonewline $fpt [ format " %s" $v ]
- }
- }
- puts -nonewline $fpt [ format "\n" ]
- }
- }
- }
- Main {
- puts $fpt "defocus: $ctfInfo(defocus)"
- puts $fpt "defocus2D0: $ctfInfo(defocus2D0)"
- puts $fpt "defocus2D1: $ctfInfo(defocus2D1)"
- puts $fpt "defocus0axis: $ctfInfo(defocus0axis)"
- puts $fpt "AoverP: $ctfInfo(AoverP)"
- puts $fpt "kV: $ctfInfo(kV)"
- puts $fpt "Cs: $ctfInfo(Cs)"
- puts $fpt "Cc: $ctfInfo(Cc)"
- puts $fpt "Ai: $ctfInfo(Ai)"
- puts $fpt "I: $ctfInfo(I)"
- puts $fpt "SN: $ctfInfo(SN)"
- puts $fpt "SN2: $ctfInfo(SN2)"
- puts $fpt "Isignal: $ctfInfo(Isignal)"
- puts $fpt "Inoise: $ctfInfo(Inoise)"
- puts $fpt "Inoise2: $ctfInfo(Inoise2)"
- puts $fpt "whichMTF: $ctfInfo(whichMTF)"
- puts $fpt "MTF: $ctfInfo(MTF)"
- puts $fpt "MTF2: $ctfInfo(MTF2)"
- puts $fpt "MTF2Weight: $ctfInfo(MTF2Weight)"
- puts $fpt "MolcEnv: $ctfInfo(MolcEnv)"
- puts $fpt "Magnification: $ctfInfo(Magnification)"
- puts $fpt "flagCTFPower: $ctfInfo(flagCTFPower)"
- puts $fpt "BofVibration: $ctfInfo(BofVibration)"
- puts $fpt "flagVibration: $ctfInfo(flagVibration)"
- puts $fpt "VibrationMode: $ctfInfo(VibrationMode)"
- puts $fpt "Imax: $ctfInfo(Imax)"
- puts $fpt "Imin: $ctfInfo(Imin)"
- puts $fpt "Rmax: $ctfInfo(Rmax)"
- puts $fpt "Rmin: $ctfInfo(Rmin)"
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
-}
-
-#
-# ctfInfoFile
-#
-# Load
-#
-proc ctfInfoLoad { { filename __null__ } } {
- variable ctfInfo
-
- if { $filename != "__null__" } {
- if [ file exists $filename ] {
- puts $filename
- set fpt [ open $filename r ]
- } else {
- puts "No such file: $filename"
- return
- }
- } else {
- if [ info exists ctfInfo ] {
- puts "ctfInfo exists"
- puts $ctfInfo(DEBUGCOMMENT)
- } else {
- puts "ctfInfo does not exist"
- return
- }
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) r ]
- }
-
- while { ! [ eof $fpt ] } {
- gets $fpt s
- set slist [ split $s ":" ]
- set name [ string trim [ lindex $slist 0 ] ]
- set value [ string trim [ lindex $slist 1 ] ]
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- if { $name == "filename" || $name=="mrc"} {
- #
- } else {
- set ctfInfo($name) $value
- }
- }
- Main {
- if {
- $name == "defocus"
- || $name == "defocus2D0"
- || $name == "defocus2D1"
- || $name == "defocus0axis"
- || $name == "AoverP"
- || $name == "kV"
- || $name == "Cs"
- || $name == "Cc"
- || $name == "Ai"
- || $name == "I"
- || $name == "SN"
- || $name == "SN2"
- || $name == "Isignal"
- || $name == "Inoise"
- || $name == "Inoise2"
- || $name == "whichMTF"
- || $name == "MTF"
- || $name == "MTF2"
- || $name == "MTF2Weight"
- || $name == "MolcEnv"
- || $name == "Magnification"
- || $name == "flagCTFPower"
- || $name == "BofVibration"
- || $name == "Vibration"
- || $name == "VibrationMode"
- || $name == "Imax"
- || $name == "Imin"
- || $name == "Imax"
- || $name == "Rmin"
- || $name == "MTFd2"
- || $name == "MTFd3"
- || $name == "MTFd4"
- || $name == "MTFd5"
- || $name == "MTFd6"} {
- set ctfInfo($name) $value
- }
- }
- }
- }
- if [ info exists fpt ] {
- close $fpt
- }
- if [ info exists ctfInfo(graph) ] {
- if [ info exists $ctfInfo(graph) ] {
- ctfInfoGraphUpdate
- }
- }
- if [ info exists ctfInfo(defocus) ] {
- if { $ctfInfo(defocus2D0) == 0 && $ctfInfo(defocus2D1)==0 && $ctfInfo(defocus0axis)==0 } {
- set ctfInfo(defocus2D0) $ctfInfo(defocus)
- set ctfInfo(defocus2D1) $ctfInfo(defocus)
- }
- }
-}
-#
-#
-#
-proc ctfInfoMolecEnvSet { } {
- variable ctfInfo
-
- # Elastic
- switch $ctfInfo(whichMolec) {
- Gauss {
- ctfInfoSet MolecEnv $ctfInfo(MolcEnv)
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet Elastic 1 $ctfInfo(Elastic) $ctfInfo(ElaShift) $ctfInfo(ElaWidth) \
- $ctfInfo(ElaRing) $ctfInfo(ElaRShift) $ctfInfo(ElaRWidth)
- ctfInfoSet MolecEnvMode 0
- }
- Table {
- ctfInfoSet Elastic 0
- ctfInfoSet MolecEnvTable $ctfInfo(.molcEnvTable)
- ctfInfoSet MolecEnvMode 1
- }
- }
-
- # Inelastic
- switch $ctfInfo(whichInElaMolec) {
- No {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Gauss {
- ctfInfoSet InElasticMode 1
- ctfInfoSet InElaMolecEnv $ctfInfo(InElaMolcEnv)
- ctfInfoSet InElastic 0
- ctfInfoSet InElaMolecEnvMode 0
- }
- Lorentz {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1 $ctfInfo(InElastic) $ctfInfo(InElaShift) $ctfInfo(InElaWidth) \
- $ctfInfo(InElaRing) $ctfInfo(InElaRShift) $ctfInfo(InElaRWidth)
- ctfInfoSet InElaMolecEnvMode 0
- }
- Table {
- ctfInfoSet InElasticMode 0
- ctfInfoSet InElastic 1
- ctfInfoSet InElaMolecEnvTable $ctfInfo(.inElaMolcEnvTable)
- ctfInfoSet InElaMolecEnvMode 1
- }
- }
-}
-
-#
-#
-#
-proc ctfInfoCTFInfoFrameCreate { f side } {
- # Frame for ctfInfo
- frame $f
-
- ctfInfoCTFInfoFrameCreate1 $f.f1
- ctfInfoCTFInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side $side
- return $f
-}
-
-proc ctfInfoCTFInfoFrameCreate1 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- frame $f
-
- # Which CTF Plot
- set ff [ frame $f.title ]
- checkbutton $ff.main -text "CTF Params" -variable [subst $name]ctfInfo(flagCTFGraph) -command $cmd
- checkbutton $ff.sub -text "Core" -variable [subst $name]ctfInfo(flagCTFcoreGraph) -command $cmd
- checkbutton $ff.power -text "Power" -variable [subst $name]ctfInfo(flagCTFPower) -command $cmd
- pack $ff.main $ff.sub $ff.power -side left -expand true
-
- # Main Parameters
- set ff [ frame $f.main ]
- CommandEntryWithUpDown $ff.defocus "defocus A " 10 $cmd [subst $name]ctfInfo(defocus) [subst $name]ctfInfo(ddefocus) -width 6
- CommandEntryWithUpDown $ff.aoverP "AoverP " 10 $cmd [subst $name]ctfInfo(AoverP) [subst $name]ctfInfo(dAoverP) -width 6
- CommandEntryWithUpDown $ff.is "Isingal " 10 $cmd [subst $name]ctfInfo(Isignal) [subst $name]ctfInfo(dIsignal) -width 6
- CommandEntryWithUpDown $ff.in "Inoise " 10 $cmd [subst $name]ctfInfo(Inoise) [subst $name]ctfInfo(dInoise) -width 6
- CommandEntryWithUpDown $ff.in2 "Inoise2 " 10 $cmd [subst $name]ctfInfo(Inoise2) [subst $name]ctfInfo(dInoise2) -width 6
- CommandEntryWithUpDown $ff.mag "Mag " 10 $cmd [subst $name]ctfInfo(Magnification) [subst $name]ctfInfo(dMagnification) -width 6
- pack $ff.defocus $ff.aoverP $ff.is $ff.in $ff.in2 $ff.mag -side top -expand true
-
- # MTF
- set ff [ frame $f.mtf ]
- RadioButtonsCreateWithPackWithCommand $ff.which MTF $cmd left [subst $name]ctfInfo(whichMTF) singleExp Lorentz BothMul BothSum Linear Polynomial
- CommandEntryWithUpDown $ff.mtf "MTF A " 10 $cmd [subst $name]ctfInfo(MTF) [subst $name]ctfInfo(dMTF) -width 6
- CommandEntryWithUpDown $ff.mtf2 "MTF2 A " 10 $cmd [subst $name]ctfInfo(MTF2) [subst $name]ctfInfo(dMTF2) -width 6
- CommandEntryWithUpDown $ff.mtfw "MTF2Weight" 10 $cmd [subst $name]ctfInfo(MTF2Weight) [subst $name]ctfInfo(dMTF2Weight) -width 6
- pack $ff.which $ff.mtf $ff.mtf2 $ff.mtfw -side top
-
- set ff [ frame $f.pol ]
- CommandEntryWithUpDown $ff.mtfd2 "MTF A d2" 10 $cmd [subst $name]ctfInfo(MTFd2) [subst $name]ctfInfo(dMTFd2) -width 6
- CommandEntryWithUpDown $ff.mtfd3 "MTF A d3" 10 $cmd [subst $name]ctfInfo(MTFd3) [subst $name]ctfInfo(dMTFd3) -width 6
- CommandEntryWithUpDown $ff.mtfd4 "MTF A d4" 10 $cmd [subst $name]ctfInfo(MTFd4) [subst $name]ctfInfo(dMTFd4) -width 6
- CommandEntryWithUpDown $ff.mtfd5 "MTF A d5" 10 $cmd [subst $name]ctfInfo(MTFd5) [subst $name]ctfInfo(dMTFd5) -width 6
- CommandEntryWithUpDown $ff.mtfd6 "MTF A d6" 10 $cmd [subst $name]ctfInfo(MTFd6) [subst $name]ctfInfo(dMTFd6) -width 6
- pack $ff.mtfd2 $ff.mtfd3 $ff.mtfd4 $ff.mtfd5 $ff.mtfd6 -side top
-
- # Elastic Scattering
- set ff [ frame $f.molec ]
- RadioButtonsCreateWithPackWithCommand $ff.which Elastic $cmd left [subst $name]ctfInfo(whichMolec) Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "GaussB A" 10 $cmd [subst $name]ctfInfo(MolcEnv) [subst $name]ctfInfo(dMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "E " 10 $cmd [subst $name]ctfInfo(Elastic) [subst $name]ctfInfo(dElastic) -width 6
- CommandEntryWithUpDown $ff.shift "E Shift" 10 $cmd [subst $name]ctfInfo(ElaShift) [subst $name]ctfInfo(dElaShift) -width 6
- CommandEntryWithUpDown $ff.width "E Width" 10 $cmd [subst $name]ctfInfo(ElaWidth) [subst $name]ctfInfo(dElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "E Ring " 10 $cmd [subst $name]ctfInfo(ElaRing) [subst $name]ctfInfo(dElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "E RShift" 10 $cmd [subst $name]ctfInfo(ElaRShift) [subst $name]ctfInfo(dElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "E RWidth" 10 $cmd [subst $name]ctfInfo(ElaRWidth) [subst $name]ctfInfo(dElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.molcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- # Inelastic
- set ff [ frame $f.inelamolec ]
- checkbutton $ff.use -text "With Inelastic" -variable [subst $name]ctfInfo(flagInElastic) -command $cmd
- RadioButtonsCreateWithPackWithCommand $ff.which Inelastic $cmd left [subst $name]ctfInfo(whichInElaMolec) No Gauss Lorentz Table
- # For Gaussian
- CommandEntryWithUpDown $ff.molecEnv "IE Gauss B" 10 $cmd [subst $name]ctfInfo(InElaMolcEnv) [subst $name]ctfInfo(dInElaMolcEnv) -width 6
- # For Lorenztian
- CommandEntryWithUpDown $ff.ratio "IE " 10 $cmd [subst $name]ctfInfo(InElastic) [subst $name]ctfInfo(dInElastic) -width 6
- CommandEntryWithUpDown $ff.shift "IE Shift" 10 $cmd [subst $name]ctfInfo(InElaShift) [subst $name]ctfInfo(dInElaShift) -width 6
- CommandEntryWithUpDown $ff.width "IE Width" 10 $cmd [subst $name]ctfInfo(InElaWidth) [subst $name]ctfInfo(dInElaWidth) -width 6
- CommandEntryWithUpDown $ff.ring "IE Ring " 10 $cmd [subst $name]ctfInfo(InElaRing) [subst $name]ctfInfo(dInElaRing) -width 6
- CommandEntryWithUpDown $ff.ringShift "IE RShift" 10 $cmd [subst $name]ctfInfo(InElaRShift) [subst $name]ctfInfo(dInElaRShift) -width 6
- CommandEntryWithUpDown $ff.ringWidth "IE RWidth" 10 $cmd [subst $name]ctfInfo(InElaRWidth) [subst $name]ctfInfo(dInElaRWidth) -width 6
- # For MolcEnvLoad
- CommandEntry $ff.loadEntry Info 5 $cmd -textvar [subst $name]ctfInfo(.inElaMolcEnvTable)
- pack $ff.which $ff.molecEnv $ff.ratio $ff.shift $ff.width $ff.ring $ff.ringShift $ff.ringWidth $ff.loadEntry -side top
-
- set ff [ frame $f.calc ]
- button $ff.draw -text Draw -command $cmd
- button $ff.initS -text InitSearch -command [subst $name]ctfInitSearch
- button $ff.fineT -text FineTune -command [subst $name]ctfFineTuning
- pack $ff.draw $ff.initS $ff.fineT -side left -expand true
-
- pack \
- $f.title \
- $f.main \
- $f.mtf \
- $f.molec \
- $f.inelamolec \
- $f.calc \
- -side top -expand true
-
- return $f
-}
-
-proc ctfInitSearch { } {
- variable ctfInfo
-
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 1"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 0
- ctfInfoLoad
-}
-
-proc ctfFineTuning { } {
- ctfInfoSave
- puts "ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16"
- exec ctfDetermine -i $ctfInfo(filename) -o $ctfInfo(.ctfinfo) -c $ctfInfo(.ctfinfo) -m 16
- ctfInfoLoad
-}
-
-#
-# CTF Information
-#
-proc ctfInfoCTFInfoFrameCreate2 { f } {
- variable ctfInfo
-
- # Frame for ctfInfo
- frame $f
- set cmd "[ namespace code {ctfInfoGraphUpdate}]"
- set name [ namespace current ]::
-
- CommandEntry $f.i "I(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(I)" -width 6
- CommandEntry $f.sN "SN(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN)" -width 6
- CommandEntry $f.sN2 "SN2(calc) " 10 $cmd -textvar "[subst $name]ctfInfo(SN2)" -width 6
- CommandEntry $f.cs "Cs mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cs)" -width 6
- CommandEntry $f.kV "kV kV " 10 $cmd -textvar "[subst $name]ctfInfo(kV)" -width 6
- CommandEntry $f.ai "Ai mrad " 10 $cmd -textvar "[subst $name]ctfInfo(Ai)" -width 6
- CommandEntry $f.cc "Cc mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cc)" -width 6
- CommandEntry $f.dkV "dV eV " 10 $cmd -textvar "[subst $name]ctfInfo(dV)" -width 6
- CommandEntry $f.vib "Vibration " 10 $cmd -textvar "[subst $name]ctfInfo(BofVibration)" -width 6
- CommandEntry $f.vibMode "Vib-mode " 10 $cmd -textvar "[subst $name]ctfInfo(VibrationMode)" -width 6
- checkbutton $f.aliasing -text "Aliasing" -variable [subst $name]ctfInfo(flagAliasing) -command $cmd
- checkbutton $f.sampling -text "Sampling" -variable [subst $name]ctfInfo(flagSampling) -command $cmd
- CommandEntry $f.nyquist "Nyquist " 10 $cmd -textvar "[subst $name]ctfInfo(NyquistFrequency)" -width 6
-
- pack \
- $f.i \
- $f.sN \
- $f.sN2 \
- $f.cs \
- $f.kV \
- $f.ai \
- $f.cc \
- $f.dkV \
- $f.vib \
- $f.vibMode \
- $f.aliasing \
- $f.sampling \
- $f.nyquist \
- -side top -expand true
- return $f
-}
-
-#
-# ctfInfoMarker: Thon Ring Line
-# Movable marker for thonRingDetermine
-#
-
-# Marker Set
-proc ctfInfoMarkerSet { } {
- variable ctfInfo
-
- ctfInfoMarkerUnset
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- $ctfInfo(graph) marker create line -name zero$i \
- -coords { $ctfInfo(zero$i) 0 \
- $ctfInfo(zero$i) 1 }
- $ctfInfo(graph) marker configure zero$i -dashes { 2 2 }
- }
-}
-
-# Marker Unset
-proc ctfInfoMarkerUnset { } {
- variable ctfInfo
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete zero$i }
- }
-}
-
-#
-# Thon Ring Information
-# Predicted Marker Set for Graph
-#
-proc ctfInfoPredictedThonRing { } {
- variable ctfInfo
-
- set size [ llength $ctfInfo(R) ]
- set dR [ expr [lindex $ctfInfo(R) 1]-[lindex $ctfInfo(R) 0]]
- set RMax [ lindex $ctfInfo(R) [expr $size-1] ]
- set Zero [ ctfInfoGet Zero $RMax $ctfInfo(predictZeroMaxMax) $dR ]
- set ctfInfo(predictZeroMax) [ expr [ llength $Zero ] / 3 ]
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ctfInfo(predictZero$i) [ lindex $Zero [ expr 3*$i ] ]
- set ctfInfo(predictZeroCTF$i) [ expr 0.8*$ctfInfo(Imax) ]
- set data [ lindex $Zero [ expr 3*$i + 1 ] ]
- set data1 [ lindex $Zero [ expr 3*$i + 2 ] ]
- if { $ctfInfo(flagCTFPower) == 1 } {
- set ctfInfo(predictZeroCTF$i) [ expr $data*$data + $data1*$data1 ]
- } else {
- set ctfInfo(predictZeroCTF$i) [ expr $data + $data1 ]
- }
- }
- set ctfInfo(flagpredictThonRing) 1
-}
-
-#
-# PredictedMarker of ThonRing on canvas
-#
-proc ctfInfoPredictedMarkerOnCanvas { } {
- variable ctfInfo
-
- if [ info exists ctfInfo(mrc) ] {
- array set mainImage $ctfInfo(mrc)
- if [ info exists mainImage(mainCanvas) ] {
- puts $mainImage(mainCanvas)
- #$mainImage(mainCanvas) create oval 0 0 10 10
- .main_canvas create oval 0 0 10 10
- } else {
- puts "No canvas to draw Thon rings: in ctfInfoCTFLineCreate"
- }
- } else {
- puts "No mrc Setting"
- }
-}
-
-#
-# PredictedMarker of ThonRing on graph
-#
-proc ctfInfoPredictedMarkerSet { } {
- variable ctfInfo
-
- # Zero Point
- ctfInfoPredictedThonRing
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ymax [ expr 1.2*$ctfInfo(predictZeroCTF$i) ]
- $ctfInfo(graph) marker create line -name predictZero$i -coords {
- $ctfInfo(predictZero$i) 0 \
- $ctfInfo(predictZero$i) $ymax }
- #$ctfInfo(graph) marker configure predictZero$i -foreground black
- }
- set ctfInfo(flagpredictZero) 1
-}
-
-#
-proc ctfInfoPredictedMarkerUnset { } {
- variable ctfInfo
- if { $ctfInfo(flagpredictZero) == 1 } {
- for { set i 1 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- catch { $ctfInfo(graph) marker delete predictZero$i }
- }
- }
- set ctfInfo(flagpredictZero) 0
-}
-#
-proc ctfInfoMarkerReset { } {
- variable ctfInfo
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- if [ info exists ctfInfo(predictZero$i) ] {
- set ctfInfo(zero$i) $ctfInfo(predictZero$i)
- } else {
- puts "ctfInfo(zeroMax) is wrong at $i: $ctfInfo(zeroMax)"
- break
- }
- }
- ctfInfoMarkerSet
-}
-
-
-#
-# Graph Update
-#
-
-proc ctfInfoGraphUpdate { } {
- variable ctfInfo
-
- ctfInfoGraphConfiguration
- if { $ctfInfo(flagScatGraph) == 1 } {
- ctfInfoScatteringLineCreate Scattering $ctfInfo(graph) ctfInfo(R) ctfInfo(Scattering)
- } else {
- catch { $ctfInfo(graph) element delete Scattering }
- }
- if { $ctfInfo(flagScatGraphSubtraction) == 1 } {
- catch { ctfInfoScatteringLineCreate ScatteringSubtraction $ctfInfo(graph) ctfInfo(R) ctfInfo(ScatteringSubtraction) }
- } else {
- catch { $ctfInfo(graph) element delete ScatteringSubtraction }
- }
- ctfInfoCTFLineCreate $ctfInfo(graph)
-}
-
-#
-# ctfInfoScatteringLineCreate
-# Scattering Data Plotting
-#
-proc ctfInfoScatteringLineCreate { name g x y } {
- upvar $x xx
- upvar $y yy
- # Drawing Graph (Scattering)
- catch { $g element delete $name }
- $g element create $name -xdata $xx -ydata $yy
- $g element configure $name -pen scatPen
-}
-
-#
-# ctfInfoCTFLineCreate
-# CTF Graph Create
-# Elements:
-# CTF
-# CTFcore
-# Noise
-#
-proc ctfInfoCTFLineCreate { g } {
- variable ctfInfo
-
- # CTF Calc
- ctfInfoCTFCalculation
-
- # Graph Delete
- catch { $g element delete CTF }
- catch { $g element delete CTFcore }
- catch { $g element delete Noise }
-
- # Markder Unset
- ctfInfoPredictedMarkerUnset
-
- # Signal + Noise
- if { $ctfInfo(flagCTFGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) == 1 } {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTFPower)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoisePower)
- } else {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTF)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoise)
- }
- $g element configure CTF -pen ctfPen
- $g element configure Noise -pen ctfPen
-
- ctfInfoPredictedMarkerSet
- }
-
- # Signal Only
- if { $ctfInfo(flagCTFcoreGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) } {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignalPower)
- } else {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignal)
- }
- $g element configure CTFcore -pen ctfPen
- }
- if { $ctfInfo(flagThonRingOnCanvas) == 1 } {
- ctfInfoPredictedMarkerOnCanvas
- }
-
- # Configuration
- ctfInfoGraphConfiguration
-}
-
-#
-# ctfInfoGraphConfiguration
-# Axis, Title, Logscale etc.
-#
-proc ctfInfoGraphConfiguration { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
-
- $g configure -title "CTF($ctfInfo(filename))"
- $g axis configure x -title "R" -loose yes -max $ctfInfo(Rmax) -hide no
- $g axis configure y -title "Intensity" -loose yes -max $ctfInfo(Imax) -hide no
- $g legend configure -position top -hide no
- $g axis configure x -max $ctfInfo(Rmax)
- $g axis configure x -min $ctfInfo(Rmin)
- $g axis configure y -max $ctfInfo(Imax)
- $g axis configure y -min $ctfInfo(Imin)
- if { $ctfInfo(flagLogScale) == 1 } {
- if { $ctfInfo(Imin) <= 0 } {
- set ctfInfo(Imin) [ expr $ctfInfo(Imax)*1e-6 ]
- }
- $g axis configure y -logscale yes
- } else {
- $g axis configure y -logscale no
- }
- ctfInfoGraphPenCreate
-
- Blt_ZoomStack $g
- Blt_Crosshairs $g
- Blt_ActiveLegend $g
- Blt_ClosestPoint $g
-}
-
-# Pen Information
-#
-proc ctfInfoGraphPenCreate { } {
- variable ctfInfo
-
- set g $ctfInfo(graph)
- catch { $g pen create scatPen }
- $g pen configure scatPen -pixels 0 -color blue
- catch { $g pen create ctfPen }
- $g pen configure ctfPen -pixels 0 -color red
-}
-
-#
-# ctfInfoCTFInfomationSet
-#
-proc ctfInfoCTFInfomationSet { } {
- variable ctfInfo
-
- # set
- set ctfInfo(I) $ctfInfo(Isignal)
- set ctfInfo(SN) [ expr double($ctfInfo(Inoise))/double($ctfInfo(Isignal))]
- set ctfInfo(SN2) [ expr double($ctfInfo(Inoise2))/double($ctfInfo(Isignal))]
-
- #
- set size [ llength $ctfInfo(R) ]
- ctfInfoSet kV $ctfInfo(kV)
- ctfInfoSet defocus $ctfInfo(defocus)
- ctfInfoSet defocus2D0 $ctfInfo(defocus2D0)
- ctfInfoSet defocus2D1 $ctfInfo(defocus2D1)
- ctfInfoSet defocus0axis $ctfInfo(defocus0axis)
- ctfInfoSet Cc $ctfInfo(Cc)
- ctfInfoSet dE $ctfInfo(dV)
- ctfInfoSet Cs $ctfInfo(Cs)
- ctfInfoSet Ai $ctfInfo(Ai)
- ctfInfoSet I $ctfInfo(I)
- ctfInfoSet Mag $ctfInfo(Magnification)
- ctfInfoSet AoverP $ctfInfo(AoverP)
- ctfInfoSet Mode [ expr 1 + 32 + 64 ]
- switch -exact -- $ctfInfo(whichMTF) {
- singleExp {
- ctfInfoSet MTFMode 0
- }
- Lorentz {
- ctfInfoSet MTFMode 1
- }
- BothMul {
- ctfInfoSet MTFMode 2
- }
- Linear {
- ctfInfoSet MTFMode 3
- }
- BothSum {
- ctfInfoSet MTFMode 4
- }
- Polynomial {
- ctfInfoSet MTFMode 5
- }
- default {
- puts "Not supported MTF mode: $ctfInfo(whichMTF)"
- }
- }
- ctfInfoSet MTF $ctfInfo(MTF)
- ctfInfoSet MTF2 $ctfInfo(MTF2)
- ctfInfoSet MTF2Weight $ctfInfo(MTF2Weight)
- ctfInfoSet Noise $ctfInfo(SN)
- ctfInfoSet Noise2 $ctfInfo(SN2)
- ctfInfoSet R $size $ctfInfo(R)
- ctfInfoSet VibrationMode $ctfInfo(VibrationMode)
- ctfInfoSet BofVibration $ctfInfo(BofVibration)
- ctfInfoSet flagVibration $ctfInfo(flagVibration)
- ctfInfoSet Aliasing $ctfInfo(flagAliasing) $ctfInfo(NyquistFrequency)
- ctfInfoSet Sampling $ctfInfo(flagSampling) $ctfInfo(NyquistFrequency)
- ctfInfoSet MTFd2 $ctfInfo(MTFd2)
- ctfInfoSet MTFd3 $ctfInfo(MTFd3)
- ctfInfoSet MTFd4 $ctfInfo(MTFd4)
- ctfInfoSet MTFd5 $ctfInfo(MTFd5)
- ctfInfoSet MTFd6 $ctfInfo(MTFd6)
-
- #
- ctfInfoMolecEnvSet
-}
-
-#
-# ctfInfoCTFCalculation
-#
-proc ctfInfoCTFCalculation { } {
- variable ctfInfo
-
- #
- #puts "ctfInfoCTFCalculation: Power: $ctfInfo(flagCTFPower)"
-
- # Information Set
- ctfInfoCTFInfomationSet
-
- # Data Unset
- catch { unset ctfInfo(CTF) }
- catch { unset ctfInfo(CTFPower) }
- catch { unset ctfInfo(CTFcore) }
- catch { unset ctfInfo(CTFcorePower) }
- catch { unset ctfInfo(CTFNoise) }
- catch { unset ctfInfo(CTFNoisePower) }
- catch { unset ctfInfo(CTFSignal) }
- catch { unset ctfInfo(CTFSignalPower) }
- catch { unset ctfInfo(ScatteringSubtraction) }
-
- # Data Set
- set size [ llength $ctfInfo(R) ]
- if { $ctfInfo(flagCTFPower) } {
- set ctfInfo(CTFPower) [ ctfInfoCalc CTFPower ]
- set ctfInfo(CTFcorePower) [ ctfInfoCalc CTFcorePower ]
- set ctfInfo(CTFNoisePower) [ ctfInfoCalc CTFNoisePower ]
- set ctfInfo(CTFSignalPower) [ ctfInfoCalc CTFSignalPower ]
- } else {
- set ctfInfo(CTF) [ ctfInfoCalc CTF ]
- set ctfInfo(CTFcore) [ ctfInfoCalc CTFcore ]
- set ctfInfo(CTFNoise) [ ctfInfoCalc CTFNoise ]
- set ctfInfo(CTFSignal) [ ctfInfoCalc CTFSignal ]
- }
- for { set i 0 } { $i < $size } { incr i } {
- set data [ lindex $ctfInfo(Scattering) $i ]
- if { $ctfInfo(flagCTFPower) } {
- set noise [ lindex $ctfInfo(CTFNoisePower) $i ]
- } else {
- set noise [ lindex $ctfInfo(CTFNoise) $i ]
- }
- lappend ctfInfo(ScatteringSubtraction) [ expr $data - $noise ]
- }
-}
-
-#
-# Scattering Data
-#
-proc ctfInfoScatteringCalc { { filename __null__ } } {
- variable ctfInfo
-
- #puts "ctfInfoScatteringCalc"
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- } else {
- puts "no file for Scattring calc."
- return
- }
- }
- set xy [ mrcInfoGet $filename Spectrum2 ]
-
- catch { unset ctfInfo(R) }
- catch { unset ctfInfo(Scattering) }
- catch { unset ctfInfo(ScatteringRoot) }
-
- foreach { x y } $xy {
- lappend ctfInfo(R) $x
- lappend ctfInfo(Scattering) $y
- lappend ctfInfo(ScatteringRoot) [ expr sqrt($y)]
- }
- set ctfInfo(NyquistFrequency) [ lindex $ctfInfo(R) end ]
-}
-#
-#
-#
-proc ctfInfoListGet { } {
- variable ctfInfo
- return [ array get ctfInfo ]
-}
-#
-#
-#
-proc ctfInfoAppend { ctf } {
- variable ctfInfo
-
- set tmp [ array get ctfInfo ]
- array set ctfInfo "$tmp $ctf"
-}
-#end of CTF namespace
-}
-
+++ /dev/null
-#
-# ctfInfo
-#
-#
-#
-# Attention :
-# global variable
-# ctfInfo
-#
-
-proc ctfInfoInit { name } {
- global ctfInfo
-
- set ctfInfo(flag) 1
-
- set ctfInfo(.ctfinfo) [ string trimright $name ".fft" ].ctfinfo
- set ctfInfo(.ctfinfoMode) Every
- set ctfInfo(.ctfps) [ string trimright $name ".fft" ].ctfps
- set ctfInfo(.molcEnvTable) "~/Eos/database/carbon.table"
- #
- #
- #
- set ctfInfo(flagScatGraph) 1
- set ctfInfo(flagScatGraphSubstraction) 0
- set ctfInfo(Imax) 0.001
- set ctfInfo(dImax) 0.0001
- set ctfInfo(Rmax) 0.10
- set ctfInfo(dRmax) 0.01
-
- #
- #
- #
- set ctfInfo(flagZero) 1
- set ctfInfo(zeroMax) 6
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- set ctfInfo(zero$i) [ expr 0.01*$i ]
- set ctfInfo(dzero$i) 0.01
- }
- set ctfInfo(ThonRingCanvas) 0
-
- set ctfInfo(flagCTFGraph) 1
- set ctfInfo(flagCTFcoreGraph) 0
- set ctfInfo(flagCTFPower) 1
- #
- set ctfInfo(flagpredictZero) 0
- set ctfInfo(flagpredictZeroMax) 1
-
- ##
- set ctfInfo(defocus) 50000
- set ctfInfo(ddefocus) -1000
- set ctfInfo(Cs) 2.1
- set ctfInfo(dCs) 0.1
- set ctfInfo(kV) 200
- set ctfInfo(dkV) 5
- set ctfInfo(AoverP) 0.1
- set ctfInfo(dAoverP) -0.01
- set ctfInfo(Ai) 0.02
- set ctfInfo(dAi) 0.01
- set ctfInfo(Cc) 0.7
- set ctfInfo(dCc) 0.1
- set ctfInfo(dV) 0.7
- set ctfInfo(ddV) 0.1
- set ctfInfo(MolcEnv) 52.0
- set ctfInfo(dMolcEnv) 4.0
- set ctfInfo(I) 0.015
- set ctfInfo(dI) 0.002
- set ctfInfo(SN) 0.1
- set ctfInfo(dSN) 0.1
- set ctfInfo(whichMTF) singleExp
- set ctfInfo(MTF) 38
- set ctfInfo(dMTF) 1
- set ctfInfo(MTF2) 38
- set ctfInfo(dMTF2) 1
- set ctfInfo(Magnification) 1.0
- set ctfInfo(dMagnification) 0.01
-
- ## Evaluation of ctfInfo
- set ctfInfo(flagEvaluation) 0
- set ctfInfo(EvalMinMaxMethod) NULL
-}
-
-#
-# CTF Program
-#
-proc ctfInformationWinSet { } {
- global ctfInfo
-
- if [ catch { toplevel .ctfInfo -bd 4 -class CTFInfo } ] { # Window Create
- raise .ctfInfo
- } else {
- #
- # New Window
- #
- set w .ctfInfo
- #
- #Initialization
- set ctfInfo(flagpredictZero) 0
- #
- # Input Graph Data
- #
- if [ info exists ctfInfo(mrc) ] {
- array set mainImage $ctfInfo(mrc)
- } else {
- puts "No mrc Setting"
- return
- }
- #puts $mainImage(filename)
-
- if [ string match ".fft" $mainImage(filename) ] {
- set ctfInfo(.ctfps) [ string trimright $mainImage(filename) .fft ].ctfps
- set ctfInfo(.ctfinfo) [ string trimright $mainImage(filename) .fft ].ctfinfo
- } else {
- set ctfInfo(.ctfps) $mainImage(filename).ctfps
- set ctfInfo(.ctfinfo) $mainImage(filename).ctfinfo
- }
- set ctfInfo(filename) $mainImage(filename)
-
- #
- # Title
- #
- #label $w.title -text "CTF Information: $mainImage(filename)"
-
- #
- # Data Taking (Scattering)
- #
- set y [ mrcInfoGet $mainImage(filename) Spectrum ]
- set nx [ llength $y ]
- set dR 1
- set nnx [ expr $mainImage(width) /2 + 1 ]
- set nny [ expr $mainImage(height)/2 + 1 ]
- if { $nx == $nnx } {
- set dR [ expr 1.0/($mainImage(lx)*$mainImage(width)) ]
- }
- if { $nx == $nny } {
- set dR [ expr 1.0/($mainImage(ly)*$mainImage(height)) ]
- }
- for { set i 0 } { $i < $nx } { incr i } {
- lappend x [expr $i*$dR ]
- }
- set ctfInfo(R) $x
- set ctfInfo(Scattering) $y
-
- # Frame for Graph
- set ctfInfo(graph) [ graph $w.graph ]
- set g $ctfInfo(graph)
-
- # Pen Setting
- ctfInfoGraphPenCreate
-
- # Scattering Graph
- ctfInfoScatteringLineCreate
-
- # CTF Graph
- ctfInfoCTFLineCreate
-
- # Marker
- ctfInfoPredictedMarkerSet
- #ctfInfoMarkerReset
-
- # Frame for graphInfo
- #ctfInfoGraphInfoFrameCreate $w.graphInfo
- ctfInfoGraphInfoFrameCreate1 $w.graphInfo1
- #ctfInfoGraphInfoFrameCreate2 $w.graphInfo2
-
- # Frame for ctfInfo
- #ctfInfoCTFInfoFrameCreate $w.ctfInfo
- ctfInfoCTFInfoFrameCreate1 $w.ctfInfo1
- ctfInfoCTFInfoFrameCreate2 $w.ctfInfo2
-
- #
- # Packing
- #
- #pack $w.title -side top -fill x
- pack $w.graph -side top -expand true -fill both
-
- #pack $w.graphInfo -side left
-
- pack $w.graphInfo1 -side left
- pack $w.ctfInfo1 -side left
- pack $w.ctfInfo2 -side right
-
- Blt_ZoomStack $g
- Blt_Crosshairs $g
- Blt_ActiveLegend $g
- Blt_ClosestPoint $g
- }
-}
-
-proc ctfInfoGraphInfoFrameCreate { f } {
- global ctfInfo
-
- frame $f
-
- ctfInfoGraphInfoFrameCreate1 $f.f1
- ctfInfoGraphInfoFrameCreate2 $f.f2
-
- pack $f.f1 $f.f2 -side top
-
- return $f
-}
-
-#
-#
-#
-proc ctfInfoGraphInfoFrameCreate1 { f } {
- global ctfInfo
-
- frame $f
-
- set cmd ctfInfoScatteringLineCreate
- checkbutton $f.graph -text "Scattering" -variable ctfInfo(flagScatGraph) -command $cmd
- checkbutton $f.graphsub -text "Substraction" -variable ctfInfo(flagScatGraphSubstraction) -command $cmd
- CommandEntryWithUpDown $f.intensity Imax 4 $cmd ctfInfo(Imax) ctfInfo(dImax) -width 10
- CommandEntryWithUpDown $f.brmax Rmax 4 $cmd ctfInfo(Rmax) ctfInfo(dRmax) -width 10
-
- # File Frame
- set ff [ frame $f.file ]
- #PS
- set fff [ frame $ff.printPS ]
- button $fff.printPS -text "Save" -command ctfInfoSaveAsPS
- CommandEntry $fff.printPSEntry Graph 5 ctfInfoSaveAsPS -textvar ctfInfo(.ctfps)
- pack $fff.printPS $fff.printPSEntry -side left
- # Info
- set fff [ frame $ff.printInfo ]
- button $fff.printInfo -text "Save" -command ctfInfoSave
- CommandEntry $fff.printInfoEntry Info 5 ctfInfoSave -textvar ctfInfo(.ctfinfo)
- pack $fff.printInfo $fff.printInfoEntry -side left
- # InfoLoad
- set fff [ frame $ff.loadInfo ]
- button $fff.loadInfo -text "Load" -command ctfInfoLoad
- CommandEntry $fff.loadInfoEntry Info 5 ctfInfoLoad -textvar ctfInfo(.ctfinfo)
- pack $fff.loadInfo $fff.loadInfoEntry -side left
- pack $ff.printPS $ff.printInfo $ff.loadInfo -side top
- # MolcEnvLoad
- set fff [ frame $ff.loadMolcEnv ]
- button $fff.load -text "Load" -command molcEnvTableLoad
- CommandEntry $fff.loadEntry Info 5 molcEnvLoad -textvar ctfInfo(.molcEnvTable)
- pack $fff.load $fff.loadEntry -side left
-
- pack $ff.printPS $ff.printInfo $ff.loadInfo $ff.loadMolcEnv -side top
-
- # Packing
- pack \
- $f.graph \
- $f.graphsub \
- $f.intensity \
- $f.brmax \
- $f.file \
- -side top -expand true
-
- return $f
-}
-
-#
-# Thon Ring on canvas
-# Incomplete procedure
-#
-proc ctfInfoGraphInfoFrameCreate2 { f } {
- global ctfInfo
-
- frame $f
-
- # Thon Ring
- set cmd ctfInfoMarkerSet
- checkbutton $f.zero -text "Thon Ring (zero)" -variable ctfInfo(flagZero) -command $cmd
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- CommandEntryWithUpDown $f.zero$i $i 4 $cmd ctfInfo(zero$i) ctfInfo(dzero$i) -width 6
- }
- button $f.zeroReset -text Reset -command ctfInfoMarkerReset
-
- pack $f.zero -side top -expand true
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- pack $f.zero$i -side top -expand true
- }
- pack $f.zeroReset -side top -expand true
-
- return $f
-}
-
-#
-#
-#
-proc ctfInfoSaveAsPS { } {
- global ctfInfo
-
- puts $ctfInfo(.ctfps)
- $ctfInfo(graph) postscript output $ctfInfo(.ctfps) -center false
-}
-
-#
-#
-#
-proc ctfInfoSave { } {
- global ctfInfo
-
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) a 0600 ]
-
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- puts $fpt "filename: $ctfInfo(filename)"
- puts $fpt "defocus: $ctfInfo(defocus)"
- puts $fpt "AoverP: $ctfInfo(AoverP)"
- puts $fpt "kV: $ctfInfo(kV)"
- puts $fpt "Cs: $ctfInfo(Cs)"
- puts $fpt "Cc: $ctfInfo(Cc)"
- puts $fpt "Ai: $ctfInfo(Ai)"
- puts $fpt "I: $ctfInfo(I)"
- puts $fpt "SN: $ctfInfo(SN)"
- puts $fpt "whichMTF: $ctfInfo(whichMTF)"
- puts $fpt "MTF: $ctfInfo(MTF)"
- puts $fpt "MTF2: $ctfInfo(MTF2)"
- puts $fpt "MolcEnv: $ctfInfo(MolcEnv)"
- puts $fpt "Magnification: $ctfInfo(Magnification)"
- puts $fpt "flagCTFPower: $ctfInfo(flagCTFPower)"
- }
- }
- close $fpt
-}
-
-#
-#
-#
-proc ctfInfoLoad { } {
- global ctfInfo
- puts $ctfInfo(.ctfinfo)
- set fpt [ open $ctfInfo(.ctfinfo) r ]
-
- switch $ctfInfo(.ctfinfoMode) {
- Every {
- while { ! [ eof $fpt ] } {
- gets $fpt s
- set slist [ split $s ":" ]
- set name [ string trim [ lindex $slist 0 ] ]
- set value [ string trim [ lindex $slist 1 ] ]
- if {
- $name == "filename"
- || $name == "defocus"
- || $name == "AoverP"
- || $name == "kV"
- || $name == "Cs"
- || $name == "Cc"
- || $name == "Ai"
- || $name == "I"
- || $name == "SN"
- || $name == "whichMTF"
- || $name == "MTF"
- || $name == "MTF2"
- || $name == "MolcEnv"
- || $name == "Magnification"
- || $name == "flagCTFPower" } {
- set ctfInfo($name) $value
- }
- }
- }
- }
- close $fpt
-}
-#
-#
-#
-proc molcEnvTableLoad { } {
-
-}
-#
-#
-#
-proc ctfInfoCTFInfoFrameCreate { f } {
- global ctfInfo
-
- # Frame for ctfInfo
- frame $f
-
- ctfInfoCTFInfoFrameCreate1 $f.f1
- ctfInfoCTFInfoFrameCreate1 $f.f2
-
- pack $f.f1 $f.f2 -side top
- return $f
-}
-
-proc ctfInfoCTFInfoFrameCreate1 { f } {
- global ctfInfo
-
- # Frame for ctfInfo
- frame $f
- set cmd ctfInfoCTFLineCreate
- frame $f.title
- checkbutton $f.title.main -text "CTF Params" -variable ctfInfo(flagCTFGraph) -command $cmd
- checkbutton $f.title.sub -text "Core" -variable ctfInfo(flagCTFcoreGraph) -command $cmd
- checkbutton $f.title.power -text "Power" -variable ctfInfo(flagCTFPower) -command $cmd
- pack $f.title.main $f.title.sub $f.title.power -side left -expand true
- CommandEntryWithUpDown $f.defocus "defocus A " 10 $cmd ctfInfo(defocus) ctfInfo(ddefocus) -width 6
- CommandEntryWithUpDown $f.aoverP "AoverP " 10 $cmd ctfInfo(AoverP) ctfInfo(dAoverP) -width 6
- CommandEntryWithUpDown $f.molcEnv "MolcEnv A " 10 $cmd ctfInfo(MolcEnv) ctfInfo(dMolcEnv) -width 6
- CommandEntryWithUpDown $f.i "I " 10 $cmd ctfInfo(I) ctfInfo(dI) -width 6
- CommandEntryWithUpDown $f.sN "SN " 10 $cmd ctfInfo(SN) ctfInfo(dSN) -width 6
- CommandEntryWithUpDown $f.mag "Mag " 10 $cmd ctfInfo(Magnification) ctfInfo(dMagnification) -width 6
- set ff [ frame $f.whichMTF ]
- RadioButtonsCreate $ff ctfInfo(whichMTF) singleExp Lorentzian Both Linear
- CommandEntryWithUpDown $f.mTF "MTF A " 10 $cmd ctfInfo(MTF) ctfInfo(dMTF) -width 6
- CommandEntryWithUpDown $f.mTF2 "MTF2 A " 10 $cmd ctfInfo(MTF2) ctfInfo(dMTF2) -width 6
- button $f.calc -text I*((PhaseCTF+AoverP*AmpCTF)*Env*MolEnv+SN)*MTF -command $cmd
-
- pack \
- $f.title \
- $f.defocus \
- $f.aoverP \
- $f.molcEnv \
- $f.i \
- $f.sN \
- $f.mag \
- $f.whichMTF \
- $f.mTF \
- $f.mTF2 \
- $f.calc \
- -side top -expand true
-
- return $f
-}
-
-proc ctfInfoCTFInfoFrameCreate2 { f } {
- global ctfInfo
-
- # Frame for ctfInfo
- frame $f
- set cmd ctfInfoCTFLineCreate
- CommandEntry $f.cs "Cs mm " 10 $cmd -textvar ctfInfo(Cs) -width 6
- CommandEntry $f.kV "kV kV " 10 $cmd -textvar ctfInfo(kV) -width 6
- CommandEntry $f.ai "Ai mrad " 10 $cmd -textvar ctfInfo(Ai) -width 6
- CommandEntry $f.cc "Cc mm " 10 $cmd -textvar ctfInfo(Cc) -width 6
- CommandEntry $f.dkV "dV eV " 10 $cmd -textvar ctfInfo(dV) -width 6
-
- pack \
- $f.cs \
- $f.kV \
- $f.ai \
- $f.cc \
- $f.dkV \
- -side top -expand true
- return $f
-}
-
-#
-# Movable marker for thonRingDetermine
-#
-proc ctfInfoMarkerSet { } {
- global ctfInfo
-
- ctfInfoMarkerUnset
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- $ctfInfo(graph) marker create line -name zero$i \
- -coords { $ctfInfo(zero$i) 0 \
- $ctfInfo(zero$i) 1 }
- $ctfInfo(graph) marker configure zero$i -dashes { 2 2 }
- }
-}
-
-proc ctfInfoMarkerUnset { } {
- global ctfInfo
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- $ctfInfo(graph) marker delete zero$i
- }
-}
-
-proc ctfInfoPredictedMarkerSet { } {
- global ctfInfo
-
- # Zero Point
- set flag 0
- set size [ llength $ctfInfo(R) ]
-
- for { set i 0 } { $i < $size } { incr i } {
- set R [ lindex $ctfInfo(R) $i ]
- set CTF [ lindex $ctfInfo(CTFcore) $i ]
- set C [ lindex $ctfInfo(CTF) $i ]
- if { $flag == 0 } {
- incr flag
- } else {
- if { $CTF == 0 } {
- set ctfInfo(predictZero$flag) $R
- incr flag
- } else {
- set indicator [ expr $CTF*$oldCTF ]
- if { $indicator < 0 } {
- set ctfInfo(predictZero$flag) [ expr ($R - $oldR)*abs($oldCTF)/abs($CTF-$oldCTF) + $oldR ]
- set ctfInfo(predictZeroCTF$flag) [ expr ($oldC*($R - $ctfInfo(predictZero$flag)) \
- + $C *($ctfInfo(predictZero$flag) - $oldR)) \
- /($R - $oldR) ]
- incr flag
- }
- }
- }
-
- set oldR $R
- set oldCTF $CTF
- set oldC $C
- }
-
- set ctfInfo(predictZeroMax) [ incr flag -1 ]
- #puts $flag
- for { set i 1 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- if { $ctfInfo(flagCTFPower) == 1 } {
- set ymax [ expr 1.2*$ctfInfo(predictZeroCTF$i)*$ctfInfo(predictZeroCTF$i) ]
- } else {
- set ymax [ expr 1.2*$ctfInfo(predictZeroCTF$i) ]
- }
- $ctfInfo(graph) marker create line -name predictZero$i -coords { $ctfInfo(predictZero$i) 0 \
- $ctfInfo(predictZero$i) $ymax }
- #$ctfInfo(graph) marker configure predictZero$i -foreground black
- }
- set ctfInfo(flagpredictZero) 1
-}
-
-proc ctfInfoPredictedMarkerUnset { } {
- global ctfInfo
-
- if { $ctfInfo(flagpredictZero) == 1 } {
- for { set i 1 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- $ctfInfo(graph) marker delete predictZero$i
- }
- }
- set ctfInfo(flagpredictZero) 0
-}
-
-proc ctfInfoMarkerReset { } {
- global ctfInfo
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- set ctfInfo(zero$i) $ctfInfo(predictZero$i)
- }
- ctfInfoMarkerSet
-}
-
-proc ctfInfoGraphPenCreate { } {
- global ctfInfo
-
- set g $ctfInfo(graph)
- $g pen create scatPen
- $g pen configure scatPen -pixels 0 -color blue
- $g pen create ctfPen
- $g pen configure ctfPen -pixels 0 -color red
-}
-
-proc ctfInfoScatteringLineCreate { } {
- global ctfInfo
-
- set g $ctfInfo(graph)
-
- # Drawing Graph (Scattering)
- catch [ $g element delete Scattering ]
- catch [ $g element delete ScatteringSubstraction ]
-
- if { $ctfInfo(flagScatGraph) == 1 } {
- $g element create Scattering -xdata $ctfInfo(R) -ydata $ctfInfo(Scattering)
- $g element configure Scattering -pen scatPen
- $g configure -title "CTF($ctfInfo(filename))"
- $g axis configure x -title "R" -loose yes -max $ctfInfo(Rmax) -hide no
- $g axis configure y -title "Intensity" -loose yes -max $ctfInfo(Imax) -hide no
- $g legend configure -position top -hide no
- $g axis configure x -max $ctfInfo(Rmax)
- $g axis configure y -max $ctfInfo(Imax)
- }
- if { $ctfInfo(flagScatGraphSubstraction) == 1 } {
- catch [ unset ctfInfo(ScatteringSubstraction) ]
- set size [ llength $ctfInfo(R) ]
- for { set i 0 } { $i < $size } { incr i } {
- set data [ lindex $ctfInfo(Scattering) $i ]
- if { $ctfInfo(flagCTFPower) } {
- set noise [ lindex $ctfInfo(CTFNoisePower) $i ]
- } else {
- set noise [ lindex $ctfInfo(CTFNoise) $i ]
- }
- lappend ctfInfo(ScatteringSubstraction) [ expr $data - $noise ]
- }
- $g element create ScatteringSubstraction -xdata $ctfInfo(R) -ydata $ctfInfo(ScatteringSubstraction)
- $g element configure ScatteringSubstraction -pen scatPen
- $g configure -title "CTF($ctfInfo(filename))"
- $g axis configure x -title "R" -loose yes -max $ctfInfo(Rmax) -hide no
- $g axis configure y -title "Intensity" -loose yes -max $ctfInfo(Imax) -hide no
- $g legend configure -position top -hide no
- $g axis configure x -max $ctfInfo(Rmax)
- $g axis configure y -max $ctfInfo(Imax)
- }
-}
-
-proc ctfInfoCTFLineCreate { } {
- global ctfInfo
-
- ctfInfoCTFCalculation
-
- set g $ctfInfo(graph)
- catch [ $g element delete CTF ]
- catch [ $g element delete CTFcore ]
- catch [ $g element delete Noise ]
-
- ctfInfoPredictedMarkerUnset
-
- if { $ctfInfo(flagCTFGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) == 1 } {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTFPower)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoisePower)
- } else {
- $g element create CTF -xdata $ctfInfo(R) -ydata $ctfInfo(CTF)
- $g element create Noise -xdata $ctfInfo(R) -ydata $ctfInfo(CTFNoise)
- }
- $g element configure CTF -pen ctfPen
- $g element configure Noise -pen ctfPen
-
- ctfInfoPredictedMarkerSet
- }
- if { $ctfInfo(flagCTFcoreGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) } {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignalPower)
- } else {
- $g element create CTFcore -xdata $ctfInfo(R) -ydata $ctfInfo(CTFSignal)
- }
- $g element configure CTFcore -pen ctfPen
- }
-}
-
-proc ctfInfoCTFCalculation { } {
- global ctfInfo
-
- set size [ llength $ctfInfo(R) ]
- ctfInfoSet kV $ctfInfo(kV)
- ctfInfoSet defocus $ctfInfo(defocus)
- ctfInfoSet Cc $ctfInfo(Cc)
- ctfInfoSet dE $ctfInfo(dV)
- ctfInfoSet Cs $ctfInfo(Cs)
- ctfInfoSet Ai $ctfInfo(Ai)
- ctfInfoSet I $ctfInfo(I)
- ctfInfoSet Mag $ctfInfo(Magnification)
- ctfInfoSet AoverP $ctfInfo(AoverP)
- ctfInfoSet Mode [ expr 1 + 32 + 64 ]
- switch -exact -- $ctfInfo(whichMTF) {
- singleExp {
- ctfInfoSet MTFMode 0
- }
- Lorentzian {
- ctfInfoSet MTFMode 1
- }
- Both {
- ctfInfoSet MTFMode 2
- }
- Linear {
- ctfInfoSet MTFMode 3
- }
- }
- ctfInfoSet MTF $ctfInfo(MTF)
- ctfInfoSet MTF2 $ctfInfo(MTF2)
- ctfInfoSet MolecEnv $ctfInfo(MolcEnv)
- ctfInfoSet Noise $ctfInfo(SN)
- ctfInfoSet R $size $ctfInfo(R)
-
- catch [ unset ctfInfo(CTF) ]
- catch [ unset ctfInfo(CTFPower) ]
- catch [ unset ctfInfo(CTFcore) ]
- catch [ unset ctfInfo(CTFcorePower) ]
- catch [ unset ctfInfo(CTFNoise) ]
- catch [ unset ctfInfo(CTFNoisePower) ]
- catch [ unset ctfInfo(CTFSignal) ]
- catch [ unset ctfInfo(CTFSignalPower) ]
-
- set ctfInfo(CTF) [ ctfInfoCalc CTF ]
- set ctfInfo(CTFPower) [ ctfInfoCalc CTFPower ]
- set ctfInfo(CTFcore) [ ctfInfoCalc CTFcore ]
- set ctfInfo(CTFcorePower) [ ctfInfoCalc CTFcorePower ]
- set ctfInfo(CTFNoise) [ ctfInfoCalc CTFNoise ]
- set ctfInfo(CTFNoisePower) [ ctfInfoCalc CTFNoisePower ]
- set ctfInfo(CTFSignal) [ ctfInfoCalc CTFSignal ]
- set ctfInfo(CTFSignalPower) [ ctfInfoCalc CTFSignalPower ]
-}
-
-proc ctfInfoCTFCalculationShellOnly { } {
- global ctfInfo
-
- set size [ llength $ctfInfo(R) ]
- set E [ expr $ctfInfo(kV)*1e3 ]
- set E0 [ expr 511*1e3 ]
- set dE [ expr $ctfInfo(dV) ]
- set Cs [ expr $ctfInfo(Cs)*1e7 ]
- set Cc [ expr $ctfInfo(Cc)*1e7 ]
- set Ai [ expr $ctfInfo(Ai)*1e-3 ]
- set dF $ctfInfo(defocus)
- set Mag $ctfInfo(Magnification)
- set MolcEnv $ctfInfo(MolcEnv)
- set AoverP $ctfInfo(AoverP)
-
- set lambda [ expr 12.26/sqrt($E*(1.0 + 0.9788e-6*$E))]
-
- catch [ unset ctfInfo(CTF) ]
- catch [ unset ctfInfo(CTFPower) ]
- catch [ unset ctfInfo(CTFcore) ]
- catch [ unset ctfInfo(CTFcorePower) ]
- catch [ unset ctfInfo(CTFNoise) ]
- catch [ unset ctfInfo(CTFNoisePower) ]
- catch [ unset ctfInfo(CTFSignal) ]
- catch [ unset ctfInfo(CTFSignalPower) ]
-
- for { set i 0 } { $i < $size } { incr i } {
- set R [ lindex $ctfInfo(R) $i ]
- set R [ expr $R*$Mag ]
- set KAI [ expr 3.14159265*($dF*$lambda*$R*$R \
- -$Cs*$lambda*$lambda*$lambda*$R*$R*$R*$R/2.0) ]
- set Env [ expr exp(-(3.14159265*$Cs*$lambda*$lambda*$R*$R*$R - 3.14159265*$dF*$R)*$Ai \
- *(3.14159265*$Cs*$lambda*$lambda*$R*$R*$R - 3.14159265*$dF*$R)*$Ai \
- /log(2)) \
- *exp(-(3.14159265*$lambda*$R*$R*2.0*$Cc*$dE/$E*((1+$E/$E0)/(1+$E/$E0/2))/4/sqrt(log(2))) \
- *(3.14159265*$lambda*$R*$R*2.0*$Cc*$dE/$E*((1+$E/$E0)/(1+$E/$E0/2))/4/sqrt(log(2)))) \
- ]
- set molEnv [ expr exp(-$MolcEnv*$MolcEnv*$R*$R/2.0) ]
- set CTF [ expr -sin($KAI) - $AoverP*cos($KAI) ]
- switch -exact -- $ctfInfo(whichMTF) {
- singleExp {
- set MTF [ expr exp(-$ctfInfo(MTF)*$R) ]
- }
- Lorentzian {
- set MTF [ expr 1/(1 + $R*$R*$ctfInfo(MTF2)*$ctfInfo(MTF2)) ]
- }
- Both {
- set MTF [ expr exp(-$ctfInfo(MTF)*$R)/(1 + $R*$R*$ctfInfo(MTF2)*$ctfInfo(MTF2)) ]
- }
- Linear {
- set MTF [ expr 1 - $ctfInfo(MTF)*$R ]
- if { $MTF < 0 } {
- set MTF 0
- }
- }
- }
- set C [ expr $ctfInfo(I)*( \
- abs($CTF) \
- *$Env*$molEnv \
- +$ctfInfo(SN)) \
- *$MTF
- ]
- set CTFNoise [ expr $ctfInfo(I)*$ctfInfo(SN)*$MTF ]
- lappend ctfInfo(CTFcore) [ expr $CTF ]
- lappend ctfInfo(CTFcorePower) [ expr $CTF*$CTF ]
- lappend ctfInfo(CTFNoise) [ expr $CTFNoise ]
- lappend ctfInfo(CTFNoisePower) [ expr $CTFNoise*$CTFNoise ]
- lappend ctfInfo(CTFSignal) [ expr $ctfInfo(I)*abs($CTF)*$Env*$molEnv*$MTF ]
- lappend ctfInfo(CTFSignalPower) [ expr $ctfInfo(I)*abs($CTF)*$Env*$molEnv*$MTF*$ctfInfo(I)*abs($CTF)*$Env*$molEnv*$MTF ]
- lappend ctfInfo(CTF) [ expr $C ]
- lappend ctfInfo(CTFPower) [ expr $ctfInfo(I)*abs($CTF)*$Env*$molEnv*$MTF*$ctfInfo(I)*abs($CTF)*$Env*$molEnv*$MTF+$CTFNoise*$CTFNoise ]
- }
-}
+++ /dev/null
-/*
-# %M% %Y% %I%
-# The latest update : %G% at %U%
-#
-#%Z% tkctfInfo ver %I%
-#%Z% Created by
-#%Z%
-#%Z% Usage : tkctfInfo
-#%Z% Attention
-#%Z%
-*/
-
-static char __sccs_id[] = "%Z%tkctfInfo ver%I%; Date:%D% %Z%";
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#undef DEBUG
-#include "genUtil.h"
-#include <tk.h>
-#include "String.h"
-#include "File.h"
-#include "tkctfInfo.h"
-#include "ctfZeroPoint.h"
-
-static tkctfInfo __tkctfInfo;
-
-int
-tkctfInfoCmdSet(Tcl_Interp* interp)
-{
- Tcl_CreateCommand(interp, "ctfInfoFile", tkctfInfoFileCmd, (ClientData)Tk_MainWindow(interp), (Tcl_CmdDeleteProc*)NULL);
- Tcl_CreateCommand(interp, "ctfInfoSet", tkctfInfoSetCmd, (ClientData)Tk_MainWindow(interp), (Tcl_CmdDeleteProc*)NULL);
- Tcl_CreateCommand(interp, "ctfInfoGet", tkctfInfoGetCmd, (ClientData)Tk_MainWindow(interp), (Tcl_CmdDeleteProc*)NULL);
- Tcl_CreateCommand(interp, "ctfInfoCalc", tkctfInfoCalculateCmd, (ClientData)Tk_MainWindow(interp), (Tcl_CmdDeleteProc*)NULL);
- Tcl_CreateCommand(interp, "ctfInfoEval", tkctfInfoEvaluateCmd, (ClientData)Tk_MainWindow(interp), (Tcl_CmdDeleteProc*)NULL);
- return TCL_OK;
-}
-
-int
-tkctfInfoFileCmd(ClientData clientData, Tcl_Interp* interp, int argc, CONST char* argv[])
-{
- SSWITCH((char*)argv[1])
- SCASE("write") {
- FILE* fpt;
- fpt = fileOpen((char*)argv[2], "a");
- ctfInfoWrite(fpt, __tkctfInfo.ctf, "", 0);
- SBREAK;
- }
- SCASE("read") {
- FILE* fpt;
- fpt = fileOpen((char*)argv[2], "r");
- ctfInfoRead(fpt, &(__tkctfInfo.ctf), "", 0);
- SBREAK;
- }
- SDEFAULT {
- fprintf(stderr, "Not supported argument: %s\n", argv[1]);
- SBREAK;
- }
- SSWITCHEND;
- return 1;
-}
-
-int
-tkctfInfoSetCmd(ClientData clientData, Tcl_Interp* interp, int argc, CONST char* argv[])
-{
- DEBUGPRINT3("%s %s %s\n", argv[0], argv[1], argv[2]);
- SSWITCH((char*)argv[1])
- SCASE("kV") {
- __tkctfInfo.ctf.kV = atof(argv[2]);
- SBREAK;
- }
- SCASE("defocus") {
- __tkctfInfo.ctf.defocus = atof(argv[2]);
- SBREAK;
- }
- SCASE("Cc") {
- __tkctfInfo.ctf.Cc = atof(argv[2]);
- SBREAK;
- }
- SCASE("dE") {
- __tkctfInfo.ctf.dE = atof(argv[2]);
- SBREAK;
- }
- SCASE("Cs") {
- __tkctfInfo.ctf.Cs = atof(argv[2]);
- SBREAK;
- }
- SCASE("Ai") {
- __tkctfInfo.ctf.Ain = atof(argv[2]);
- SBREAK;
- }
- SCASE("Mode") {
- __tkctfInfo.ctf.mode = atoi(argv[2]);
- SBREAK;
- }
- SCASE("MTFMode") {
- __tkctfInfo.ctf.MTFMode = atoi(argv[2]);
- SBREAK;
- }
- SCASE("MTF") {
- __tkctfInfo.ctf.BofMTF = atof(argv[2]);
- SBREAK;
- }
- SCASE("MTF2") {
- __tkctfInfo.ctf.BofMTF2 = atof(argv[2]);
- SBREAK;
- }
- SCASE("MTF2Weight") {
- __tkctfInfo.ctf.WeightOfSecondTermForMTF = atof(argv[2]);
- SBREAK;
- }
- SCASE("Noise") {
- __tkctfInfo.ctf.flagWhiteNoise = 1;
- __tkctfInfo.ctf.WhiteNoise = atof(argv[2]);
- SBREAK;
- }
- SCASE("Noise2") {
- __tkctfInfo.ctf.flagWhiteNoise2 = 1;
- __tkctfInfo.ctf.WhiteNoise2 = atof(argv[2]);
- SBREAK;
- }
- SCASE("AoverP") {
- __tkctfInfo.ctf.ratioOfAmpToPhase = atof(argv[2]);
- SBREAK;
- }
- SCASE("I") {
- __tkctfInfo.ctf.I0 = atof(argv[2]);
- SBREAK;
- }
- SCASE("Mag") {
- __tkctfInfo.ctf.Magnification = atof(argv[2]);
- __tkctfInfo.ctf.flagMagnification = 1;
- SBREAK;
- }
- SCASE("R") {
- int i,j;
- char* s;
- if(__tkctfInfo.flagR != 0) {
- free(__tkctfInfo.R);
- }
- __tkctfInfo.nR = atoi(argv[2]);
- __tkctfInfo.R = (float*)malloc(sizeof(float)*__tkctfInfo.nR);
- DEBUGPRINT1("%s\n", argv[3]);
- s = (char*)argv[3];
- j = 0;
- for(i=0; i<__tkctfInfo.nR; i++) {
- while(' ' == s[j]) {
- j++;
- }
- __tkctfInfo.R[i] = atof(s+j);
- DEBUGPRINT2("R(%d): %g\n", i, __tkctfInfo.R[i])
- while(' ' != s[j]) {
- j++;
- }
- }
- __tkctfInfo.flagR = 1;
- SBREAK;
- }
- SCASE("flagVibration") {
- __tkctfInfo.ctf.flagVibration = atoi(argv[2]);
- SBREAK;
- }
- SCASE("BofVibration") {
- __tkctfInfo.ctf.BofVibration = atof(argv[2]);
- SBREAK;
- }
- SCASE("VibrationMode") {
- __tkctfInfo.ctf.VibrationMode = atoi(argv[2]);
- SBREAK;
- }
- SCASE("Aliasing") {
- __tkctfInfo.ctf.flagAliasing = atoi(argv[2]);
- if(3<argc) {
- __tkctfInfo.ctf.NyquistFrequency = atof(argv[3]);
- }
- SBREAK;
- }
- SCASE("Sampling") {
- __tkctfInfo.ctf.flagSampling = atoi(argv[2]);
- if(3<argc) {
- __tkctfInfo.ctf.NyquistFrequency = atof(argv[3]);
- }
- SBREAK;
- }
- SCASE("MolecEnv") {
- __tkctfInfo.ctf.MolecEnv = atof(argv[2]);
- SBREAK;
- }
- SCASE("MolecEnvMode") {
- __tkctfInfo.ctf.flagMolecEnvTable = atoi(argv[2]);
- SBREAK;
- }
- SCASE("MolecEnvTable") {
- FILE* fpt;
- fpt = fileOpen((char*)argv[2], "r");
- lmolecularEnvelopeFileRead(fpt, &(__tkctfInfo.ctf.MolecEnvTable), 0);
- fclose(fpt);
- SBREAK;
- }
- SCASE("InElasticMode") {
- __tkctfInfo.ctf.flagWithInElastic = atoi(argv[2]);
- }
- SCASE("InElaMolecEnv") {
- __tkctfInfo.ctf.InElasticGaussian = atof(argv[2]);
- SBREAK;
- }
- SCASE("InElaMolecEnvMode") {
- __tkctfInfo.ctf.flagWithInElasticTable = atoi(argv[2]);
- SBREAK;
- }
- SCASE("InElaMolecEnvTable") {
- FILE* fpt;
- fpt = fileOpen((char*)argv[2], "r");
- lmolecularEnvelopeFileRead(fpt, &(__tkctfInfo.ctf.InElasticEnvTable), 0);
- fclose(fpt);
- SBREAK;
- }
- SCASE("InElastic") {
- __tkctfInfo.ctf.flagInElastic = atoi(argv[2]);
- if(3<argc) {
- __tkctfInfo.ctf.InElastic = atof(argv[3]);
- __tkctfInfo.ctf.InElasticShift = atof(argv[4]);
- __tkctfInfo.ctf.InElasticWidth = atof(argv[5]);
- __tkctfInfo.ctf.InElasticRing = atof(argv[6]);
- __tkctfInfo.ctf.InElasticRingPosition = atof(argv[7]);
- __tkctfInfo.ctf.InElasticRingWidth = atof(argv[8]);
- }
- SBREAK;
- }
- SCASE("Elastic") {
- __tkctfInfo.ctf.flagElastic = atoi(argv[2]);
- if(3<argc) {
- __tkctfInfo.ctf.Elastic = atof(argv[3]);
- __tkctfInfo.ctf.ElasticShift = atof(argv[4]);
- __tkctfInfo.ctf.ElasticWidth = atof(argv[5]);
- __tkctfInfo.ctf.ElasticRing = atof(argv[6]);
- __tkctfInfo.ctf.ElasticRingPosition = atof(argv[7]);
- __tkctfInfo.ctf.ElasticRingWidth = atof(argv[8]);
- }
- SBREAK;
- }
- SDEFAULT {
- fprintf(stderr, "Not supported Command: %s\n", argv[1]);
- SBREAK;
- }
- SSWITCHEND;
-
- return TCL_OK;
-}
-
-int
-tkctfInfoGetCmd(ClientData clientData, Tcl_Interp* interp, int argc, CONST char* argv[])
-{
- SSWITCH((char*)argv[1])
- SCASE("kV") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.kV);
- SBREAK;
- }
- SCASE("defocus") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.defocus);
- SBREAK;
- }
- SCASE("Cc") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.Cc);
- SBREAK;
- }
- SCASE("dE") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.dE);
- SBREAK;
- }
- SCASE("Cs") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.Cs);
- SBREAK;
- }
- SCASE("Ain") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.Ain);
- SBREAK;
- }
- SCASE("Mode") {
- sprintf(interp->result, "%d", __tkctfInfo.ctf.mode);
- SBREAK;
- }
- SCASE("MTFMode") {
- sprintf(interp->result, "%d", __tkctfInfo.ctf.MTFMode);
- SBREAK;
- }
- SCASE("MTF") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.BofMTF);
- SBREAK;
- }
- SCASE("MTF2") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.BofMTF2);
- SBREAK;
- }
- SCASE("WeightForMTF") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.WeightOfSecondTermForMTF);
- SBREAK;
- }
- SCASE("MolecEnv") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.MolecEnv);
- SBREAK;
- }
- SCASE("Noise") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.WhiteNoise);
- SBREAK;
- }
- SCASE("Noise2") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.WhiteNoise2);
- SBREAK;
- }
- SCASE("AoverP") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.ratioOfAmpToPhase);
- SBREAK;
- }
- SCASE("I") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.I0);
- SBREAK;
- }
- SCASE("Mag") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.Magnification);
- SBREAK;
- }
- SCASE("R") {
- int i;
- char s[1024];
- for(i=0; i<__tkctfInfo.nR; i++) {
- sprintf(s, "%g", __tkctfInfo.R[i]);
- Tcl_AppendElement(interp, s);
- }
- SBREAK;
- }
- SCASE("Zero") {
- int i;
- int Nmax;
- ctfInfoZeroPoint zero;
- char s[1024];
- float R, data, data1;
- if(argc<5) {
- fprintf(stderr, "%s %s RMax Nmax dR\n", argv[0], argv[1]);
- return TCL_ERROR;
- }
- zero.RMax = atof(argv[2]);
- Nmax = atoi(argv[3]);
- zero.dR = atof(argv[4]);
- for(i=0; i<Nmax; i++) {
- zero.N = i+1;
- R = ctfZeroPoint(&(__tkctfInfo.ctf), &zero, 0);
- if(0<=R) {
- data = ctfNoiseFunction (&(__tkctfInfo.ctf), R, 0);
- data1 = ctfNoise2Function(&(__tkctfInfo.ctf), R, 0);
- sprintf(s, "%g", R);
- Tcl_AppendElement(interp, s);
- sprintf(s, "%g", data);
- Tcl_AppendElement(interp, s);
- sprintf(s, "%g", data1);
- Tcl_AppendElement(interp, s);
- } else {
- break;
- }
- }
- SBREAK;
- }
- SCASE("flagVibration") {
- sprintf(interp->result, "%d", __tkctfInfo.ctf.flagVibration);
- SBREAK;
- }
- SCASE("BofVibration") {
- sprintf(interp->result, "%g", __tkctfInfo.ctf.BofVibration);
- SBREAK;
- }
- SCASE("VibrationMode") {
- sprintf(interp->result, "%d", __tkctfInfo.ctf.VibrationMode);
- SBREAK;
- }
- SCASE("Aliasing") {
- sprintf(interp->result, "%d %f", __tkctfInfo.ctf.flagAliasing, __tkctfInfo.ctf.NyquistFrequency);
- SBREAK;
- }
- SCASE("Sampling") {
- sprintf(interp->result, "%d %f", __tkctfInfo.ctf.flagSampling, __tkctfInfo.ctf.NyquistFrequency);
- SBREAK;
- }
- SCASE("Elastic") {
- char s[1024];
- Tcl_AppendElement(interp, "flagElastic");
- sprintf(s, "%d", __tkctfInfo.ctf.flagElastic); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "Elastic");
- sprintf(s, "%g", __tkctfInfo.ctf.Elastic); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "ElasticShift");
- sprintf(s, "%g", __tkctfInfo.ctf.ElasticShift); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "ElasticWidth");
- sprintf(s, "%g", __tkctfInfo.ctf.ElasticWidth); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "ElasticRing");
- sprintf(s, "%g", __tkctfInfo.ctf.ElasticRing); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "ElasticRingPosition");
- sprintf(s, "%g", __tkctfInfo.ctf.ElasticRingPosition); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "ElasticRingWidth");
- sprintf(s, "%g", __tkctfInfo.ctf.ElasticRingWidth); Tcl_AppendElement(interp, s);
- SBREAK;
- }
- SCASE("InElastic") {
- char s[1024];
- Tcl_AppendElement(interp, "flagInElastic");
- sprintf(s, "%d", __tkctfInfo.ctf.flagInElastic); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "InElastic");
- sprintf(s, "%g", __tkctfInfo.ctf.InElastic); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "InElasticShift");
- sprintf(s, "%g", __tkctfInfo.ctf.InElasticShift); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "InElasticWidth");
- sprintf(s, "%g", __tkctfInfo.ctf.InElasticWidth); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "InElasticRing");
- sprintf(s, "%g", __tkctfInfo.ctf.InElasticRing); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "InElasticRingPosition");
- sprintf(s, "%g", __tkctfInfo.ctf.InElasticRingPosition); Tcl_AppendElement(interp, s);
- Tcl_AppendElement(interp, "InElasticRingWidth");
- sprintf(s, "%g", __tkctfInfo.ctf.InElasticRingWidth); Tcl_AppendElement(interp, s);
- SBREAK;
- }
- SDEFAULT {
- fprintf(stderr, "Not supported Command: %s\n", argv[1]);
- SBREAK;
- }
- SSWITCHEND;
- return TCL_OK;
-}
-
-int
-tkctfInfoCalculateCmd(ClientData clientData, Tcl_Interp* interp, int argc, CONST char* argv[])
-{
- int size;
- int i;
- int offset;
- char s[1024];
- float data, data1, data2;
- float R;
-
- DEBUGPRINT2("%s %s\n", argv[0], argv[1]);
- if(!__tkctfInfo.flagR) {
- return TCL_ERROR;
- }
- for(i=0; i<__tkctfInfo.nR; i++) {
- R = __tkctfInfo.R[i];
- SSWITCH((char*)argv[1])
- SCASE("CTF") {
- data = ctfScatteringFunction(&(__tkctfInfo.ctf), R, 0);
- SBREAK;
- }
- SCASE("CTFPower") {
- data = ctfSignalPowerFunction(&(__tkctfInfo.ctf), R, 0);
- data1 = ctfNoisePowerFunction(&(__tkctfInfo.ctf), R, 0);
- data2 = ctfNoise2PowerFunction(&(__tkctfInfo.ctf), R, 0);
- data = data + data1 + data2;
- SBREAK;
- }
- SCASE("CTFcore") {
- data = ctfFunction(&(__tkctfInfo.ctf), R, 0);
- SBREAK;
- }
- SCASE("CTFcorePower") {
- data = ctfFunction(&(__tkctfInfo.ctf), R, 0);
- data = SQR(data);
- SBREAK;
- }
- SCASE("CTFNoise") {
- data = ctfNoiseFunction(&(__tkctfInfo.ctf), R, 0);
- data1 = ctfNoise2Function(&(__tkctfInfo.ctf), R, 0);
- data = data + data1;
- SBREAK;
- }
- SCASE("CTFNoisePower") {
- data = ctfNoisePowerFunction(&(__tkctfInfo.ctf), R, 0);
- data1 = ctfNoise2PowerFunction(&(__tkctfInfo.ctf), R, 0);
- data = data + data1;
- SBREAK;
- }
- SCASE("CTFSignal") {
- data = ctfSignalFunction(&(__tkctfInfo.ctf), R, 0);
- SBREAK;
- }
- SCASE("CTFSignalPower") {
- data = ctfSignalPowerFunction(&(__tkctfInfo.ctf), R, 0);
- SBREAK;
- }
- SDEFAULT {
- data = 0;
- fprintf(stderr, "Not supported Command: %s\n", argv[1]);
- SBREAK;
- }
- SSWITCHEND;
- sprintf(s, "%g", data);
- Tcl_AppendElement(interp, s);
- }
- return TCL_OK;
-}
-
-int
-tkctfInfoEvaluateCmd(ClientData clientData, Tcl_Interp* interp, int argc, CONST char* argv[])
-{
- return TCL_OK;
-}
-
+++ /dev/null
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay ./ctfDisplay.wish
-../I686LINUX/ctfDisplay
-../I686LINUX/ctfDisplay -h
-../I686LINUX/ctfDisplay -i /home/people/tacyas/Eos/data/mrcFFTSpectrum/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft -o ../test/data/test/ctfinfo
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft -o ../test/data/test/ctfinfo
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft -o ../test/data/test/ctfinfo
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft -o ../test/data/test/test.ctfinfo
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft -o ../test/data/test/test.ctfinfo
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft -o ../test/data/test/test.ctfinfo
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft -o ../test/data/test/test.ctfinfo
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft -o ../test/data/test/test.ctfinfo
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay.debug -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-/home/people/tacyas/Eos/bin/I686LINUX/mrcInfo -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft =n 4
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 4
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft P
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 4
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 4
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 4
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 4
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 4
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 4
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft -n 8
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 8
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 8
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 8
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 8
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 8 -axis 45
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 12 -axis 45
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 12 -axis 45
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft -n
-/home/people/tacyas/Eos/bin/I686LINUX/Display2 -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 12 -axis 45
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 12
-/home/people/tacyas/Eos/bin/I686LINUX/mrcFFTSpectrum -i ../test/data/test.ctffft -n 12
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft q
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../I686LINUX/ctfDisplay -i ../test/data/test.ctffft
-../X86LINUX64/ctfDisplay.debug
-/home/people/koyasako/Eos/bin/X86LINUX64/ctfDisplay
-/home/people/koyasako/Eos/bin/X86LINUX64/ctfDisplay
-/home/people/koyasako/Eos/bin/X86LINUX64/ctfDisplay
-/home/people/koyasako/Eos/bin/X86LINUX64/ctfDisplay
-/home/people/koyasako/Eos/bin/X86LINUX64/mrcInfo -h
+++ /dev/null
-#!../I686LINUX/ctfDisplay
-#
-#
-# ctfDisplay
-#
-#
-set program ctfDisplay
-
-##
-# library load
-if [ file exists $program.wish ] {
- lappend auto_path [ pwd ]
- auto_mkindex [ pwd ] *.wish
-}
-
-proc libraryLoad { program } {
- global tcl_version
- global env
- global auto_path
-
- ## Environment Set
- set CurrentDir [ pwd ]
- #puts "CurrentDir: $CurrentDir"
-
- if [info exists env(EOS_HOME)] {
- set path $env(EOS_HOME)/bin/wish/$program
- } else {
- set path [ pwd ]
- }
-
- if [info exists env(EOS_HOME)] {
- set libpath $env(EOS_HOME)/lib
- lappend auto_path $libpath
- auto_mkindex $libpath *.wish
- } else {
- set libpath {}
- }
- lappend auto_path $path
- lappend auto_path $libpath
- auto_mkindex $path *.wish
- auto_mkindex $libpath *.wish
-
- puts $libpath ; flush stdout
- puts $path ; flush stdout
- # Unless the shells are found,
- if ![file exists $path/$program.wish] {
- tk_dialog .d "Error:" "Wrong Directory!" error 0 OK
- exit 0
- }
-
- # BLT Command Add
- if { $tcl_version >= 8.0 } {
- catch { namespace import blt::* }
- } else {
- catch { import add blt }
- }
-
- if { [ info commands "namespace" ] == "namespace" } {
- if { $tcl_version >= 8.0 } {
- catch { namespace import -force blt::tile::* }
- } else {
- catch { import add blt::tile }
- }
- } else {
- foreach cmd { button checkbutton radiobutton frame label scrollbar toplevel menubutton listbox } {
- if { [info command tile${cmd}] == "tile${cmd}" } {
- rename ${cmd} ""
- rename tile${cmd} ${cmd}
- }
- }
- }
-}
-
-namespace eval CTF2D {
- variable ctfInfo
- namespace export
-#
-#
-#
-proc Init { { mrc __null__ } } {
- variable ctfInfo
- global inMRC
- global outCTF
- global outPS
-
- if { [ info exists inMRC ] } {
- set ctfInfo(filename) $inMRC
- } else {
- if { $mrc == "__null__" } {
- set ctfInfo(filename) ""
- } else {
- set ctfInfo(filename) $mrc
- }
- }
- if { [ info exists outCTF ] } {
- set ctfInfo(.ctfinfo) $outCTF
- } else {
- set ctfInfo(.ctfinfo) [ file rootname $inMRC ].ctfinfo
- }
- if { [ info exists outPS ] } {
- set ctfInfo(.ctfps) $outCTF
- } else {
- set ctfInfo(.ctfps) [ file rootname $inMRC ].ctfps
- }
- set ctfInfo(numDivision) 4
- ::CTF::Init "filename $ctfInfo(filename)"
- ctfInfoSync
- ::CTF::ctfInfoLoad $ctfInfo(.ctfinfo)
-
- ScatteringCalc $ctfInfo(filename)
-}
-
-#
-#
-#
-proc ctfInfoSync { } {
- variable ctfInfo
-
- set tmp [ array get ctfInfo ]
- array set ctfInfo "[ ::CTF::ctfInfoListGet ] $tmp"
- ::CTF::ctfInfoAppend [ array get ctfInfo ]
-}
-#
-#
-#
-proc Win { { win __null__ } { filename __null__ } { extension 2 } } {
- variable ctfInfo
-
- if { $win == "__null__" } {
- set w ""
- } else {
- if [ catch { toplevel $win } ] {
- raise $win
- return
- } else {
- set w $win
- }
- }
- SpectrumFrameCreate $w.spectrum top
- InfoFrameCreate $w.information right
- set f [ frame $w.graph ]
- GraphFrameCreate $f.graph0 0 top
- GraphFrameCreate $f.graph1 1 bottom
-
- pack $f.graph0 $f.graph1 -side top
- pack $w.spectrum -side left
- pack $w.graph -side left
- pack $w.information -side right -expand y
-}
-
-proc SpectrumFrameCreate { f side } {
- frame $f
-
- Canvas $f.canvas0 256 256
- Canvas $f.canvas1 256 256
- pack $f.canvas0 -side top
- pack $f.canvas1 -side top
-}
-
-proc GraphFrameCreate { f which side } {
- variable ctfInfo
- frame $f
-
- label $f.label -text "defocus-$which"
- set ctfInfo([subst $which],graph) [ graph $f.graph ]
- puts "graph: $ctfInfo($which,graph) $which"; flush stdout
- pack $f.label $f.graph -side top -expand true
-}
-
-proc InfoFrameCreate { f side } {
- variable ctfInfo
-
- frame $f
-
- # Scattering Information: Scattering/SubtractScattering
- set cmd "[ namespace code {ctfInfoGraphUpdate} ]"
- set name [ namespace current ]::
-
- #
- set ff [ frame $f.graph ]
- checkbutton $ff.graph -text "Scattering" -variable [subst $name]ctfInfo(flagScatGraph) -command $cmd
- checkbutton $ff.graphsub -text "Subtract" -variable [subst $name]ctfInfo(flagScatGraphSubtraction) -command $cmd
- checkbutton $ff.log -text "Log" -variable [subst $name]ctfInfo(flagLogScale) -command $cmd
- pack $ff.graph $ff.graphsub $ff.log -side left
-
- # Scattering Graph Configure
- set ff [ frame $f.graphConfig ]
- CommandEntryWithUpDown $ff.intensity Imax 10 $cmd [subst $name]ctfInfo(Imax) [subst $name]ctfInfo(dImax) -width 10
- CommandEntryWithUpDown $ff.imin Imin 10 $cmd [subst $name]ctfInfo(Imin) [subst $name]ctfInfo(dImin) -width 10
- CommandEntryWithUpDown $ff.brmax Rmax 10 $cmd [subst $name]ctfInfo(Rmax) [subst $name]ctfInfo(dRmax) -width 10
- CommandEntryWithUpDown $ff.brmin Rmin 10 $cmd [subst $name]ctfInfo(Rmin) [subst $name]ctfInfo(dRmin) -width 10
- pack $ff.intensity $ff.imin $ff.brmax $ff.brmin -side top
-
-
- #
- set ff [ frame $f.ctfConfig ]
- label $ff.label -text "-------"
- CommandEntryWithUpDown $ff.defocus0 Defocus0 10 $cmd [subst $name]ctfInfo(defocus2D0) [subst $name]ctfInfo(ddefocus2D0) -width 10
- CommandEntryWithUpDown $ff.defocus1 Defocus1 10 $cmd [subst $name]ctfInfo(defocus2D1) [subst $name]ctfInfo(ddefocus2D1) -width 10
- CommandEntryWithUpDown $ff.axis AxisFor0 10 $cmd [subst $name]ctfInfo(defocus0axis) [subst $name]ctfInfo(ddefocus0axis) -width 10
- CommandEntryWithUpDown $ff.aoverp AoverP 10 $cmd [subst $name]ctfInfo(AoverP) [subst $name]ctfInfo(dAoverP) -width 10
- CommandEntryWithUpDown $ff.isignal Isignal 10 $cmd [subst $name]ctfInfo(Isignal) [subst $name]ctfInfo(dIsignal) -width 10
- CommandEntryWithUpDown $ff.inoise Inoise 10 $cmd [subst $name]ctfInfo(Inoise) [subst $name]ctfInfo(dInoise) -width 10
- CommandEntryWithUpDown $ff.mtf MTF 10 $cmd [subst $name]ctfInfo(MTF) [subst $name]ctfInfo(dMTF) -width 10
-
- #button $ff.detail -text "Detail" -command "::CTF::ctfInfoCTFInfoFrameCreate $ff.ctf left"
- pack $ff.label $ff.defocus0 $ff.defocus1 $ff.axis $ff.aoverp $ff.isignal $ff.inoise $ff.mtf -side top
-
- #
- # File Frame
- #
- set ff [ frame $f.file ]
- set name [ namespace current ]::
-
- label $ff.label -text "----------"
- # Info
- set fff [ frame $ff.saveInfo ]
- button $fff.printInfo -text "Save" -command "[subst $name]ctfInfoSave"
- CommandEntry $fff.printInfoEntry Info 5 "[subst $name]ctfInfoSave" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.printInfo $fff.printInfoEntry -side left
-
- # InfoLoad
- set fff [ frame $ff.loadInfo ]
- button $fff.loadInfo -text "Load" -command "[subst $name]ctfInfoLoad"
- CommandEntry $fff.loadInfoEntry Info 5 "[subst $name]ctfInfoLoad" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.loadInfo $fff.loadInfoEntry -side left
-
- pack $ff.label $ff.saveInfo $ff.loadInfo -side top
-
-
- #
- # CTF Frame2
- #
- set ff [ frame $f.ctfConfig2 ]
-
- label $ff.label -text "---------"
- set fff [ frame $ff.f1 ]
- CommandEntry $fff.kV "kV kV " 10 $cmd -textvar "[subst $name]ctfInfo(kV)" -width 6
- CommandEntry $fff.ai "Ai mrad " 10 $cmd -textvar "[subst $name]ctfInfo(Ai)" -width 6
- pack $fff.kV $fff.ai -side left
-
- set fff [ frame $ff.f2 ]
- CommandEntry $fff.cs "Cs mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cs)" -width 6
- CommandEntry $fff.cc "Cc mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cc)" -width 6
- pack $fff.cs $fff.cc -side left
-
- set fff [frame $ff.f3 ]
- RadioButtonsCreateWithPackWithCommand $fff.which MTF $cmd left [subst $name]ctfInfo(whichMTF) singleExp Lorentz Linear Polynomial
- pack $fff.which -side left
-
- set fff [ frame $ff.f4 ]
- checkbutton $fff.aliasing -text "Aliasing" -variable [subst $name]ctfInfo(flagAliasing) -command $cmd
- checkbutton $fff.sampling -text "Sampling" -variable [subst $name]ctfInfo(flagSampling) -command $cmd
- pack $fff.aliasing $fff.sampling -side left
-
- pack $ff.label $ff.f1 $ff.f2 $ff.f3 $ff.f4 -side top
- #
- # File Frame 2
- #
-
- set ff [ frame $f.file2 ]
- # FFT
- set fff [ frame $ff.loadFFT ]
- button $fff.loadFFT -text "Load" -command ""
- CommandEntry $fff.loadFFTEntry Data 5 "" -textvar [subst $name]ctfInfo(filename)
- pack $fff.loadFFT $fff.loadFFTEntry -side left
-
- #PS
- set fff [ frame $ff.printPS ]
- button $fff.printPS -text "Save" -command "[subst $name]ctfInfoSaveAsPS"
- CommandEntry $fff.printPSEntry Graph 5 "[subst $name]ctfInfoSaveAsPS" -textvar [subst $name]ctfInfo(.ctfps)
- pack $fff.printPS $fff.printPSEntry -side left
-
- pack $ff.loadFFT $ff.printPS -side top
-
-
-
- # Packing
- pack \
- $f.graph \
- $f.graphConfig \
- $f.ctfConfig \
- $f.file \
- $f.ctfConfig2 \
- $f.file2 \
- -side top -expand true
- return $f
-}
-#
-#
-#
-proc ctfInfoGraphUpdate { {which 0} } {
- variable ctfInfo
- puts "Graph Update"
- ctfInfoSync
-
- if { $ctfInfo(flagScatGraph) == 1 } {
- ScatteringLineCreate Scattering$which $ctfInfo([subst $which],graph) ctfInfo($which,R) ctfInfo($which,Scattering)
- } else {
- catch { $ctfInfo([subst $which],graph) element delete Scattering$which }
- }
- if { $ctfInfo(flagScatGraphSubtraction) == 1 } {
- catch { ScatteringLineCreate ScatteringSubtraction$which $ctfInfo([subst $which],graph) ctfInfo($which,R) ctfInfo($which,ScatteringSubtraction) }
- } else {
- catch { $ctfInfo([subst $which],graph) element delete ScatteringSubtraction$which }
- }
- CTFLineCreate $ctfInfo([subst $which],graph) $which
-
- GraphConfiguration $which
-}
-#
-# Thon Ring marker
-#
-proc MarkerSet { which } {
- variable ctfInfo
-
- ctfInfoMarkerUnset
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- $ctfInfo([subst $which],graph) marker create line -name zero$which$i \
- -coords { $ctfInfo([subst $which],zero$i) 0 \
- $ctfInfo([subst $which],zero$i) 1 }
- $ctfInfo($which,graph) marker configure zero$which$i -dashes { 2 2 }
- }
-}
-
-# Marker Unset
-proc MarkerUnset { which } {
- variable ctfInfo
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- catch { $ctfInfo([subst $which],graph) marker delete zero$which$i }
- }
-}
-
-#
-#
-#
-proc PredictedThonRing { which } {
- variable ctfInfo
-
- set size [ llength $ctfInfo($which,R) ]
- set dR [ expr [lindex $ctfInfo($which,R) 1]-[lindex $ctfInfo($which,R) 0]]
- set RMax [ lindex $ctfInfo($which,R) [expr $size-1] ]
- set Zero [ ctfInfoGet Zero$which $RMax $ctfInfo(predictZeroMaxMax) $dR ]
- set ctfInfo(predictZeroMax) [ expr [ llength $Zero ] / 3 ]
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ctfInfo($which,predictZero$i) [ lindex $Zero [ expr 3*$i ] ]
- set ctfInfo($which,predictZeroCTF$i) [ expr 0.8*$ctfInfo(Imax) ]
- set data [ lindex $Zero [ expr 3*$i + 1 ] ]
- set data1 [ lindex $Zero [ expr 3*$i + 2 ] ]
- if { $ctfInfo(flagCTFPower) == 1 } {
- set ctfInfo($which,predictZeroCTF$i) [ expr $data*$data + $data1*$data1 ]
- } else {
- set ctfInfo($which,predictZeroCTF$i) [ expr $data + $data1 ]
- }
- }
- set ctfInfo($which,flagpredictThonRing) 1
-}
-
-#
-# PredictedMarker of ThonRing on graph
-#
-proc PredictedMarkerSet { which } {
- variable ctfInfo
-
- # Zero Point
- PredictedThonRing $which
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ymax [ expr 1.2*$ctfInfo($which,predictZeroCTF$i) ]
- $ctfInfo([subst $which],graph) marker create line -name predictZero$which$i -coords {
- $ctfInfo($which,predictZero$i) 0 \
- $ctfInfo($which,predictZero$i) $ymax }
- }
- set ctfInfo($which,flagpredictZero) 1
-}
-
-#
-proc PredictedMarkerUnset { which } {
- variable ctfInfo
- if { $ctfInfo($which,flagpredictZero) == 1 } {
- for { set i 1 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- catch { $ctfInfo([subst $which],graph) marker delete predictZero$which$i }
- }
- }
- set ctfInfo($which,flagpredictZero) 0
-}
-#
-proc MarkerReset { which } {
- variable ctfInfo
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- if [ info exists ctfInfo(predictZero$i) ] {
- set ctfInfo(zero$i) $ctfInfo(predictZero$i)
- } else {
- puts "ctfInfo(zeroMax) is wrong at $i: $ctfInfo(zeroMax)"
- break
- }
- }
- ctfInfoMarkerSet
-}
-
-proc ScatteringLineCreate { name g x y } {
- puts $x,$y
- upvar $x xx
- upvar $y yy
- # Drawing Graph (Scattering)
- catch { $g element delete $name }
- $g element create $name -xdata $xx -ydata $yy
- $g element configure $name -pen scatPen
-}
-
-#
-#
-#
-proc CTFLineCreate { g which } {
- variable ctfInfo
-
- # CTF Calc
- CTFCalculation $which
-
- # Graph Delete
- catch { $g element delete CTF$which }
- catch { $g element delete CTFcore$which }
- catch { $g element delete Noise$which }
-
- # Markder Unset
- PredictedMarkerUnset
-
- # Signal + Noise
- if { $ctfInfo(flagCTFGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) == 1 } {
- $g element create CTF$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFPower)
- $g element create Noise$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFNoisePower)
- } else {
- $g element create CTF$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTF)
- $g element create Noise$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFNoise)
- }
- $g element configure CTF$which -pen ctfPen
- $g element configure Noise$which -pen ctfPen
-
- PredictedMarkerSet
- }
-
- # Signal Only
- if { $ctfInfo(flagCTFcoreGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) } {
- $g element create CTFcore$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFSignalPower)
- } else {
- $g element create CTFcore$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFSignal)
- }
- $g element configure CTFcore[subst $which], -pen ctfPen
- }
- if { $ctfInfo(flagThonRingOnCanvas) == 1 } {
- PredictedMarkerOnCanvas
- }
-
- # Configuration
- GraphConfiguration
-}
-
-
-proc GraphConfiguration { which } {
- variable ctfInfo
-
- set g $ctfInfo([subst $which],graph)
-
- $g configure -title "CTF($ctfInfo(filename))"
- $g axis configure x -title "R" -loose yes -max $ctfInfo(Rmax) -hide no
- $g axis configure y -title "Intensity" -loose yes -max $ctfInfo(Imax) -hide no
- $g legend configure -position top -hide no
- $g axis configure x -max $ctfInfo(Rmax)
- $g axis configure x -min $ctfInfo(Rmin)
- $g axis configure y -max $ctfInfo(Imax)
- $g axis configure y -min $ctfInfo(Imin)
- if { $ctfInfo(flagLogScale) == 1 } {
- if { $ctfInfo(Imin) <= 0 } {
- set ctfInfo(Imin) [ expr $ctfInfo(Imax)*1e-6 ]
- }
- $g axis configure y -logscale yes
- } else {
- $g axis configure y -logscale no
- }
- ctfInfoGraphPenCreate
-
- Blt_ZoomStack $g
- Blt_Crosshairs $g
- Blt_ActiveLegend $g
- Blt_ClosestPoint $g
-}
-
-#
-proc GraphPenCreate { which } {
- variable ctfInfo
-
- set g $ctfInfo([subst $which],graph)
- catch { $g pen create scatPen }
- $g pen configure scatPen -pixels 0 -color blue
- catch { $g pen create ctfPen }
- $g pen configure ctfPen -pixels 0 -color red
-}
-
-proc CTFInformationSet { } {
- ctfInfoSync
- ::CTF::ctfInfoCTFInformationSet
-}
-
-proc CTFCalculation { which } {
- variable ctfInfo
-
- # Information Set
- CTFInfomationSet
-
- # Data Unset
- catch { unset ctfInfo($which,CTF) }
- catch { unset ctfInfo($which,CTFPower) }
- catch { unset ctfInfo($which,CTFcore) }
- catch { unset ctfInfo($which,CTFcorePower) }
- catch { unset ctfInfo($which,CTFNoise) }
- catch { unset ctfInfo($which,CTFNoisePower) }
- catch { unset ctfInfo($which,CTFSignal) }
- catch { unset ctfInfo($which,CTFSignalPower) }
- catch { unset ctfInfo($which,ScatteringSubtraction) }
-
- # Data Set
- set size [ llength $ctfInfo($which,R) ]
- if { $ctfInfo(flagCTFPower) } {
- set ctfInfo($which,CTFPower) [ ctfInfoCalc2D CTFPower $which ]
- set ctfInfo($which,CTFcorePower) [ ctfInfoCalc2D CTFcorePower $which ]
- set ctfInfo($which,CTFNoisePower) [ ctfInfoCalc2D CTFNoisePower $which ]
- set ctfInfo($which,CTFSignalPower) [ ctfInfoCalc2D CTFSignalPower $which ]
- } else {
- set ctfInfo($which,CTF) [ ctfInfoCalc2D CTF $which ]
- set ctfInfo($which,CTFcore) [ ctfInfoCalc2D CTFcore $which ]
- set ctfInfo($which,CTFNoise) [ ctfInfoCalc2D CTFNoise $whcih ]
- set ctfInfo($which,CTFSignal) [ ctfInfoCalc2D CTFSignal $which ]
- }
- for { set i 0 } { $i < $size } { incr i } {
- set data [ lindex $ctfInfo($which,Scattering) $i ]
- if { $ctfInfo(flagCTFPower) } {
- set noise [ lindex $ctfInfo($which,CTFNoisePower) $i ]
- } else {
- set noise [ lindex $ctfInfo($which,CTFNoise) $i ]
- }
- lappend ctfInfo($which,ScatteringSubtraction) [ expr $data - $noise ]
- }
-}
-
-#
-# Scattering Data
-#
-proc ScatteringCalc { { filename __null__ } } {
- variable ctfInfo
-
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- } else {
- puts "no file for Scattering calc."
- return
- }
- }
- set xy [ mrcInfoGet $filename Spectrum2D $ctfInfo(defocus0axis) $ctfInfo(numDivision) ]
- puts $xy
- for { set i 0 } { $i < $ctfInfo(numDivision) } { incr i } {
- catch { unset ctfInfo(all,$i,R) }
- catch { unset ctfInfo(all,$i,Scattering) }
- catch { unset ctfInfo(all,$i,ScatteringRoot) }
- foreach { x y } $xy {
- if {$x == "NULL" && $y == "NULL" } {
- set ctfInfo($i,NyquistFrequency) [ lindex $ctfInfo($i,R) end ]
- break
- } else {
- lappend ctfInfo(all,$i,R) $x
- lappend ctfInfo(all,$i,Scattering) $y
- lappend ctfInfo(all,$i,ScatteringRoot) [ expr sqrt($y) ]
- }
- }
- }
-
- set size [ llength $ctfInfo(all,0,R) ]
- catch { unset ctfInfo(0,R) }
- catch { unset ctfInfo(0,Scattering) }
- catch { unset ctfInfo(0,ScatteringRoot) }
- catch { unset ctfInfo(1,R) }
- catch { unset ctfInfo(1,Scattering) }
- catch { unset ctfInfo(1,ScatteringRoot) }
-
- set index0 0
- set index1 [expr $ctfInfo(numDivision) / 4 ]
-
- for { set i 0 } { $i < $size } { incr i } {
- lappend ctfInfo(0,R) $ctfInfo($index0,R)
- lappend ctfInfo(0,Scattering) $ctfInfo($index0,Scattering)
- lappend ctfInfo(0,ScatteringRoot) $ctfInfo($index0,ScatteringRoot)
- lappend ctfInfo(1,R) $ctfInfo($index1,R)
- lappend ctfInfo(1,Scattering) $ctfInfo($index1,Scattering)
- lappend ctfInfo(1,ScatteringRoot) $ctfInfo($index1,ScatteringRoot)
- }
-}
-
-proc ctfInfoSave { } {
- variable ctfInfo
-
- ::CTF::ctfInfoSave $ctfInfo(.ctfinfo)
-}
-
-proc ctfInfoLoad { { filename __null__ } } {
- variable ctfInfo
-
- ::CTF::ctfInfoLoad $ctfInfo(.ctfinfo)
-}
-
-
-#end of CTF2Dnamespace
-}
-
-#
-# Main
-#
-
-bind all <Control-KeyPress-c> { exit 0 }
-bind all <KeyPress-q> { exit 0 }
-
-libraryLoad $program
-
-#catch [ namespace import ::CTF::ctfInfo* ]
-
-global mainImage
-
-::CTF2D::Init
-::CTF2D::Win
+++ /dev/null
-#!../I686LINUX/ctfDisplay
-#
-#
-# ctfDisplay
-#
-#
-set program ctfDisplay
-
-##
-# library load
-if [ file exists $program.wish ] {
- lappend auto_path [ pwd ]
- auto_mkindex [ pwd ] *.wish
-}
-
-proc libraryLoad { program } {
- global tcl_version
- global env
- global auto_path
-
- ## Environment Set
- set CurrentDir [ pwd ]
- #puts "CurrentDir: $CurrentDir"
-
- if [info exists env(EOS_HOME)] {
- set path $env(EOS_HOME)/bin/wish/$program
- } else {
- set path [ pwd ]
- }
-
- if [info exists env(EOS_HOME)] {
- set libpath $env(EOS_HOME)/lib
- lappend auto_path $libpath
- auto_mkindex $libpath *.wish
- } else {
- set libpath {}
- }
- lappend auto_path $path
- lappend auto_path $libpath
- auto_mkindex $path *.wish
- auto_mkindex $libpath *.wish
-
- #puts $libpath ; flush stdout
- #puts $path ; flush stdout
- # Unless the shells are found,
- if ![file exists $path/$program.wish] {
- tk_dialog .d "Error:" "Wrong Directory!" error 0 OK
- exit 0
- }
-
- # BLT Command Add
- if { $tcl_version >= 8.0 } {
- catch { namespace import blt::* }
- } else {
- catch { import add blt }
- }
-
- if { [ info commands "namespace" ] == "namespace" } {
- if { $tcl_version >= 8.0 } {
- catch { namespace import -force blt::tile::* }
- } else {
- catch { import add blt::tile }
- }
- } else {
- foreach cmd { button checkbutton radiobutton frame label scrollbar toplevel menubutton listbox } {
- if { [info command tile${cmd}] == "tile${cmd}" } {
- rename ${cmd} ""
- rename tile${cmd} ${cmd}
- }
- }
- }
-}
-
-namespace eval CTF2D {
- variable ctfInfo
- variable fftPattern
- namespace export
-#
-#
-#
-proc Init { { mrc __null__ } } {
- variable ctfInfo
- global inMRC
- global outCTF
- global outPS
- global Rmax
- global Imax
- global Imin
- global flagLog
-
- if { [ info exists inMRC ] } {
- set ctfInfo(filename) $inMRC
- } else {
- if { $mrc == "__null__" } {
- set ctfInfo(filename) ""
- } else {
- set ctfInfo(filename) $mrc
- }
- }
-
- ::CTF::Init "filename $ctfInfo(filename)"
- ctfInfoSync
-
- if { [ info exists outCTF ] } {
- set ctfInfo(.ctfinfo) $outCTF
- } else {
- set ctfInfo(.ctfinfo) [ file rootname $inMRC ].ctfinfo
- }
- if { [ info exists outPS ] } {
- set ctfInfo(.ctfps) $outCTF
- } else {
- set ctfInfo(.ctfps) [ file rootname $inMRC ].ctfps
- }
-
- if { [ info exists Rmax ] } {
- set ctfInfo(Rmax) $Rmax
- }
- if { [ info exists Imax ] } {
- set ctfInfo(Imax) $Imax
- }
- if { [ info exists Imin] } {
- set ctfInfo(Imin) $Imin
- }
- if { [ info exist flagLog ] } {
- set ctfInfo(flagLogScale) $flagLog
- }
-
- set ctfInfo(numDivision) 12
-
- ctfInfoSync
- ::CTF::ctfInfoLoad $ctfInfo(.ctfinfo)
-
- ScatteringCalc $ctfInfo(filename)
-
- set ctfInfo(flagThonRingOnCanvas) 1
-}
-
-#
-#
-#
-proc ctfInfoSync { } {
- variable ctfInfo
-
- set tmp [ array get ctfInfo ]
- array set ctfInfo "[ ::CTF::ctfInfoListGet ] $tmp"
- ::CTF::ctfInfoAppend [ array get ctfInfo ]
-}
-
-proc ctfInfoUpload { } {
- variable ctfInfo
-
- set tmp [ array get ::CTF::ctfInfo ]
- array set ctfInfo "[ ::CTF::ctfInfoListGet ] $tmp"
-}
-#
-#
-#
-proc Win { { win __null__ } { filename __null__ } { extension 2 } } {
- variable ctfInfo
-
- if { $win == "__null__" } {
- set w ""
- } else {
- if [ catch { toplevel $win } ] {
- raise $win
- return
- } else {
- set w $win
- }
- }
- SpectrumFrameCreate $w.spectrum top
- InfoFrameCreate $w.information right
- set f [ frame $w.graph ]
- GraphFrameCreate $f.graph0 0 top
- GraphFrameCreate $f.graph1 1 bottom
- pack $f.graph0 -side top -expand true -fill both
- pack $f.graph1 -side bottom -expand true -fill both
-
- pack $w.information -side right -expand true
- pack $w.graph -side right -expand true -fill both
- pack $w.spectrum -side left -expand true
-
- GraphUpdate
-}
-
-proc SpectrumFrameCreate { f side } {
- variable ctfInfo
- variable fftPattern
- frame $f
-
- set fftPattern(width) 512
- set fftPattern(height) 512
-
- set fftPattern(canvas) $f.canvas
- scrolledCanvas $f.canvas $fftPattern(width) $fftPattern(height) [ list 0 0 [ expr 2*$fftPattern(width)] [expr 2*$fftPattern(height)] ]
- pack $f.canvas -side top -expand yes
-
- SpectrumPut $f.canvas $ctfInfo(filename)
-
-}
-
-proc GraphFrameCreate { f which side } {
- variable ctfInfo
- frame $f
-
- label $f.label -text "defocus-$which"
- set ctfInfo([subst $which],graph) [ graph $f.graph ]
- #puts "graph: $ctfInfo($which,graph) $which"; flush stdout
- #pack $f.label $f.graph -side top -expand true
- pack $f.graph -side $side -expand true -fill both
-}
-
-proc InfoFrameCreate { f side } {
- variable ctfInfo
-
- frame $f
-
- # Scattering Information: Scattering/SubtractScattering
- set cmd "[ namespace code {GraphUpdate} ]"
- set cmd2 "[ namespace code {GraphRedraw} ]"
- set cmd3 "[ namespace code {SpectrumRedraw}]; [ namespace code {GraphRedraw} ]; "
- set name [ namespace current ]::
-
- #
- set ff [ frame $f.graph ]
- checkbutton $ff.graph -text "Scattering" -variable [subst $name]ctfInfo(flagScatGraph) -command $cmd3
- checkbutton $ff.graphsub -text "Subtract" -variable [subst $name]ctfInfo(flagScatGraphSubtraction) -command $cmd
- checkbutton $ff.log -text "Log" -variable [subst $name]ctfInfo(flagLogScale) -command $cmd3
- pack $ff.graph $ff.graphsub $ff.log -side left
-
- # Scattering Graph Configure
- set ff [ frame $f.graphConfig ]
- CommandEntryWithUpDown $ff.intensity Imax 10 $cmd3 [subst $name]ctfInfo(Imax) [subst $name]ctfInfo(dImax) -width 6
- CommandEntryWithUpDown $ff.imin Imin 10 $cmd3 [subst $name]ctfInfo(Imin) [subst $name]ctfInfo(dImin) -width 6
- CommandEntryWithUpDown $ff.brmax Rmax 10 $cmd3 [subst $name]ctfInfo(Rmax) [subst $name]ctfInfo(dRmax) -width 6
- CommandEntryWithUpDown $ff.brmin Rmin 10 $cmd [subst $name]ctfInfo(Rmin) [subst $name]ctfInfo(dRmin) -width 6
- pack $ff.intensity $ff.imin $ff.brmax $ff.brmin -side top
-
-
- #
- set ff [ frame $f.ctfConfig ]
- label $ff.label -text "-------"
- CommandEntryWithUpDown $ff.defocus0 Defocus0 10 $cmd [subst $name]ctfInfo(defocus2D0) [subst $name]ctfInfo(ddefocus2D0) -width 6
- CommandEntryWithUpDown $ff.defocus1 Defocus1 10 $cmd [subst $name]ctfInfo(defocus2D1) [subst $name]ctfInfo(ddefocus2D1) -width 6
- CommandEntryWithUpDown $ff.axis AxisFor0 10 $cmd2 [subst $name]ctfInfo(defocus0axis) [subst $name]ctfInfo(ddefocus0axis) -width 6
- CommandEntryWithUpDown $ff.aoverp AoverP 10 $cmd [subst $name]ctfInfo(AoverP) [subst $name]ctfInfo(dAoverP) -width 6
- CommandEntryWithUpDown $ff.isignal Isignal 10 $cmd [subst $name]ctfInfo(Isignal) [subst $name]ctfInfo(dIsignal) -width 6
- CommandEntryWithUpDown $ff.inoise Inoise 10 $cmd [subst $name]ctfInfo(Inoise) [subst $name]ctfInfo(dInoise) -width 6
- CommandEntryWithUpDown $ff.mtf MTF 10 $cmd [subst $name]ctfInfo(MTF) [subst $name]ctfInfo(dMTF) -width 6
- CommandEntryWithUpDown $ff.mtf2 MTF2 10 $cmd [subst $name]ctfInfo(MTF2) [subst $name]ctfInfo(dMTF2) -width 6
-
- #button $ff.detail -text "Detail" -command "::CTF::ctfInfoCTFInfoFrameCreate $ff.ctf left"
- pack $ff.label $ff.defocus0 $ff.defocus1 $ff.axis $ff.aoverp $ff.isignal $ff.inoise $ff.mtf $ff.mtf2 -side top
-
- #
- # File Frame
- #
- set ff [ frame $f.file ]
- set name [ namespace current ]::
-
- label $ff.label -text "----------"
- # Info
- set fff [ frame $ff.saveInfo ]
- button $fff.printInfo -text "Save" -command "[subst $name]ctfInfoSave"
- CommandEntry $fff.printInfoEntry Info 5 "[subst $name]ctfInfoSave" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.printInfo $fff.printInfoEntry -side left
-
- # InfoLoad
- set fff [ frame $ff.loadInfo ]
- button $fff.loadInfo -text "Load" -command "[subst $name]ctfInfoLoad"
- CommandEntry $fff.loadInfoEntry Info 5 "[subst $name]ctfInfoLoad" -textvar [subst $name]ctfInfo(.ctfinfo)
- pack $fff.loadInfo $fff.loadInfoEntry -side left
-
- pack $ff.label $ff.saveInfo $ff.loadInfo -side top
-
-
- #
- # CTF Frame2
- #
- set ff [ frame $f.ctfConfig2 ]
-
- label $ff.label -text "---------"
- set fff [ frame $ff.f1 ]
- CommandEntry $fff.kV "kV kV " 10 $cmd -textvar "[subst $name]ctfInfo(kV)" -width 6
- CommandEntry $fff.ai "Ai mrad " 10 $cmd -textvar "[subst $name]ctfInfo(Ai)" -width 6
- pack $fff.kV $fff.ai -side left
-
- set fff [ frame $ff.f2 ]
- CommandEntry $fff.numDiv "nDivision " 10 $cmd -textvar "[subst $name]ctfInfo(numDivision)" -width 6
- pack $fff.numDiv -side left
-
- set fff [ frame $ff.f3 ]
- CommandEntry $fff.cs "Cs mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cs)" -width 6
- CommandEntry $fff.cc "Cc mm " 10 $cmd -textvar "[subst $name]ctfInfo(Cc)" -width 6
- pack $fff.cs $fff.cc -side left
-
- set fff [frame $ff.f4 ]
- RadioButtonsCreateWithPackWithCommand $fff.which MTF $cmd left [subst $name]ctfInfo(whichMTF) singleExp Lorentz Linear Polynomial
- pack $fff.which -side left
-
- set fff [ frame $ff.f5 ]
- checkbutton $fff.aliasing -text "Aliasing" -variable [subst $name]ctfInfo(flagAliasing) -command $cmd
- checkbutton $fff.sampling -text "Sampling" -variable [subst $name]ctfInfo(flagSampling) -command $cmd
- pack $fff.aliasing $fff.sampling -side left
-
- pack $ff.label $ff.f1 $ff.f2 $ff.f3 $ff.f4 $ff.f5 -side top
- #
- # File Frame 2
- #
-
- set ff [ frame $f.file2 ]
- # FFT
- set fff [ frame $ff.loadFFT ]
- button $fff.loadFFT -text "Load" -command "ScatteringCalc $ctfInfo(filename)"
- CommandEntry $fff.loadFFTEntry Data 5 "ScatteringCalc $ctfInfo(filename)" -textvar [subst $name]ctfInfo(filename)
- pack $fff.loadFFT $fff.loadFFTEntry -side left
-
- #PS
- set fff [ frame $ff.printPS ]
- button $fff.printPS -text "Save" -command "[subst $name]ctfInfoSaveAsPS"
- CommandEntry $fff.printPSEntry Graph 5 "[subst $name]ctfInfoSaveAsPS" -textvar [subst $name]ctfInfo(.ctfps)
- pack $fff.printPS $fff.printPSEntry -side left
-
- pack $ff.loadFFT $ff.printPS -side top
-
- #
-
- # Packing
- pack \
- $f.graph \
- $f.graphConfig \
- $f.ctfConfig \
- $f.file \
- $f.ctfConfig2 \
- $f.file2 \
- -side top -expand true
- return $f
-}
-#
-#
-#
-proc SpectrumRedraw { } {
- variable fftPattern
- variable ctfInfo
-
- ctfInfoSync
-
- SpectrumPut $fftPattern(canvas) $ctfInfo(filename)
-}
-
-proc SpectrumPut { c filename { mode 0 } } {
- variable fftPattern
- variable ctfInfo
-
- catch { image delete $fftPattern(image) }
-
- mrcInfoSet max $ctfInfo(Imax)
- if { $ctfInfo(flagLogScale) == 1 } {
- #puts log
- mrcInfoSet log
- } else {
- #puts mag
- mrcInfoSet mag
- }
-
- mrcInfoSet min $ctfInfo(Imin)
- mrcInfoSet max $ctfInfo(Imax)
-
- set fftPattern(Nx) [ mrcInfoGet $filename Nx ]
- set fftPattern(Ny) [ mrcInfoGet $filename Ny ]
- set fftPattern(lx) [ mrcInfoGet $filename Lengthx ]
- set fftPattern(ly) [ mrcInfoGet $filename Lengthy ]
-
- set NyquistFreq [ expr 1.0 / $fftPattern(lx) / 2.0 ]
- set NyquistFreqY [ expr 1.0 / $fftPattern(ly) / 2.0 ]
- set dR [ expr 1.0 /($fftPattern(lx)*$fftPattern(Nx)) ]
- set dRY [ expr 1.0 /($fftPattern(ly)*$fftPattern(Ny)) ]
-
- #puts $NyquistFreq,$dR
- if { $NyquistFreq < $ctfInfo(Rmax) } {
- puts "Nyquist Freq < Rmax: Rmax -> Nyquist Freq"
- set ctfInfo(Rmax) $NyquistFreq
- }
- set fftPattern(zoomx) [ expr ($fftPattern(width) /2.0) / ($ctfInfo(Rmax)/$dR) ]
- set fftPattern(zoomy) [ expr ($fftPattern(height)/2.0) / ($ctfInfo(Rmax)/$dR) ]
- set fftPattern(back) [ image create photo -file $filename -format MRC -height 0 -width 0 -palette 8 ]
- set backimage [ image create photo -palette 8 ]
- #set w [ expr int($fftPattern(Nx)*$fftPattern(zoomx)) ]
- #set h [ expr int($fftPattern(Ny)*$fftPattern(zoomy)) ]
- #puts $fftPattern(width),$fftPattern(height)
- #puts $w,$h,$fftPattern(Nx),$fftPattern(Ny),$fftPattern(zoomx),$fftPattern(zoomy)
- if { 1 < $fftPattern(zoomx) } {
- set dx [ expr int($ctfInfo(Rmax) / $dR ) ]
- set dy [ expr int($ctfInfo(Rmax) / $dRY ) ]
- set sub [ expr int($fftPattern(zoomx) + 0.5 ) ]
- #puts $dx,$dy
- $backimage copy $fftPattern(back) \
- -from [ expr $fftPattern(Nx)/2 - $dx ] [ expr $fftPattern(Ny)/2 - $dy ] \
- [ expr $fftPattern(Nx)/2 + $dx ] [ expr $fftPattern(Ny)/2 + $dy ] \
- -to 0 0 [ expr $fftPattern(width) - 1 ] [ expr $fftPattern(height) - 1 ] \
- -zoom $sub
- set sub [expr 1.0/$sub ]
- } else {
- #puts "Sub Sampling"
- set sub [ expr int( 1.0/$fftPattern(zoomx) + 0.5 ) ]
- set dx [ expr int( $ctfInfo(Rmax) / $dR ) ]
- set dy [ expr int( $ctfInfo(Rmax) / $dRY ) ]
- #puts $dx,$dy
- $backimage copy $fftPattern(back) \
- -from [ expr $fftPattern(Nx)/2 - $dx ] [ expr $fftPattern(Ny)/2 - $dy ] \
- [ expr $fftPattern(Nx)/2 + $dx ] [ expr $fftPattern(Ny)/2 + $dy ] \
- -to 0 0 [ expr int(2.0*$dx/$sub) ] [ expr int(2.0*$dy/$sub) ] \
- -subsample $sub
- }
- set fftPattern(sub) $sub
- set fftPattern(centrex) [expr int($dx/$sub) ]
- set fftPattern(centrey) [expr int($dy/$sub) ]
- set fftPattern(image) [ $c.canvas create image 0 0 -image $backimage -anchor nw ]
-}
-
-proc PredictedMarkerOnCanvas { c } {
- variable fftPattern
- variable ctfInfo
- set sub $fftPattern(sub)
- for { set j 0 } { $j < 2 } { incr j } {
- set angle [expr ($ctfInfo(defocus0axis) - $j * 90)/180.0*3.14159265 ]
- #puts $angle
- for { set i 0 } { $i < 3 } { incr i } {
- if [ info exists ctfInfo($j,predictZero$i) ] {
- set length [ expr ($ctfInfo($j,predictZero$i)*$fftPattern(lx)*$fftPattern(Nx))/$sub ]
- } else {
- set length 128
- }
- if [ info exists fftPattern($j,line$i) ] {
- $c.canvas delete $fftPattern($j,line$i)
- }
- if [ info exists fftPattern($j,line$i,tick) ] {
- $c.canvas delete $fftPattern($j,line$i,tick)
- }
- if [ info exists fftPattern($j,line$i,char) ] {
- $c.canvas delete $fftPattern($j,line$i,char)
- }
- set fftPattern($j,line$i) [ $c.canvas create line \
- $fftPattern(centrex) $fftPattern(centrey) \
- [ expr $length*cos($angle) + $fftPattern(centrex) ] \
- [ expr -$length*sin($angle) + $fftPattern(centrey) ] \
- -fill red -width 1 ]
- set fftPattern($j,line$i,tick) [ $c.canvas create arc \
- [ expr -$length + $fftPattern(centrex) ] \
- [ expr -$length + $fftPattern(centrey) ] \
- [ expr +$length + $fftPattern(centrex) ] \
- [ expr +$length + $fftPattern(centrey) ] \
- -style arc \
- -start [expr $angle*180.0/3.1415926563 - 360.0/$ctfInfo(numDivision)/2.0 ] \
- -extent [ expr 360.0/$ctfInfo(numDivision) ] \
- -outline red -width 1 ]
- }
- if [ info exists fftPattern($j,tag) ] {
- $c.canvas delete $fftPattern($j,tag)
- }
- set fftPattern($j,tag) [ $c.canvas create text \
- [ expr 1.2*$length*cos($angle) + $fftPattern(centrex) ] \
- [ expr -1.2*$length*sin($angle) + $fftPattern(centrey) ] \
- -text $j -fill red ]
- }
-}
-#
-#
-#
-proc GraphRedraw { } {
- ctfInfoSync
-
- ScatteringCalc
- for { set i 0 } { $i < 2 } { incr i } {
- #puts $i
- GraphUpdate0 $i
- }
-}
-
-proc GraphUpdate { } {
- ctfInfoSync
-
- for { set i 0 } { $i < 2 } { incr i } {
- #puts $i
- GraphUpdate0 $i
- }
-}
-
-proc GraphUpdate0 { which } {
- variable ctfInfo
- #puts "Graph Update"
-
- GraphConfiguration $which
-
- if { $ctfInfo(flagScatGraph) == 1 } {
- ScatteringLineCreate Scattering$which $ctfInfo($which,graph) ctfInfo($which,R) ctfInfo($which,Scattering) $which
- } else {
- catch { $ctfInfo($which,graph) element delete Scattering$which }
- }
-
- if { $ctfInfo(flagScatGraphSubtraction) == 1 } {
- catch { ScatteringLineCreate ScatteringSubtraction$which $ctfInfo($which,graph) ctfInfo($which,R) ctfInfo($which,ScatteringSubtraction) $which }
- } else {
- catch { $ctfInfo($which,graph) element delete ScatteringSubtraction$which }
- }
-
- CTFLineCreate $ctfInfo($which,graph) $which
-}
-#
-# Thon Ring marker
-#
-proc MarkerSet { which } {
- variable ctfInfo
-
- ctfInfoMarkerUnset
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- $ctfInfo([subst $which],graph) marker create line -name zero$which$i \
- -coords { $ctfInfo([subst $which],zero$i) 0 \
- $ctfInfo([subst $which],zero$i) 1 }
- $ctfInfo($which,graph) marker configure zero$which$i -dashes { 2 2 }
- }
-}
-
-# Marker Unset
-proc MarkerUnset { which } {
- variable ctfInfo
-
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- catch { $ctfInfo([subst $which],graph) marker delete zero$which$i }
- }
-}
-
-#
-#
-#
-proc PredictedThonRing { which } {
- variable ctfInfo
-
- set size [ llength $ctfInfo($which,R) ]
- set dR [ expr [lindex $ctfInfo($which,R) 1]-[lindex $ctfInfo($which,R) 0]]
- set RMax [ lindex $ctfInfo($which,R) [expr $size-1] ]
- set Zero [ ctfInfoGet Zero$which $RMax $ctfInfo(predictZeroMaxMax) $dR ]
- set ctfInfo(predictZeroMax) [ expr [ llength $Zero ] / 3 ]
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ctfInfo($which,predictZero$i) [ lindex $Zero [ expr 3*$i ] ]
- set ctfInfo($which,predictZeroCTF$i) [ expr 0.8*$ctfInfo(Imax) ]
- set data [ lindex $Zero [ expr 3*$i + 1 ] ]
- set data1 [ lindex $Zero [ expr 3*$i + 2 ] ]
- if { $ctfInfo(flagCTFPower) == 1 } {
- set ctfInfo($which,predictZeroCTF$i) [ expr $data*$data + $data1*$data1 ]
- } else {
- set ctfInfo($which,predictZeroCTF$i) [ expr $data + $data1 ]
- }
- }
- set ctfInfo($which,flagpredictThonRing) 1
-}
-
-#
-# PredictedMarker of ThonRing on graph
-#
-proc PredictedMarkerSet { which } {
- variable ctfInfo
-
- # Zero Point
- PredictedThonRing $which
-
- for { set i 0 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- set ymax [ expr 1.2*$ctfInfo($which,predictZeroCTF$i) ]
- $ctfInfo([subst $which],graph) marker create line -name predictZero$which$i -coords {
- $ctfInfo($which,predictZero$i) 0 \
- $ctfInfo($which,predictZero$i) $ymax }
- }
- set ctfInfo($which,flagpredictZero) 1
-}
-
-#
-proc PredictedMarkerUnset { which } {
- variable ctfInfo
- if { $ctfInfo($which,flagpredictZero) == 1 } {
- for { set i 1 } { $i < $ctfInfo(predictZeroMax) } { incr i } {
- catch { $ctfInfo([subst $which],graph) marker delete predictZero$which$i }
- }
- }
- set ctfInfo($which,flagpredictZero) 0
-}
-#
-proc MarkerReset { which } {
- variable ctfInfo
- for { set i 1 } { $i <= $ctfInfo(zeroMax) } { incr i } {
- if [ info exists ctfInfo(predictZero$i) ] {
- set ctfInfo(zero$i) $ctfInfo(predictZero$i)
- } else {
- puts "ctfInfo(zeroMax) is wrong at $i: $ctfInfo(zeroMax)"
- break
- }
- }
- ctfInfoMarkerSet $which
-}
-
-proc ScatteringLineCreate { name g x y which } {
- #puts $x,$y
- # Drawing Graph (Scattering)
- catch { $g element delete $name }
- if { $which == "0"} {
- upvar $x xx0
- upvar $y yy0
- $g element create $name -xdata $xx0 -ydata $yy0
- #puts $xx0
- #puts $yy0
- } else {
- upvar $x xx1
- upvar $y yy1
- $g element create $name -xdata $xx1 -ydata $yy1
- #puts $xx1
- #puts $yy1
- }
- $g element configure $name -pen scatPen$which
-}
-
-#
-#
-#
-proc CTFLineCreate { g which } {
- variable ctfInfo
- variable fftPattern
- # CTF Calc
- CTFCalculation $which
-
- # Graph Delete
- catch { $g element delete CTF$which }
- catch { $g element delete CTFcore$which }
- catch { $g element delete Noise$which }
-
- # Markder Unset
- catch { PredictedMarkerUnset $which }
-
- # Signal + Noise
- if { $ctfInfo(flagCTFGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) == 1 } {
- $g element create CTF$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFPower)
- $g element create Noise$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFNoisePower)
- } else {
- $g element create CTF$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTF)
- $g element create Noise$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFNoise)
- }
- $g element configure CTF$which -pen ctfPen$which
- $g element configure Noise$which -pen ctfPen$which
-
- PredictedMarkerSet $which
- }
-
- # Signal Only
- if { $ctfInfo(flagCTFcoreGraph) == 1 } {
- if { $ctfInfo(flagCTFPower) } {
- $g element create CTFcore$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFSignalPower)
- } else {
- $g element create CTFcore$which -xdata $ctfInfo([subst $which],R) -ydata $ctfInfo([subst $which],CTFSignal)
- }
- $g element configure CTFcore$which -pen ctfPen$which
- }
- if { $ctfInfo(flagThonRingOnCanvas) == 1 } {
- PredictedMarkerOnCanvas $fftPattern(canvas)
- }
-
- # Configuration
- GraphConfiguration $which
-}
-
-
-proc GraphConfiguration { which } {
- variable ctfInfo
-
- set g $ctfInfo([subst $which],graph)
-
- GraphPenCreate $which
- #$g configure -title "CTF($ctfInfo(filename))"
- $g axis configure x -title "R" -loose yes -max $ctfInfo(Rmax) -hide no
- $g axis configure y -title "Intensity" -loose yes -max $ctfInfo(Imax) -hide no
- $g legend configure -position top -hide no
- $g axis configure x -max $ctfInfo(Rmax)
- $g axis configure x -min $ctfInfo(Rmin)
- $g axis configure y -max $ctfInfo(Imax)
- $g axis configure y -min $ctfInfo(Imin)
- if { $ctfInfo(flagLogScale) == 1 } {
- if { $ctfInfo(Imin) <= 0 } {
- set ctfInfo(Imin) [ expr $ctfInfo(Imax)*1e-6 ]
- }
- $g axis configure y -logscale yes
- } else {
- $g axis configure y -logscale no
- }
-
- Blt_ZoomStack $g
- Blt_Crosshairs $g
- Blt_ActiveLegend $g
- Blt_ClosestPoint $g
-}
-
-#
-proc GraphPenCreate { which } {
- variable ctfInfo
-
- set g $ctfInfo([subst $which],graph)
- catch { $g pen create scatPen$which }
- $g pen configure scatPen$which -pixels 0 -color blue
- catch { $g pen create ctfPen$which }
- $g pen configure ctfPen$which -pixels 0 -color red
-}
-
-proc CTFInformationSet { } {
- ctfInfoSync
- ::CTF::ctfInfoCTFInfomationSet
-}
-
-proc CTFCalculation { which } {
- variable ctfInfo
-
- # Information Set
- CTFInformationSet
-
- # Data Unset
- catch { unset ctfInfo($which,CTF) }
- catch { unset ctfInfo($which,CTFPower) }
- catch { unset ctfInfo($which,CTFcore) }
- catch { unset ctfInfo($which,CTFcorePower) }
- catch { unset ctfInfo($which,CTFNoise) }
- catch { unset ctfInfo($which,CTFNoisePower) }
- catch { unset ctfInfo($which,CTFSignal) }
- catch { unset ctfInfo($which,CTFSignalPower) }
- catch { unset ctfInfo($which,ScatteringSubtraction) }
-
- # Data Set
- set size [ llength $ctfInfo($which,R) ]
- if { $ctfInfo(flagCTFPower) } {
- set ctfInfo($which,CTFPower) [ ctfInfoCalc2D CTFPower $which ]
- set ctfInfo($which,CTFcorePower) [ ctfInfoCalc2D CTFcorePower $which ]
- set ctfInfo($which,CTFNoisePower) [ ctfInfoCalc2D CTFNoisePower $which ]
- set ctfInfo($which,CTFSignalPower) [ ctfInfoCalc2D CTFSignalPower $which ]
- } else {
- set ctfInfo($which,CTF) [ ctfInfoCalc2D CTF $which ]
- set ctfInfo($which,CTFcore) [ ctfInfoCalc2D CTFcore $which ]
- set ctfInfo($which,CTFNoise) [ ctfInfoCalc2D CTFNoise $whcih ]
- set ctfInfo($which,CTFSignal) [ ctfInfoCalc2D CTFSignal $which ]
- }
- for { set i 0 } { $i < $size } { incr i } {
- set data [ lindex $ctfInfo($which,Scattering) $i ]
- if { $ctfInfo(flagCTFPower) } {
- set noise [ lindex $ctfInfo($which,CTFNoisePower) $i ]
- } else {
- set noise [ lindex $ctfInfo($which,CTFNoise) $i ]
- }
- lappend ctfInfo($which,ScatteringSubtraction) [ expr $data - $noise ]
- }
-}
-
-#
-# Scattering Data
-#
-proc ScatteringCalc { { filename __null__ } } {
- variable ctfInfo
- #puts "ScatteringCalc Start"
- if { $filename == "__null__" } {
- if [ info exists ctfInfo(filename) ] {
- set filename $ctfInfo(filename)
- } else {
- puts "no file for Scattering calc."
- return
- }
- }
- set xy [ mrcInfoGet $filename Spectrum2DMag $ctfInfo(defocus0axis) $ctfInfo(numDivision) ]
- #puts $xy
- for { set i 0 } { $i < $ctfInfo(numDivision) } { incr i } {
- catch { unset ctfInfo(all,$i,R) }
- catch { unset ctfInfo(all,$i,Scattering) }
- catch { unset ctfInfo(all,$i,ScatteringRoot) }
- }
- set i 0
- foreach { x y } $xy {
- if {$x == "NULL" && $y == "NULL" } {
- set ctfInfo($i,NyquistFrequency) [ lindex $ctfInfo(all,$i,R) end ]
- incr i
- } else {
- lappend ctfInfo(all,$i,R) $x
- lappend ctfInfo(all,$i,Scattering) $y
- lappend ctfInfo(all,$i,ScatteringRoot) [ expr sqrt($y) ]
- #puts $i,$x,$y
- }
- }
- #puts $ctfInfo(numDivision)
- #puts $ctfInfo(all,0,Scattering)
- #puts $ctfInfo(all,1,Scattering)
-
- set size [ llength $ctfInfo(all,0,R) ]
- catch { unset ctfInfo(0,R) }
- catch { unset ctfInfo(0,Scattering) }
- catch { unset ctfInfo(0,ScatteringRoot) }
- catch { unset ctfInfo(1,R) }
- catch { unset ctfInfo(1,Scattering) }
- catch { unset ctfInfo(1,ScatteringRoot) }
-
- set index0 0
- #set index1 1
- set index1 [expr int ($ctfInfo(numDivision) / 4.0 + 0.5)]
- #puts "Scattering CalcStep $index0, $index1" ; flush stdout
- for { set i 0 } { $i < $size } { incr i } {
- lappend ctfInfo(0,R) [ lindex $ctfInfo(all,$index0,R) $i ]
- lappend ctfInfo(0,Scattering) [ lindex $ctfInfo(all,$index0,Scattering) $i ]
- lappend ctfInfo(0,ScatteringRoot) [ lindex $ctfInfo(all,$index0,ScatteringRoot) $i ]
- lappend ctfInfo(1,R) [ lindex $ctfInfo(all,$index1,R) $i ]
- lappend ctfInfo(1,Scattering) [ lindex $ctfInfo(all,$index1,Scattering) $i ]
- lappend ctfInfo(1,ScatteringRoot) [ lindex $ctfInfo(all,$index1,ScatteringRoot) $i ]
- }
- #puts $ctfInfo(all,0,Scattering)
- #puts $ctfInfo(0,Scattering)
- #puts $ctfInfo(all,3,Scattering)
- #puts $ctfInfo(1,Scattering)
- #puts "ScatteringCalc End" ; flush stdout
-}
-
-proc ctfInfoSave { } {
- variable ctfInfo
-
- set ctfInfo(defocus) [expr ($ctfInfo(defocus2D0)+$ctfInfo(defocus2D1))/2.0 ]
- ::CTF::ctfInfoSave $ctfInfo(.ctfinfo)
-}
-
-proc ctfInfoLoad { { filename __null__ } } {
- variable ctfInfo
-
- ::CTF::ctfInfoLoad $ctfInfo(.ctfinfo)
- ctfInfoUpload
- if [ info exists ctfInfo(defocus2D0) ] {
- puts "ctfInfoLoad"
- puts $ctfInfo(.ctfinfo)
- } else {
- set ctfInfo(defocus2D0) $ctfInfo(defocus)
- set ctfInfo(defocus2D1) $ctfInfo(defocus)
- }
- GraphRedraw
- SpectrumRedraw
-}
-
-
-#end of CTF2Dnamespace
-}
-
-#
-# Main
-#
-
-bind all <Control-KeyPress-c> { exit 0 }
-bind all <KeyPress-q> { exit 0 }
-
-libraryLoad $program
-
-#catch [ namespace import ::CTF::ctfInfo* ]
-
-global mainImage
-
-::CTF2D::Init
-::CTF2D::Win
+++ /dev/null
-/*
-# %M% %Y% %I%
-# The latest update : %G% at %U%
-#
-#%Z% mrcImageAutoRotationCorrelation ver %I%
-#%Z% Created by
-#%Z%
-#%Z% Usage : mrcImageAutoRotationCorrelation
-#%Z% Attention
-#%Z%
-*/
-
-static char __sccs_id[] = "%Z%mrcImageAutoRotationCorrelation ver%I%; Date:%D% %Z%";
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#define GLOBAL_DECLARATION
-#include "../inc/config.h"
-#define DEBUG
-#include "genUtil.h"
-#include "mrcImage.h"
-#include "lmrcImageCorrelation.h"
-#include "lmrcImageROI2D.h"
-#include "Map2D.h"
-
-extern void lmrcImageAutoRotationCorrelationInfoSet2(lmrcImageAutoRotationCorrelationForManyReferencesInfo* info2, mrcImageAutoRotationCorrelationInfo info);
-extern void lmrcImageAutoRotationCorrelationInfoSet(lmrcImageAutoRotationCorrelationInfo* linfo, mrcImageAutoRotationCorrelationInfo info, mrcImage in);
-extern void lmrcImageAutoRotationCorrelationROIInfoSet(lmrcImageSingleROIInfo* roiInfo, mrcImage ref, int offsetx, int offsety);
-
-int
-main(int argc, char* argv[])
-{
- mrcImageAutoRotationCorrelationInfo info;
- lmrcImageAutoRotationCorrelationForManyReferencesInfo info2;
- lmrcImageAutoRotationCorrelationInfo linfo;
- mrcImage in;
- mrcImage tmp;
- mrcImage ref;
- static mrcImage cor;
- int offsetx, shiftx;
- int offsety, shifty;
- lmrcImageSingleROIInfo roiInfo;
- mrcImageParaTypeReal x, y, z;
- int flagPVM = 0;
-#ifdef PVM
- lmrcImageCorrelationPVMInfo linfoPVM;
-#endif
-
- /* Argument Check */
- init0(&info);
- argCheck(&info, argc, argv);
- init1(&info);
-
-#ifdef PVM
- if(info.flagpvmList) {
- lmrcImageCorrelationServerStart(&linfoPVM, info.fptpvmList, 0);
- flagPVM = 1;
- } else if(info.flagpvm) {
- lmrcImageCorrelationServerStart(&linfoPVM, NULL, info.pvm);
- flagPVM = 1;
- } else {
- flagPVM = 0;
- }
- if(flagPVM) {
- LOGPRINT2(info.fptLog, "Start", "Correlation", "PVM: flag %d numTask: %d\n", flagPVM, linfoPVM.numTask);
- }
-#endif /* PVM */
-
- /* Data Read */
- mrcFileRead(&in, info.In, "in main", 0);
- mrcFileRead(&ref, info.Ref, "in main", 0);
-
- lmrcImageAutoRotationCorrelationInfoSet (&linfo, info, in);
- lmrcImageAutoRotationCorrelationInfoSet2(&info2, info);
-
- if(ref.HeaderN.z!=ref.numTailer) { /* RefDataCheck */
- fprintf(stderr, "in ref: numTailer %d is different from ref.HeaderN.z %d\n", ref.numTailer, ref.HeaderN.z);
- if(0==ref.numTailer) {
- ref.numTailer = ref.HeaderN.z;
- mrcTailerInit(&ref, 0);
- } else {
- fprintf(stderr, "Something wrong!! Please pay attention to your files.\n");
- fprintf(stderr, "The number of tailer infomation is different from that of prepared projetion maps\n");
- exit(EXIT_FAILURE);
- }
- }
-
- /* Size different */
- if(!info.Shift) {
- if(in.HeaderN.x!=ref.HeaderN.x
- ||in.HeaderN.y!=ref.HeaderN.y) {
- fprintf(stderr, "The size of in (%d,%d) is different from that of rerom that of ref (%d,%d)\n",
- in.HeaderN.x, in.HeaderN.y, ref.HeaderN.x, ref.HeaderN.y);
- exit(EXIT_FAILURE);
- }
- }
-
- shiftx = in.HeaderN.x - ref.HeaderN.x;
- shifty = in.HeaderN.y - ref.HeaderN.y;
- DEBUGPRINT2("shift: %d %d\n", shiftx, shifty);
-
- roiInfo.FileName = info.In;
- roiInfo.Shape = Rect;
-
- cor.HeaderN.x = info.nRot1*info.nRot2*info.nRot3;
- cor.HeaderN.y = shifty;
- cor.HeaderN.z = shiftx;
- cor.HeaderMode = mrcFloatImage;
- mrcInit(&cor, NULL);
-
- for(offsetx=0; offsetx<=shiftx; offsetx++) {
- for(offsety=0; offsety<=shifty; offsety++) {
- DEBUGPRINT2("offset: %d %d\n", offsetx, offsety);
- /* */
- lmrcImageAutoRotationCorrelationInfoSet2(&info2, info);
- lmrcImageAutoRotationCorrelationROIInfoSet(&roiInfo, ref, offsetx, offsety);
- /* */
- lmrcImageSingleROI(&tmp, &in, &roiInfo, mrcPixelHowNearest);
- lmrcImageAutoRotationCorretionForManyReferences(&tmp, &ref, &info2, &linfo, 0);
- mrcImageFree(&tmp, "in main");
- }
- }
-
- if(info.flagOut) {
- mrcFileWrite(&(info2.out), info.Out, "in main", 0);
- }
- if(info.flagfitFile) {
- mrcFileWrite(&(info2.fittedMap), info.fitFile, "in main", 0);
- }
- if(info.flagcorFile) {
- mrcFileWrite(&(info2.cor), info.corFile, "in main", 0);
- }
-
-#ifdef PVM
- lmrcImageCorrelationServerEnd(linfoPVM);
-#endif
- exit(EXIT_SUCCESS);
-}
-
-
-void
-additionalUsage()
-{
- fprintf(stderr, "----- Mode -----\n");
- fprintf(stderr, "When, -Method 0(Default:Correlation)\n");
- lmrcImageCorrelationModePrint(stderr);
- fprintf(stderr, " ----- Attention -----\n");
- fprintf(stderr, " You must not set bit 16: bit 16 is set in this program as default.\n");
- fprintf(stderr, "When, -Method 1 (SSDA:Sequential Similarity Detection Algorithm)\n");
- fprintf(stderr, "When, -Method 2 (Rotational Cross-Correlation Function)\n");
- fprintf(stderr, "-m NotSupported\n");
-}
-
-
-void
-lmrcImageAutoRotationCorrelationROIInfoSet(lmrcImageSingleROIInfo* roiInfo, mrcImage ref, int offsetx, int offsety)
-{
- /* offset */
- roiInfo->blx = offsetx;
- roiInfo->bly = offsety;
- roiInfo->brx = offsetx+ref.HeaderN.x-1;
- roiInfo->bry = offsety;
- roiInfo->trx = offsetx+ref.HeaderN.x-1;
- roiInfo->try = offsety+ref.HeaderN.y-1;
- roiInfo->tlx = offsetx;
- roiInfo->tly = offsety+ref.HeaderN.y-1;
- roiInfo->mode = ref.HeaderMode;
- roiInfo->flagWidth = 0;
- roiInfo->flagHeight = 0;
- roiInfo->flagMagnifiedWidth = 0;
- roiInfo->flagMagnifiedHeight = 0;
- roiInfo->flagLayerLine = 0;
-}
-
-void
-lmrcImageAutoRotationCorrelationInfoSet(
- lmrcImageAutoRotationCorrelationInfo* linfo,
- mrcImageAutoRotationCorrelationInfo info,
- mrcImage in)
-{
- /* AutoRotationCorrelation Paramter Set */
- linfo->iter = info.Iter;
- linfo->nRot = info.Rot;
- linfo->flagXshiftOnly = info.Xshift;
- linfo->flagNoShift = info.NoShift;
- linfo->Method = info.Method;
- if(info.flagminAngle && info.flagmaxAngle) {
- linfo->flagRestrictionArea = 1;
- linfo->thetaMin = info.minAngle*RADIAN;
- linfo->thetaMax = info.maxAngle*RADIAN;
- }
- if(info.flagsminx) { /* Search Region */
- linfo->SSDAInfo.smin.x = info.sminx;
- linfo->SSDAInfo.smin.y = info.sminy;
- linfo->SSDAInfo.smax.x = info.smaxx;
- linfo->SSDAInfo.smax.y = info.smaxy;
- } else {
- linfo->SSDAInfo.smin.x = 0;
- linfo->SSDAInfo.smin.y = 0;
- linfo->SSDAInfo.smax.x = in.HeaderN.x - 1;
- linfo->SSDAInfo.smax.y = in.HeaderN.y - 1;
- }
- linfo->SSDAInfo.Threshold = 1e30;
-}
-
-void
-lmrcImageAutoRotationCorrelationInfoSet2(
- lmrcImageAutoRotationCorrelationForManyReferencesInfo* info2,
- mrcImageAutoRotationCorrelationInfo info)
-{
-
- /* Parameters Setting */
- /* Check Area Rotation */
- info2->nRot1 = info.nRot1;
- info2->nRot1Step = info.refStep1;
- info2->nRot1AreaMin = info.nRot1AreaMin*RADIAN;
- info2->nRot1AreaMax = info.nRot1AreaMax*RADIAN;
- info2->nRot1AreaStep = info.nRot1AreaStep*RADIAN;
-
- info2->nRot2 = info.nRot2;
- info2->nRot2Step = info.refStep2;
- info2->nRot2AreaMin = info.nRot1AreaMin*RADIAN;
- info2->nRot2AreaMax = info.nRot1AreaMax*RADIAN;
- info2->nRot2AreaStep = info.nRot1AreaStep*RADIAN;
-
- info2->nRot3 = info.nRot3;
- info2->nRot3Step = info.refStep3;
- info2->nRot3AreaMin = info.nRot1AreaMin*RADIAN;
- info2->nRot3AreaMax = info.nRot1AreaMax*RADIAN;
- info2->nRot3AreaStep = info.nRot1AreaStep*RADIAN;
-
- info2->In = info.In;
- info2->Out = info.Out;
- info2->corFile = info.corFile;
- info2->fitFile = info.fitFile;
- info2->fptOutASC = info.fptOutASC;
- info2->mode = info.mode;
-}
-
-#define NUM_PARAMETER (7)
-
-void
-lmrcImageAutoRotationCorretionForManyReferences(mrcImage* in, mrcImage* ref,
- lmrcImageAutoRotationCorrelationForManyReferencesInfo* info,
- lmrcImageAutoRotationCorrelationInfo* linfo,
- int mode)
-{
- mrcImage proj;
- mrcImage out;
- long i;
- long i1, i2, i3;
- mrcImageParaTypeReal x, y;
- char s[5];
- double correlationMax=-1e30;
- double correlationMaxRot1=0;
- double correlationMaxRot2=0;
- double correlationMaxRot3=0;
- double correlation;
-
- /* Parameter Output file */
- out.HeaderN.x = NUM_PARAMETER;
- out.HeaderN.y = 1;
- out.HeaderN.z = ref->HeaderN.z;
- out.HeaderLength.x = 1;
- out.HeaderLength.y = 1;
- out.HeaderLength.z = 1;
- out.HeaderMode = mrcFloatImage;
- mrcInit(&out, NULL);
- out.numTailer = ref->HeaderN.z;
- mrcTailerInit(&out, 0);
-
- DEBUGPRINT3("nRot1Area: %f %f %f\n", info->nRot1AreaMin*DEGREE, info->nRot1AreaMax*DEGREE, info->nRot1AreaStep*DEGREE);
- DEBUGPRINT3("nRot2Area: %f %f %f\n", info->nRot2AreaMin*DEGREE, info->nRot2AreaMax*DEGREE, info->nRot2AreaStep*DEGREE);
- DEBUGPRINT3("nRot3Area: %f %f %f\n", info->nRot3AreaMin*DEGREE, info->nRot3AreaMax*DEGREE, info->nRot3AreaStep*DEGREE);
- s[4] = '\0';
- i = 0;
- while(1) {
- for(i1=0; i1<info->nRot1; i1+=info->nRot1Step) {
- for(i2=0; i2<info->nRot2; i2+=info->nRot2Step) {
- for(i3=0; i3<info->nRot3; i3+=info->nRot3Step) {
- i = i1 + i2*info->nRot1 + i3*info->nRot1*info->nRot2;
-
- if(!(info->nRot1AreaMin<=ref->Tailer[i].Cont.Rot1 && ref->Tailer[i].Cont.Rot1<=info->nRot1AreaMax
- &&info->nRot2AreaMin<=ref->Tailer[i].Cont.Rot2 && ref->Tailer[i].Cont.Rot2<=info->nRot2AreaMax
- &&info->nRot3AreaMin<=ref->Tailer[i].Cont.Rot3 && ref->Tailer[i].Cont.Rot3<=info->nRot3AreaMax)) {
- DEBUGPRINT3("Exclusion Area: Rot %g %g %g \n", ref->Tailer[i].Cont.Rot1,
- ref->Tailer[i].Cont.Rot2,
- ref->Tailer[i].Cont.Rot3);
- } else {
- map2DCoordGet(&x, &y,
- ref->Tailer[i].Cont.Rot1,
- ref->Tailer[i].Cont.Rot2,
- 1, 1, 1);
- /*
- !!!! Attention !!!!! This is true !!!!!
- map2DCoordGet(&x, &y, -ref->Tailer[i].Cont.Rot1,
- ref->Tailer[i].Cont.Rot2,
- out.HeaderN.x, out.HeaderN.y, 1);
- */
- mrcImageSectionGet(&proj, ref, i, 0);
-
- /* Correlation */
- lmrcImageAutoRotationCorrelation(&(info->fittedMap), &(info->cor), in, &proj, linfo, info->mode);
-
- correlation = linfo->LinearCorrelation;
- mrcPixelDataSet(&out, 0, 0, i, linfo->max, mrcPixelRePart);
- mrcPixelDataSet(&out, 1, 0, i, linfo->maxTheta, mrcPixelRePart);
- mrcPixelDataSet(&out, 2, 0, i, linfo->maxP.x, mrcPixelRePart);
- mrcPixelDataSet(&out, 3, 0, i, linfo->maxP.x, mrcPixelRePart);
- mrcPixelDataSet(&out, 4, 0, i, x, mrcPixelRePart);
- mrcPixelDataSet(&out, 5, 0, i, y, mrcPixelRePart);
- mrcPixelDataSet(&out, 6, 0, i, correlation, mrcPixelRePart);
-
- fprintf(info->fptOutASC, "%ld: ", i);
- strncpy(s, ref->Tailer[i].Cont.EulerAngleMode, 4);
- LOGPRINT12(info->fptOutASC, "", "", \
- "%4s %15.6f %15.6f %15.6f : %15.6f theta %15.6f at %15.6f %15.6f onMap %15.6f %15.6f %s Cor %15.6f\n",
- s,
- ref->Tailer[i].Cont.Rot1*DEGREE,
- ref->Tailer[i].Cont.Rot2*DEGREE,
- ref->Tailer[i].Cont.Rot3*DEGREE,
- linfo->max, linfo->maxTheta*DEGREE,
- linfo->maxP.x, linfo->maxP.y,
- x, y,
- info->In,
- correlation);
- if(correlationMax<correlation) {
- correlationMax = correlation;
- correlationMaxRot1 = ref->Tailer[i].Cont.Rot1;
- correlationMaxRot2 = ref->Tailer[i].Cont.Rot2;
- correlationMaxRot3 = ref->Tailer[i].Cont.Rot3;
- }
- }
- }
- }
- }
- if(1<info->nRot1Step
- ||1<info->nRot2Step
- ||1<info->nRot3Step) {
- DEBUGPRINT3("MAX Point: Rot %f %f %f\n", correlationMaxRot1*DEGREE, correlationMaxRot2*DEGREE, correlationMaxRot3*DEGREE);
- info->nRot1AreaStep /= 5;
- info->nRot2AreaStep /= 5;
- info->nRot3AreaStep /= 5;
- info->nRot1AreaMin = correlationMaxRot1-info->nRot1AreaStep;
- info->nRot1AreaMax = correlationMaxRot1+info->nRot1AreaStep;
- info->nRot2AreaMin = correlationMaxRot2-info->nRot2AreaStep;
- info->nRot2AreaMax = correlationMaxRot2+info->nRot2AreaStep;
- info->nRot3AreaMin = correlationMaxRot3-info->nRot3AreaStep;
- info->nRot3AreaMax = correlationMaxRot3+info->nRot3AreaStep;
- DEBUGPRINT3("nRot1Area: %f %f %f\n", info->nRot1AreaMin*DEGREE, info->nRot1AreaMax*DEGREE, info->nRot1AreaStep*DEGREE);
- DEBUGPRINT3("nRot2Area: %f %f %f\n", info->nRot2AreaMin*DEGREE, info->nRot2AreaMax*DEGREE, info->nRot2AreaStep*DEGREE);
- DEBUGPRINT3("nRot3Area: %f %f %f\n", info->nRot3AreaMin*DEGREE, info->nRot3AreaMax*DEGREE, info->nRot3AreaStep*DEGREE);
- info->nRot1Step = MAX(1,info->nRot1Step/5);
- info->nRot2Step = MAX(1,info->nRot2Step/5);
- info->nRot3Step = MAX(1,info->nRot3Step/5);
- } else {
- break;
- }
- }
- info->out = out;
-}
-
+++ /dev/null
-/*
-# %M% %Y% %I%
-# The latest update : %G% at %U%
-#
-#%Z% mrcImageAutoRotationCorrelation ver %I%
-#%Z% Created by
-#%Z%
-#%Z% Usage : mrcImageAutoRotationCorrelation
-#%Z% Attention
-#%Z%
-*/
-
-static char __sccs_id[] = "%Z%mrcImageAutoRotationCorrelation ver%I%; Date:%D% %Z%";
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#define GLOBAL_DECLARATION
-#include "../inc/config.h"
-#undef DEBUG
-#include "genUtil.h"
-#include "mrcImage.h"
-#include "lmrcImageCorrelation.h"
-#include "lmrcImageROI2D.h"
-#include "Map2D.h"
-
-extern void lmrcImageAutoRotationCorrelationInfoSet2(lmrcImageAutoRotationCorrelationForManyReferencesInfo* info2, mrcImageAutoRotationCorrelationInfo info);
-extern void lmrcImageAutoRotationCorrelationInfoSet(lmrcImageAutoRotationCorrelationInfo* linfo, mrcImageAutoRotationCorrelationInfo info, mrcImage in);
-extern void lmrcImageAutoRotationCorrelationROIInfoSet(lmrcImageSingleROIInfo* roiInfo, mrcImage ref, int offsetx, int offsety);
-
-int
-main(int argc, char* argv[])
-{
- mrcImageAutoRotationCorrelationInfo info;
- lmrcImageAutoRotationCorrelationForManyReferencesInfo info2;
- lmrcImageAutoRotationCorrelationInfo linfo;
- mrcImage in;
- mrcImage tmp;
- mrcImage ref;
- static mrcImage cor;
- int offsetx, shiftx;
- int offsety, shifty;
- lmrcImageSingleROIInfo roiInfo;
- mrcImageParaTypeReal x, y, z;
- int flagPVM = 0;
-#ifdef PVM
- lmrcImageCorrelationPVMInfo linfoPVM;
-#endif
- memset(&info, 0, sizeof(info ));
- memset(&info2, 0, sizeof(info2));
- memset(&linfo, 0, sizeof(linfo));
-
- /* Argument Check */
- init0(&info);
- argCheck(&info, argc, argv);
- init1(&info);
-
-#ifdef PVM
- if(info.flagpvmList) {
- lmrcImageCorrelationServerStart(&linfoPVM, info.fptpvmList, 0);
- flagPVM = 1;
- } else if(info.flagpvm) {
- lmrcImageCorrelationServerStart(&linfoPVM, NULL, info.pvm);
- flagPVM = 1;
- } else {
- flagPVM = 0;
- }
- if(flagPVM) {
- LOGPRINT2(info.fptLog, "Start", "Correlation", "PVM: flag %d numTask: %d\n", flagPVM, linfoPVM.numTask);
- }
-#endif /* PVM */
-
- /* Data Read */
- mrcFileRead(&in, info.In, "in main", 0);
- mrcFileRead(&ref, info.Ref, "in main", 0);
-
- lmrcImageAutoRotationCorrelationInfoSet (&linfo, info, in);
- lmrcImageAutoRotationCorrelationInfoSet2(&info2, info);
-
- if(ref.HeaderN.z!=ref.numTailer) { /* RefDataCheck */
- fprintf(stderr, "in ref: numTailer %d is different from ref.HeaderN.z %d\n", ref.numTailer, ref.HeaderN.z);
- if(0==ref.numTailer) {
- ref.numTailer = ref.HeaderN.z;
- mrcTailerInit(&ref, 0);
- } else {
- fprintf(stderr, "Something wrong!! Please pay attention to your files.\n");
- fprintf(stderr, "The number of tailer infomation is different from that of prepared projetion maps\n");
- exit(EXIT_FAILURE);
- }
- }
-
- /* Size different */
- if(!info.Shift) {
- if(in.HeaderN.x!=ref.HeaderN.x
- ||in.HeaderN.y!=ref.HeaderN.y) {
- fprintf(stderr, "The size of in (%d,%d) is different from that of rerom that of ref (%d,%d)\n",
- in.HeaderN.x, in.HeaderN.y, ref.HeaderN.x, ref.HeaderN.y);
- exit(EXIT_FAILURE);
- }
- }
-
- shiftx = in.HeaderN.x - ref.HeaderN.x;
- shifty = in.HeaderN.y - ref.HeaderN.y;
- DEBUGPRINT2("shift: %d %d\n", shiftx, shifty);
-
- roiInfo.FileName = info.In;
- roiInfo.Shape = Rect;
-
- cor.HeaderN.x = info.nRot1*info.nRot2*info.nRot3;
- cor.HeaderN.y = MAX(1,shifty);
- cor.HeaderN.z = MAX(1,shiftx);
- cor.HeaderMode = mrcFloatImage;
- mrcInit(&cor, NULL);
-
- for(offsetx=0; offsetx<=shiftx; offsetx++) {
- for(offsety=0; offsety<=shifty; offsety++) {
- DEBUGPRINT2("offset: %d %d\n", offsetx, offsety);
- /* */
- lmrcImageAutoRotationCorrelationInfoSet2(&info2, info);
- lmrcImageAutoRotationCorrelationROIInfoSet(&roiInfo, ref, offsetx, offsety);
- /* */
- lmrcImageSingleROI(&tmp, &in, &roiInfo, mrcPixelHowNearest);
- lmrcImageAutoRotationCorretionForManyReferences(&tmp, &ref, &info2, &linfo, 0);
- mrcImageFree(&tmp, "in main");
- }
- }
-
- if(info.flagOut) {
- mrcFileWrite(&(info2.out), info.Out, "in main", 0);
- }
- if(info.flagfitFile) {
- mrcFileWrite(&(info2.fittedMap), info.fitFile, "in main", 0);
- }
- if(info.flagcorFile) {
- mrcFileWrite(&(info2.cor), info.corFile, "in main", 0);
- }
-
-#ifdef PVM
- lmrcImageCorrelationServerEnd(linfoPVM);
-#endif
- exit(EXIT_SUCCESS);
-}
-
-
-void
-additionalUsage()
-{
- fprintf(stderr, "----- Mode -----\n");
- fprintf(stderr, "When, -Method 0(Default:Correlation)\n");
- lmrcImageCorrelationModePrint(stderr);
- fprintf(stderr, " ----- Attention -----\n");
- fprintf(stderr, " You must not set bit 16: bit 16 is set in this program as default.\n");
- fprintf(stderr, "When, -Method 1 (SSDA:Sequential Similarity Detection Algorithm)\n");
- fprintf(stderr, "When, -Method 2 (Rotational Cross-Correlation Function)\n");
- fprintf(stderr, "-m NotSupported\n");
-}
-
-
-void
-lmrcImageAutoRotationCorrelationROIInfoSet(lmrcImageSingleROIInfo* roiInfo, mrcImage ref, int offsetx, int offsety)
-{
- /* offset */
- roiInfo->blx = offsetx;
- roiInfo->bly = offsety;
- roiInfo->brx = offsetx+ref.HeaderN.x-1;
- roiInfo->bry = offsety;
- roiInfo->trx = offsetx+ref.HeaderN.x-1;
- roiInfo->try = offsety+ref.HeaderN.y-1;
- roiInfo->tlx = offsetx;
- roiInfo->tly = offsety+ref.HeaderN.y-1;
- roiInfo->mode = ref.HeaderMode;
- roiInfo->flagWidth = 0;
- roiInfo->flagHeight = 0;
- roiInfo->flagMagnifiedWidth = 0;
- roiInfo->flagMagnifiedHeight = 0;
- roiInfo->flagLayerLine = 0;
-}
-
-void
-lmrcImageAutoRotationCorrelationInfoSet(
- lmrcImageAutoRotationCorrelationInfo* linfo,
- mrcImageAutoRotationCorrelationInfo info,
- mrcImage in)
-{
- /* AutoRotationCorrelation Paramter Set */
- linfo->iter = info.Iter;
- linfo->nRot = info.Rot;
- linfo->flagXshiftOnly = info.Xshift;
- linfo->flagNoShift = info.NoShift;
- linfo->Method = info.Method;
- if(info.flagminAngle && info.flagmaxAngle) {
- linfo->flagRestrictionArea = 1;
- linfo->thetaMin = info.minAngle*RADIAN;
- linfo->thetaMax = info.maxAngle*RADIAN;
- } else {
- linfo->flagRestrictionArea = 0;
- linfo->thetaMin = 0;
- linfo->thetaMax = 2*M_PI;
- }
- if(info.flagsminx) { /* Search Region */
- linfo->flagShiftRange = 1;
- linfo->shiftMinX = info.sminx;
- linfo->shiftMinY = info.sminy;
- linfo->shiftMaxX = info.smaxx;
- linfo->shiftMaxY = info.smaxy;
- linfo->SSDAInfo.smin.x = info.sminx;
- linfo->SSDAInfo.smin.y = info.sminy;
- linfo->SSDAInfo.smax.x = info.smaxx;
- linfo->SSDAInfo.smax.y = info.smaxy;
- } else {
- linfo->SSDAInfo.smin.x = 0;
- linfo->SSDAInfo.smin.y = 0;
- linfo->SSDAInfo.smax.x = in.HeaderN.x - 1;
- linfo->SSDAInfo.smax.y = in.HeaderN.y - 1;
- }
- linfo->SSDAInfo.Threshold = 1e30;
-}
-
-void
-lmrcImageAutoRotationCorrelationInfoSet2(
- lmrcImageAutoRotationCorrelationForManyReferencesInfo* info2,
- mrcImageAutoRotationCorrelationInfo info)
-{
-
- /* Parameters Setting */
- /* Check Area Rotation */
- info2->nRot1 = info.nRot1;
- info2->nRot1Step = info.refStep1;
- info2->nRot1AreaMin = info.nRot1AreaMin*RADIAN;
- info2->nRot1AreaMax = info.nRot1AreaMax*RADIAN;
- info2->nRot1AreaStep = info.nRot1AreaStep*RADIAN;
-
- info2->nRot2 = info.nRot2;
- info2->nRot2Step = info.refStep2;
- info2->nRot2AreaMin = info.nRot2AreaMin*RADIAN;
- info2->nRot2AreaMax = info.nRot2AreaMax*RADIAN;
- info2->nRot2AreaStep = info.nRot2AreaStep*RADIAN;
-
- info2->nRot3 = info.nRot3;
- info2->nRot3Step = info.refStep3;
- info2->nRot3AreaMin = info.nRot3AreaMin*RADIAN;
- info2->nRot3AreaMax = info.nRot3AreaMax*RADIAN;
- info2->nRot3AreaStep = info.nRot3AreaStep*RADIAN;
-
- info2->In = info.In;
- info2->Out = info.Out;
- info2->corFile = info.corFile;
- info2->fitFile = info.fitFile;
- info2->fptOutASC = info.fptOutASC;
- info2->mode = info.mode;
-}
-