From 315a5ba3d6f6c0082105a562d67aa9c3c9c95d91 Mon Sep 17 00:00:00 2001 From: Takuo Yasunaga Date: Wed, 11 Nov 2015 07:15:01 +0900 Subject: [PATCH] Display2 updated: for default modified: bin/wish/Display2/Display2Init.wish modified: src/Tools/Config/Define.inc modified: src/Tools/Integration/Display2/Config/OptionControlFile modified: src/Tools/Integration/Display2/inc/Display2.h modified: src/Tools/Integration/Display2/src/Display2.c --- bin/wish/Display2/Display2Init.wish | 229 ++++++++++++++++++--- src/Tools/Config/Define.inc | 3 + .../Integration/Display2/Config/OptionControlFile | 7 +- src/Tools/Integration/Display2/inc/Display2.h | 3 + src/Tools/Integration/Display2/src/Display2.c | 1 + src/Tools/Integration/Display2/src/Display2.html | 7 +- src/Tools/Integration/Display2/src/Display2.pane | 15 +- src/Tools/Integration/Display2/src/argCheck.c | 11 + src/Tools/Integration/Display2/src/init.c | 4 + src/Tools/Integration/Display2/src/test/Makefile | 2 +- src/Tools/Integration/Display2/src/usage.c | 7 +- .../Display2/src/wish/Display2Init.wish | 229 ++++++++++++++++++--- 12 files changed, 451 insertions(+), 67 deletions(-) diff --git a/bin/wish/Display2/Display2Init.wish b/bin/wish/Display2/Display2Init.wish index 7f8a7af92b..0f7db00a40 100755 --- a/bin/wish/Display2/Display2Init.wish +++ b/bin/wish/Display2/Display2Init.wish @@ -1,5 +1,30 @@ #!../Display2.HP -proc display2Init {} { + +# From Arguments +proc display2SetVar {} { + global mainImage + global Roi + global thresHigh + global thresLow + global Inverse + global Zoom + + if [ info exists thresHigh ] { + set mainImage(thresHigh) $thresHigh + } + if [ info exists thresLow ] { + set mainImage(thresLow) $thresLow + } + if [ info exists Inverse ] { + set mainImage(Inverse) Yes + } + if { [ info exists Zoom ] } { + set Roi(Zoom) $Zoom + } +} + +# Set +proc display2InitVar {} { global mousePressed global Roi global Point @@ -16,6 +41,7 @@ proc display2Init {} { global mainImage global overviewImage global UnitCell + global Section global roiInfoWin @@ -29,8 +55,6 @@ proc display2Init {} { set tcl_precision 17 - #puts "in display2Init" - # Canvas Area Create if [ info exists Desktop(mainCanvasX) ] { set Desktop(mainCanvasX) $Desktop(mainCanvasX) @@ -42,9 +66,13 @@ proc display2Init {} { } else { set Desktop(mainCanvasY) 1999 } + + Canvas .overview_canvas 128 128 Canvas .zoom_canvas 128 128 + scrolledCanvas .main_canvas 128 128 [ list 0 0 $Desktop(mainCanvasX) $Desktop(mainCanvasY) ] + set Desktop(mainCanvas) .main_canvas set Desktop(overviewCanvas) .overview_canvas set Desktop(zoomCanvas) .zoom_canvas @@ -53,7 +81,8 @@ proc display2Init {} { set mainImage(mainCanvas) .main_canvas set mainImage(overviewCanvas) .overview_canvas set mainImage(zoomCanvas) .zoom_canvas - + + set overviewImage(image) No set mainImage(image) No @@ -66,21 +95,11 @@ proc display2Init {} { set mainImage(lz) 0 set mainImage(max) 1.0 set mainImage(min) 0.0 - if [ info exists thresHigh ] { - set mainImage(thresHigh) $thresHigh - } else { - set mainImage(thresHigh) No - } - if [ info exists thresLow ] { - set mainImage(thresLow) $thresLow - } else { - set mainImage(thresLow) No - } - if [ info exists Inverse ] { - set mainImage(Inverse) Yes - } else { - set mainImage(Inverse) No - } + + set mainImage(thresHigh) No + set mainImage(thresLow) No + set mainImage(Inverse) No + set mainImage(Contrast) 2 set mainImage(region) No @@ -117,11 +136,12 @@ proc display2Init {} { set Roi(Extract) foreground set Roi(withScale) Off set Roi(absTicks) 54.6 + set Roi(numFormat) "-%04d.roi" if { [ info exists fileNameIn ] } { set Roi(MontageFile) [ string trimright $fileNameIn ".mrc" ].mon set Roi(InformationFile) [ string trimright $fileNameIn ".mrc" ].roiinfo - set Roi(ROIFile) [ string trimright $fileNameIn ".mrc" ]-%04d.roi + set Roi(ROIFile) [ string trimright $fileNameIn ".mrc" ]$Roi(numFormat) set Roi(ShrinkOriginalFile) [ string trimright $fileNameIn ".shrink"].mrc } else { set Roi(MontageFile) No.mon @@ -131,11 +151,7 @@ proc display2Init {} { set Roi(CurrentID) 0 set Roi(TotalN) 0 # - if { [ info exists Zoom ] } { - set Roi(Zoom) $Zoom - } else { - set Roi(Zoom) 1 - } + set Roi(Zoom) 1 set Roi(ZoomX) 1 set Roi(ZoomY) 1 @@ -195,6 +211,169 @@ proc display2Init {} { set UnitCell(beta) 90 set UnitCell(gamma) 90 + set Section(Initialize) 1 + set Section(flag) OFF + set Section(which) Y + set Section(scale) 1 + set Section(scaleDelta) 0.1 + set Section(at) 0 + set Section(atDelta) 1 + set Section(mode) normal + set Section(Num) 0 + set Section(Current) -1 + set Section(Win,Title) "Section Information" +} + +proc display2InitVarSet { filename } { + set fpt [ open $filename a ] + +puts $fpt { +# +# Default +# + +# Precision +set tcl_precision 17 + +# Image +set mainImage(thresHigh) No +set mainImage(thresLow) No +set mainImage(Inverse) No +set mainImage(Contrast) 2 +set mainImage(flagLog) 0 +set mainImage(flagPow) 0 +set mainImage(HistNum) 256 + +# Roi +set Roi(OKColor) #118866 +set Roi(SelectColor) #0000ff +set Roi(LineWidth) 3 +set Roi(CurrentColor) $Roi(OKColor) +set Roi(Shape) Rectangle +set Roi(Shrink) 1 +set Roi(MultiShape) Off +set Roi(MultiNumber) Off +set Roi(SizeLock) Off +set Roi(Analysis) Off +set Roi(View) off +set Roi(Extract) foreground +set Roi(withScale) Off +set Roi(absTicks) 54.6 +set Roi(numFormat) "-%04d.roi" + +# Zooming +set Roi(Zoom) 1 +set Roi(ZoomX) 1 +set Roi(ZoomY) 1 + +# Point +set Point(x) 0 +set Point(y) 0 +set Point(dat) 0 +set Point(cx) 0 +set Point(cy) 0 +set Point(cdat) 0 + +# Roi Rectangle +set rectanglePoints(width) 128.0 +set rectanglePoints(height) 128.0 +set rectanglePoints(angle) 0.0 + +# spline +set splinePoints(Width) 80 + +# LayerLine +set LayerLine(flag) OFF +set LayerLine(pointRadius) 3 + +# Projection Line +set Projection(flag) OFF +set Projection(which) Y +set Projection(scale) 1 + +# Unit Cell +set UnitCell(n) 0 +set UnitCell(dimension) 2 +set UnitCell(axis1,n) 5 +set UnitCell(axis2,n) 5 +set UnitCell(axis3,n) 0 +set UnitCell(axis1,x) 1 +set UnitCell(axis1,y) 0 +set UnitCell(axis1,z) 0 +set UnitCell(axis2,x) 0 +set UnitCell(axis2,y) 1 +set UnitCell(axis2,z) 0 +set UnitCell(axis3,x) 0 +set UnitCell(axis3,y) 0 +set UnitCell(axis3,z) 1 + +set UnitCell(box,x) 5 +set UnitCell(box,y) 5 +set UnitCell(box,z) 0 + +set UnitCell(alpha) 90 +set UnitCell(beta) 90 +set UnitCell(gamma) 90 + +# Section +set Section(flag) OFF +set Section(which) Y +set Section(scale) 1 +set Section(scaleDelta) 0.1 +set Section(at) 0 +set Section(atDelta) 1 +set Section(mode) normal +} + close $fpt +} + +proc display2Init {} { + global mousePressed + global Roi + global Point + global rectanglePoints + global linePoints + global splinePoints + global LayerLine + global Projection + global ctfInfo + global LogFile + + global Desktop + global CommandPut + global mainImage + global overviewImage + global UnitCell + + global roiInfoWin + + # Global Variables from Display2 + global fileNameIn + global LogFile + global thresHigh + global thresLow + global Inverse + global Zoom + + global defaultFile + + display2InitVar + + if [ info exists defaultFile ] { + # + } else { + set defaultFile "~/.Eos/Display2" + } + if [ file exists $defaultFile ] { + # + } else { + display2InitVarSet $defaultFile + } + source $defaultFile + + # from arguments + display2SetVar + display2MenuSet display2MenuSet2 display2BindingSet .main_canvas.canvas diff --git a/src/Tools/Config/Define.inc b/src/Tools/Config/Define.inc index 2292ea1ec7..142e5e1b2d 100755 --- a/src/Tools/Config/Define.inc +++ b/src/Tools/Config/Define.inc @@ -693,3 +693,6 @@ WORLDNAME=Tools WORLDNAME=Tools WORLDNAME=Tools WORLDNAME=Tools +WORLDNAME=Tools +WORLDNAME=Tools +WORLDNAME=Tools diff --git a/src/Tools/Integration/Display2/Config/OptionControlFile b/src/Tools/Integration/Display2/Config/OptionControlFile index 5e36fba7b4..6f2d1e631f 100755 --- a/src/Tools/Integration/Display2/Config/OptionControlFile +++ b/src/Tools/Integration/Display2/Config/OptionControlFile @@ -1,12 +1,13 @@ # OptionControlFile # FileFormat -"-i","-i[nput]","InputDataFile","Optional","1","1","In","inFile","NULL" +"-i","-i[nput]","Input:mrcImage","Optional","1","1","In","inFile::mrcImage","NULL" "-t","-t[epmlate]","Template for InputFile ","Optional","1","1","Template","String","%d.roi" -"-H","-H[ighForThres]","Template for InputFile ","Optional","1","1","ThresHigh","Real","0.0" -"-L","-L[owForThres]","Template for InputFile ","Optional","1","1","ThresLow","Real","0.0" +"-H","-H[ighForThres]","HighThres","Optional","1","1","ThresHigh","Real","0.0" +"-L","-L[owForThres]","LowThres","Optional","1","1","ThresLow","Real","0.0" "-Zoom","-Zoom","Zoom for InputFile ","Optional","1","1","Zoom","Real","1.0" "-Inverse","-Inverse","Inverse (HighValue(dark)<->LowValue(bright)) for InputFile ","Optional","0" "-o","-o[utput]","OutputLogFile","Optional","1","1","Out","String",".EosLog" +"-def","-def[ault]","OutputLogFile","Optional","1","1","Default","String","~/.Eos/Display2" "-display","-display","OutputLogFile","Optional","1","1","geometry","String",":0.0" "-geometry","-geometry","OutputLogFile","Optional","1","1","display","String","1024x1024+0+0" "-c","-c[onfig]","ConfigurationFile","Optional","1","1","configFile","inFile","NULL" diff --git a/src/Tools/Integration/Display2/inc/Display2.h b/src/Tools/Integration/Display2/inc/Display2.h index d9b37495d2..755593ba35 100755 --- a/src/Tools/Integration/Display2/inc/Display2.h +++ b/src/Tools/Integration/Display2/inc/Display2.h @@ -34,6 +34,9 @@ typedef struct Display2Info { long flagOut; char* Out; + long flagDefault; + char* Default; + long flaggeometry; char* geometry; diff --git a/src/Tools/Integration/Display2/src/Display2.c b/src/Tools/Integration/Display2/src/Display2.c index a36ed8af18..9c8d037bc8 100755 --- a/src/Tools/Integration/Display2/src/Display2.c +++ b/src/Tools/Integration/Display2/src/Display2.c @@ -87,6 +87,7 @@ Tcl_AppInit(Tcl_Interp *interp) sprintf(s, "%ld", info.Inverse); Tcl_SetVar(interp, "Inverse", s, 0); } + Tcl_SetVar(interp, "defaultFile", info.Default, 0); Tcl_SetVar(interp, "LogFile", info.Out, 0); Tcl_SetVar(interp, "fileNameTemplate", info.Template, 0); diff --git a/src/Tools/Integration/Display2/src/Display2.html b/src/Tools/Integration/Display2/src/Display2.html index 8d4e047852..335877670f 100755 --- a/src/Tools/Integration/Display2/src/Display2.html +++ b/src/Tools/Integration/Display2/src/Display2.html @@ -8,13 +8,14 @@
 Usage: Display2
 Options:
-    [-i[nput]            In                  (NULL      ).as(inFile              ) ] :Optional  :InputDataFile
+    [-i[nput]            In                  (NULL      ).as(inFile::mrcImage    ) ] :Optional  :Input:mrcImage
     [-t[epmlate]         Template            (%d.roi   ).as(String              ) ] :Optional  :Template for InputFile 
-    [-H[ighForThres]     ThresHigh           (0.0       ).as(Real                ) ] :Optional  :Template for InputFile 
-    [-L[owForThres]      ThresLow            (0.0       ).as(Real                ) ] :Optional  :Template for InputFile 
+    [-H[ighForThres]     ThresHigh           (0.0       ).as(Real                ) ] :Optional  :HighThres
+    [-L[owForThres]      ThresLow            (0.0       ).as(Real                ) ] :Optional  :LowThres
     [-Zoom               Zoom                (1.0       ).as(Real                ) ] :Optional  :Zoom for InputFile 
     [-Inverse                                                                      ] :Optional  :Inverse (HighValue(dark)<->LowValue(bright)) for InputFile 
     [-o[utput]           Out                 (.EosLog   ).as(String              ) ] :Optional  :OutputLogFile
+    [-def[ault]          Default             (~/.Eos/Display2).as(String              ) ] :Optional  :OutputLogFile
     [-display            geometry            (:0.0      ).as(String              ) ] :Optional  :OutputLogFile
     [-geometry           display             (1024x1024+0+0).as(String              ) ] :Optional  :OutputLogFile
     [-c[onfig]           configFile          (NULL      ).as(inFile              ) ] :Optional  :ConfigurationFile
diff --git a/src/Tools/Integration/Display2/src/Display2.pane b/src/Tools/Integration/Display2/src/Display2.pane
index 43b423838a..a2842c3448 100755
--- a/src/Tools/Integration/Display2/src/Display2.pane
+++ b/src/Tools/Integration/Display2/src/Display2.pane
@@ -7,17 +7,18 @@
         -R 1 0 1 5x1+35+0 'Run' 'execute operation' $EOS/bin/Display2
         -H 1  5x1+41+0 'Help' 'help page' $EOS/src/Tools/Integration/Display2/doc/Display2.doc help
         -Q 1 0 5.25x1+47+0 'Close'
-        -I 1 0 1 0 0 1 -1x1+1+1.500000 ' ' 'In' 'InputDataFile' i
+        -I 1 0 1 0 0 1 -1x1+1+1.500000 ' ' 'In' 'Input:mrcImage' i
         -s 1 0 1 0 0 -1x1+1+3.000000 0 0 0 0 0 'Template' 'Template for InputFile ' t
-        -f 1 0 1 0 0 -1x1+1+4.500000 0 0 0.000000 0 0 0 'ThresHigh' 'Template for InputFile ' H
-        -f 1 0 1 0 0 -1x1+1+6.000000 0 0 0.000000 0 0 0 'ThresLow' 'Template for InputFile ' L
+        -f 1 0 1 0 0 -1x1+1+4.500000 0 0 0.000000 0 0 0 'ThresHigh' 'HighThres' H
+        -f 1 0 1 0 0 -1x1+1+6.000000 0 0 0.000000 0 0 0 'ThresLow' 'LowThres' L
         -f 1 0 1 0 0 -1x1+1+7.500000 0 0 1.000000 0 0 0 'Zoom' 'Zoom for InputFile ' Zoom
         -t 1 0 1 0 0 6x1+1+9 'Inverse' 'Inverse (HighValue(dark)<->LowValue(bright)) for InputFile ' Inverse
         -s 1 0 1 0 0 -1x1+1+10.500000 0 0 0 0 0 'Out' 'OutputLogFile' o
-        -s 1 0 1 0 0 -1x1+1+12.000000 0 0 0 0 0 'geometry' 'OutputLogFile' display
-        -s 1 0 1 0 0 -1x1+1+13.500000 0 0 1024 0 0 'display' 'OutputLogFile' geometry
-        -I 1 0 1 0 0 1 -1x1+1+15.000000 ' ' 'configFile' 'ConfigurationFile' c
-        -i 1 0 1 0 0 -1x1+1+16.500000 0 0 0 0 0 'mode' 'Mode' m
+        -s 1 0 1 0 0 -1x1+1+12.000000 0 0 0 0 0 'Default' 'OutputLogFile' def
+        -s 1 0 1 0 0 -1x1+1+13.500000 0 0 0 0 0 'geometry' 'OutputLogFile' display
+        -s 1 0 1 0 0 -1x1+1+15.000000 0 0 1024 0 0 'display' 'OutputLogFile' geometry
+        -I 1 0 1 0 0 1 -1x1+1+16.500000 ' ' 'configFile' 'ConfigurationFile' c
+        -i 1 0 1 0 0 -1x1+1+18.000000 0 0 0 0 0 'mode' 'Mode' m
     -E
   -E
 -E
diff --git a/src/Tools/Integration/Display2/src/argCheck.c b/src/Tools/Integration/Display2/src/argCheck.c
index e1e3460e71..40858339e6 100755
--- a/src/Tools/Integration/Display2/src/argCheck.c
+++ b/src/Tools/Integration/Display2/src/argCheck.c
@@ -103,6 +103,17 @@ argCheck(Display2Info* info, int argc, char* argv[])
                     }
                     SBREAK;
                 }
+                SCASE("def") {
+                    if(i+1Default = stringGetNthWord(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagDefault++;
+                    } else {
+                        usage(argv[0]);
+                        exit(EXIT_FAILURE);
+                    }
+                    SBREAK;
+                }
                 SCASE("display") {
                     if(i+1geometry = stringGetNthWord(argv[i+1], 1, " ,");
diff --git a/src/Tools/Integration/Display2/src/init.c b/src/Tools/Integration/Display2/src/init.c
index f61302de9b..3e4a8698ae 100755
--- a/src/Tools/Integration/Display2/src/init.c
+++ b/src/Tools/Integration/Display2/src/init.c
@@ -19,6 +19,7 @@ init0(Display2Info* info)
     info->Zoom = 1.0;    info->flagZoom = 0;
     info->Inverse=0;
     info->Out = stringGetNthWord(".EosLog", 1, "\0");    info->flagOut = 0;
+    info->Default = stringGetNthWord("~/.Eos/Display2", 1, "\0");    info->flagDefault = 0;
     info->geometry = stringGetNthWord(":0.0", 1, "\0");    info->flaggeometry = 0;
     info->display = stringGetNthWord("1024x1024+0+0", 1, "\0");    info->flagdisplay = 0;
     info->fptconfigFile = NULL;    info->flagconfigFile = 0;
@@ -49,6 +50,9 @@ init1(Display2Info* info)
     if(info->flagOut) {
     }
     
+    if(info->flagDefault) {
+    }
+    
     if(info->flaggeometry) {
     }
     
diff --git a/src/Tools/Integration/Display2/src/test/Makefile b/src/Tools/Integration/Display2/src/test/Makefile
index f1684ac1cb..d74908ee20 100755
--- a/src/Tools/Integration/Display2/src/test/Makefile
+++ b/src/Tools/Integration/Display2/src/test/Makefile
@@ -11,7 +11,7 @@ help:
 
 exec:
 	@echo "----- Execution Check -----"
-	../$(OSTYPE)/$(OBJECTNAME) -i data/test.mrc < ../wish/Display2.wish
+	../$(OSTYPE)/$(OBJECTNAME) -i data/FlagellaSection-0001.mrc < ../wish/Display2.wish
 	@echo "----- Calc check -----"		
 
 clean:
diff --git a/src/Tools/Integration/Display2/src/usage.c b/src/Tools/Integration/Display2/src/usage.c
index 626578e26d..e7e579597c 100755
--- a/src/Tools/Integration/Display2/src/usage.c
+++ b/src/Tools/Integration/Display2/src/usage.c
@@ -7,13 +7,14 @@ usage(char* thisProgram)
 {
     fprintf(stderr, "Usage: %s\n", thisProgram);
     fprintf(stderr, "Options:\n");
-    fprintf(stderr, "    [-i[nput]            In                  (NULL      ).as(inFile              ) ] :Optional  :InputDataFile\n");
+    fprintf(stderr, "    [-i[nput]            In                  (NULL      ).as(inFile::mrcImage    ) ] :Optional  :Input:mrcImage\n");
     fprintf(stderr, "    [-t[epmlate]         Template            (%%d.roi   ).as(String              ) ] :Optional  :Template for InputFile \n");
-    fprintf(stderr, "    [-H[ighForThres]     ThresHigh           (0.0       ).as(Real                ) ] :Optional  :Template for InputFile \n");
-    fprintf(stderr, "    [-L[owForThres]      ThresLow            (0.0       ).as(Real                ) ] :Optional  :Template for InputFile \n");
+    fprintf(stderr, "    [-H[ighForThres]     ThresHigh           (0.0       ).as(Real                ) ] :Optional  :HighThres\n");
+    fprintf(stderr, "    [-L[owForThres]      ThresLow            (0.0       ).as(Real                ) ] :Optional  :LowThres\n");
     fprintf(stderr, "    [-Zoom               Zoom                (1.0       ).as(Real                ) ] :Optional  :Zoom for InputFile \n");
     fprintf(stderr, "    [-Inverse                                                                      ] :Optional  :Inverse (HighValue(dark)<->LowValue(bright)) for InputFile \n");
     fprintf(stderr, "    [-o[utput]           Out                 (.EosLog   ).as(String              ) ] :Optional  :OutputLogFile\n");
+    fprintf(stderr, "    [-def[ault]          Default             (~/.Eos/Display2).as(String              ) ] :Optional  :OutputLogFile\n");
     fprintf(stderr, "    [-display            geometry            (:0.0      ).as(String              ) ] :Optional  :OutputLogFile\n");
     fprintf(stderr, "    [-geometry           display             (1024x1024+0+0).as(String              ) ] :Optional  :OutputLogFile\n");
     fprintf(stderr, "    [-c[onfig]           configFile          (NULL      ).as(inFile              ) ] :Optional  :ConfigurationFile\n");
diff --git a/src/Tools/Integration/Display2/src/wish/Display2Init.wish b/src/Tools/Integration/Display2/src/wish/Display2Init.wish
index 7f8a7af92b..0f7db00a40 100755
--- a/src/Tools/Integration/Display2/src/wish/Display2Init.wish
+++ b/src/Tools/Integration/Display2/src/wish/Display2Init.wish
@@ -1,5 +1,30 @@
 #!../Display2.HP 
-proc display2Init {} {
+
+# From Arguments
+proc display2SetVar {} {
+	global mainImage
+	global Roi
+	global thresHigh
+	global thresLow
+	global Inverse
+	global Zoom
+	
+	if [ info exists thresHigh ] {
+		set mainImage(thresHigh) $thresHigh
+	} 
+	if [ info exists thresLow ] {
+		set mainImage(thresLow) $thresLow
+	}
+	if [ info exists Inverse ] {
+		set mainImage(Inverse) Yes
+	}
+	if { [ info exists Zoom ] } {
+		set Roi(Zoom) $Zoom 
+	}
+}
+
+# Set
+proc display2InitVar {} {
 	global mousePressed
 	global Roi
 	global Point
@@ -16,6 +41,7 @@ proc display2Init {} {
 	global mainImage
 	global overviewImage 
 	global UnitCell
+	global Section
 
 	global roiInfoWin
 
@@ -29,8 +55,6 @@ proc display2Init {} {
 	
 	set tcl_precision 17 
 
-	#puts "in display2Init"
-
 	# Canvas Area Create
 	if [ info exists Desktop(mainCanvasX) ] {
 		set Desktop(mainCanvasX) $Desktop(mainCanvasX)	
@@ -42,9 +66,13 @@ proc display2Init {} {
 	} else {
 		set Desktop(mainCanvasY) 1999 
 	}
+
+
 	Canvas .overview_canvas 128 128
 	Canvas .zoom_canvas     128 128
+
 	scrolledCanvas .main_canvas 128 128 [ list 0  0 $Desktop(mainCanvasX) $Desktop(mainCanvasY) ]
+
 	set Desktop(mainCanvas)      .main_canvas
 	set Desktop(overviewCanvas)  .overview_canvas
 	set Desktop(zoomCanvas)      .zoom_canvas
@@ -53,7 +81,8 @@ proc display2Init {} {
 	set mainImage(mainCanvas)     .main_canvas
 	set mainImage(overviewCanvas) .overview_canvas
 	set mainImage(zoomCanvas)     .zoom_canvas
-	
+
+
 	set overviewImage(image)  No
 
 	set mainImage(image)  No
@@ -66,21 +95,11 @@ proc display2Init {} {
 	set mainImage(lz)	  0 
 	set mainImage(max)  1.0
 	set mainImage(min)  0.0
-	if [ info exists thresHigh ] {
-		set mainImage(thresHigh) $thresHigh
-	} else {
-		set mainImage(thresHigh) No
-	}
-	if [ info exists thresLow ] {
-		set mainImage(thresLow) $thresLow
-	} else {
-		set mainImage(thresLow)  No
-	}
-	if [ info exists Inverse ] {
-		set mainImage(Inverse) Yes
-	} else {
-		set mainImage(Inverse) No
-	}
+
+	set mainImage(thresHigh) No
+	set mainImage(thresLow)  No
+	set mainImage(Inverse) No
+
 	set mainImage(Contrast) 2
 
 	set mainImage(region) No 
@@ -117,11 +136,12 @@ proc display2Init {} {
 	set Roi(Extract)      foreground 
 	set Roi(withScale) Off
 	set Roi(absTicks)  54.6
+	set Roi(numFormat) "-%04d.roi"
 
 	if { [ info exists fileNameIn ] } {
 		set Roi(MontageFile)     [ string trimright $fileNameIn ".mrc" ].mon 
 		set Roi(InformationFile) [ string trimright $fileNameIn ".mrc" ].roiinfo 
-		set Roi(ROIFile)         [ string trimright $fileNameIn ".mrc" ]-%04d.roi
+		set Roi(ROIFile)         [ string trimright $fileNameIn ".mrc" ]$Roi(numFormat)
 		set Roi(ShrinkOriginalFile)      [ string trimright $fileNameIn ".shrink"].mrc 
 	} else {
 		set Roi(MontageFile)     No.mon 
@@ -131,11 +151,7 @@ proc display2Init {} {
 	set Roi(CurrentID) 0
 	set Roi(TotalN)    0
 	#
-	if { [ info exists Zoom ] } {
-		set Roi(Zoom) $Zoom 
-	} else {
-		set Roi(Zoom)         1
-	}
+	set Roi(Zoom)         1
 	set Roi(ZoomX)        1
 	set Roi(ZoomY)        1
 
@@ -195,6 +211,169 @@ proc display2Init {} {
 	set UnitCell(beta) 90 
 	set UnitCell(gamma) 90 
 
+    set Section(Initialize) 1
+    set Section(flag)  OFF 
+    set Section(which) Y
+    set Section(scale) 1 
+    set Section(scaleDelta) 0.1 
+    set Section(at)    0   
+    set Section(atDelta)   1   
+    set Section(mode)  normal 
+    set Section(Num)   0   
+    set Section(Current) -1  
+    set Section(Win,Title) "Section Information"
+}
+
+proc display2InitVarSet  { filename } {
+	set fpt [ open $filename a ]
+
+puts $fpt {
+#
+# Default
+#
+
+# Precision
+set tcl_precision 17 
+
+# Image 
+set mainImage(thresHigh) No
+set mainImage(thresLow)  No
+set mainImage(Inverse)   No
+set mainImage(Contrast)   2
+set mainImage(flagLog)    0 
+set mainImage(flagPow)    0 
+set mainImage(HistNum)  256 
+
+# Roi
+set Roi(OKColor)        #118866
+set Roi(SelectColor)    #0000ff
+set Roi(LineWidth)      3
+set Roi(CurrentColor)   $Roi(OKColor) 
+set Roi(Shape)          Rectangle
+set Roi(Shrink)         1
+set Roi(MultiShape)     Off 
+set Roi(MultiNumber)    Off 
+set Roi(SizeLock)       Off 
+set Roi(Analysis)       Off 
+set Roi(View)           off 
+set Roi(Extract)        foreground 
+set Roi(withScale)      Off
+set Roi(absTicks)       54.6
+set Roi(numFormat)      "-%04d.roi"
+
+# Zooming
+set Roi(Zoom)         1
+set Roi(ZoomX)        1
+set Roi(ZoomY)        1
+
+# Point 
+set Point(x) 0
+set Point(y) 0 
+set Point(dat) 0
+set Point(cx) 0
+set Point(cy) 0 
+set Point(cdat) 0
+
+# Roi Rectangle
+set rectanglePoints(width)  128.0
+set rectanglePoints(height) 128.0
+set rectanglePoints(angle)    0.0 
+
+# spline
+set splinePoints(Width)       80
+
+# LayerLine
+set LayerLine(flag) OFF
+set LayerLine(pointRadius) 3 
+
+# Projection Line
+set Projection(flag)  OFF
+set Projection(which) Y
+set Projection(scale) 1 
+
+# Unit Cell
+set UnitCell(n) 0
+set UnitCell(dimension) 2
+set UnitCell(axis1,n) 5 
+set UnitCell(axis2,n) 5 
+set UnitCell(axis3,n) 0 
+set UnitCell(axis1,x) 1 
+set UnitCell(axis1,y) 0 
+set UnitCell(axis1,z) 0 
+set UnitCell(axis2,x) 0 
+set UnitCell(axis2,y) 1 
+set UnitCell(axis2,z) 0 
+set UnitCell(axis3,x) 0 
+set UnitCell(axis3,y) 0 
+set UnitCell(axis3,z) 1 
+
+set UnitCell(box,x) 5  
+set UnitCell(box,y) 5 
+set UnitCell(box,z) 0 
+
+set UnitCell(alpha) 90 
+set UnitCell(beta)  90 
+set UnitCell(gamma) 90 
+
+# Section
+set Section(flag)       OFF 
+set Section(which)        Y
+set Section(scale)        1 
+set Section(scaleDelta) 0.1 
+set Section(at)           0   
+set Section(atDelta)      1   
+set Section(mode)    normal 
+}
+	close $fpt
+}
+
+proc display2Init {} {
+	global mousePressed
+	global Roi
+	global Point
+	global rectanglePoints
+	global linePoints
+	global splinePoints
+	global LayerLine
+	global Projection 
+	global ctfInfo 
+	global LogFile
+
+	global Desktop
+	global CommandPut
+	global mainImage
+	global overviewImage 
+	global UnitCell
+
+	global roiInfoWin
+
+	# Global Variables from Display2 
+	global fileNameIn
+	global LogFile
+	global thresHigh 
+	global thresLow
+	global Inverse
+	global Zoom 
+	
+	global defaultFile
+
+	display2InitVar 
+
+	if [ info exists defaultFile ] {
+		#
+	} else {
+		set defaultFile "~/.Eos/Display2"
+	}
+	if [ file exists $defaultFile ] {
+		#
+	} else {
+		display2InitVarSet $defaultFile
+	}
+	source $defaultFile	
+
+	# from arguments
+	display2SetVar
+	
 	display2MenuSet
 	display2MenuSet2
 	display2BindingSet .main_canvas.canvas
-- 
2.11.0