]> Creatis software - creaWT.git/commitdiff
#3040 creaWT Bug New Normal - box ViewerWeb update
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 17 Nov 2016 15:11:07 +0000 (16:11 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 17 Nov 2016 15:11:07 +0000 (16:11 +0100)
wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbg
wt/bbtk_wt_PKG/bbs/boxes/ImageWriteB.bbg
wt/bbtk_wt_PKG/bbs/boxes/ImageWriteB.bbs
wt/bbtk_wt_PKG/src/bbwtViewerNVWeb.cxx

index 2dfd1ade5a96a80abac6cb2b4ad6baedb0a8e81d..e68947362c0889fba14b8fff15879d6e00838863 100644 (file)
@@ -19,8 +19,8 @@ FIN_BOX
 BOX
 itk:BinaryThresholdImageFilter:Box02
 ISEXEC:FALSE
--37.240041:-147.039576:-900.000000
-33.934959:-157.039576:-900.000000
+16.529723:-124.228161:-900.000000
+87.704723:-134.228161:-900.000000
 PORT
 InsideValue:"255"
 PORT
@@ -33,8 +33,8 @@ FIN_BOX
 BOX
 vtk:MarchingCubes:Box05
 ISEXEC:FALSE
-42.059812:-205.568278:-900.000000
-87.634812:-215.568278:-900.000000
+-52.851969:-223.084186:-900.000000
+-7.276969:-233.084186:-900.000000
 PORT
 ComputeNormalsOn:"true"
 PORT
@@ -45,8 +45,8 @@ FIN_BOX
 BOX
 vtk:ImageContinuousErode3D:Box06
 ISEXEC:FALSE
-55.330546:-148.747823:-900.000000
-126.505546:-158.747823:-900.000000
+-15.547780:-164.634344:-900.000000
+55.627220:-174.634344:-900.000000
 PORT
 KernelSizeX:"3"
 PORT
@@ -57,8 +57,8 @@ FIN_BOX
 BOX
 vtk:SegmentationConnectivity:Box09
 ISEXEC:FALSE
-54.014140:-166.439600:-900.000000
-125.189140:-176.439600:-900.000000
+-22.159693:-183.955508:-900.000000
+49.015307:-193.955508:-900.000000
 PORT
 PositionXYZ:"73 101 93"
 PORT
@@ -67,8 +67,8 @@ FIN_BOX
 BOX
 wt:ViewerNVWeb:Box12
 ISEXEC:FALSE
--101.034885:-197.398691:-900.000000
--55.459885:-207.398691:-900.000000
+-89.221831:-177.846049:-900.000000
+-43.646831:-187.846049:-900.000000
 PORT
 ImagePath:"imagesTMP/hola.nii"
 FIN_BOX
@@ -92,7 +92,7 @@ BOX
 wt:Slider:Box16
 ISEXEC:FALSE
 -163.108601:-79.545339:-900.000000
--114.788601:-89.545339:-900.000000
+-128.421336:-89.545339:-900.000000
 PORT
 In:"1500"
 PORT
@@ -108,7 +108,7 @@ BOX
 wt:LayoutLine:Box17
 ISEXEC:FALSE
 -170.375687:-198.734780:-900.000000
--124.012327:-208.734780:-900.000000
+-121.323656:-208.734780:-900.000000
 FIN_BOX
 BOX
 wt:CommandButton:Box21
@@ -121,8 +121,8 @@ FIN_BOX
 BOX
 vtk:ImageGaussianSmooth:Box29
 ISEXEC:FALSE
-51.402317:-187.813911:-900.000000
-122.577317:-197.813911:-900.000000
+-43.509464:-205.329819:-900.000000
+27.665536:-215.329819:-900.000000
 PORT
 StdDevX:"0"
 PORT
@@ -134,7 +134,7 @@ BOX
 wt:Slider:Box31
 ISEXEC:FALSE
 -78.667210:-47.626578:-900.000000
--30.347210:-57.626578:-900.000000
+-45.892210:-57.626578:-900.000000
 PORT
 In:"1"
 PORT
@@ -149,8 +149,8 @@ FIN_BOX
 BOX
 wt:AddMeshB:Box37
 ISEXEC:FALSE
-38.683815:-225.123788:-900.000000
-84.258815:-235.123788:-900.000000
+-56.227966:-242.639696:-900.000000
+-10.652966:-252.639696:-900.000000
 FIN_BOX
 BOX
 wt:configServerWT:Box38
@@ -171,8 +171,8 @@ FIN_BOX
 BOX
 wt:LayoutSplit:Box40
 ISEXEC:TRUE
--143.571980:-228.411427:-900.000000
--97.996980:-238.411427:-900.000000
+-140.800343:-255.819841:-900.000000
+-95.225343:-265.819841:-900.000000
 PORT
 Orientation:"h"
 FIN_BOX
@@ -180,7 +180,7 @@ BOX
 wt:OutputText:Box25
 ISEXEC:FALSE
 -200.993777:-157.082523:-900.000000
--155.418777:-167.082523:-900.000000
+-155.145024:-167.082523:-900.000000
 PORT
 In:"ZOOM  to refresh screen"
 FIN_BOX
index e789ba87dbf224c4b8122162a70b2ad6b18377bb..1970c4507932af8bc999b235259aacb78bac122b 100644 (file)
@@ -19,12 +19,16 @@ COMPLEX_PORT
 out
 12.962019:-76.083926:-900.000000
 FIN_COMPLEX_PORT
-COMPLEXINPUTS:1
+COMPLEXINPUTS:2
 COMPLEX_PORT
 Image
 21.790028:78.397984:-900.000000
 FIN_COMPLEX_PORT
-BOXES:6
+COMPLEX_PORT
+boxExecute
+46.295333:78.203501:-900.000000
+FIN_COMPLEX_PORT
+BOXES:7
 BOX
 std:ConcatStrings:Box00
 ISEXEC:FALSE
@@ -50,8 +54,8 @@ FIN_BOX
 BOX
 std:RandomString:Box03
 ISEXEC:FALSE
--30.164384:67.060138:-900.000000
-15.410616:57.060138:-900.000000
+-25.036286:43.129012:-900.000000
+20.538714:33.129012:-900.000000
 FIN_BOX
 BOX
 std:ConcatStrings:Box04
@@ -69,7 +73,13 @@ ISEXEC:FALSE
 PORT
 In2:"/"
 FIN_BOX
-CONNECTIONS:8
+BOX
+std:MagicBox:Box06
+ISEXEC:FALSE
+52.278114:46.580227:-900.000000
+97.853114:36.580227:-900.000000
+FIN_BOX
+CONNECTIONS:11
 CONNECTION
 Image:Image:Box01:In
 NumberOfControlPoints:0
@@ -94,4 +104,13 @@ NumberOfControlPoints:0
 CONNECTION
 Box03:Out:Box00:In2
 NumberOfControlPoints:0
+CONNECTION
+boxExecute:boxExecute:Box06:In
+NumberOfControlPoints:0
+CONNECTION
+Box06:BoxChange:Box04:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box06:BoxChange:Box01:BoxExecute
+NumberOfControlPoints:0
 APP_END
index c4a64a75e68fb49d899ec296788ef331ca4c168e..7962700c1fef8a81dfea69e3d402e8c5793449c5 100644 (file)
@@ -16,31 +16,36 @@ description "Description ??"
 
 category "<VOID>"
 
-new ConcatStrings Box00
+new std:ConcatStrings Box00
   set Box00.In1 "hola"
   set Box00.In3 ".nii"
 
-new ImageWriter Box01
+new itk:ImageWriter Box01
 
-new GetConfigServerWt Box02
+new wt:GetConfigServerWt Box02
 
-new RandomString Box03
+new std:RandomString Box03
 
-new ConcatStrings Box04
+new std:ConcatStrings Box04
   set Box04.In1 "imagesTMP/"
 
-new ConcatStrings Box05
+new std:ConcatStrings Box05
   set Box05.In2 "/"
 
+new std:MagicBox Box06
+
 
 connect Box00.Out Box04.In2
 connect Box02.DocRoot Box05.In1
 connect Box04.Out Box05.In3
 connect Box05.Out Box01.Filename
 connect Box03.Out Box00.In2
+connect Box06.BoxChange Box04.BoxExecute
+connect Box06.BoxChange Box01.BoxExecute
 
 # Complex input ports
 input Image Box01.In " "
+input boxExecute Box06.In " "
 
 # Complex output ports
 output FileName Box04.Out " "
index 8fa80e4ef377bcbac25cb308f8b53f3b27024291..094ef1277eaf0d149445932f9b6e9555e1188918 100644 (file)
@@ -89,137 +89,135 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ViewerNVWeb,bbtk::WtBlackBox);
 //--------------------------------------------------------------------------------------------------------
 void ViewerNVWeb::Process()
 {
-       printf("EED ViewerNVWeb::Process start\n ");
-
        Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetOutputWidget();
-       std::string jsCom;
-       
-       //jsCom = "\
-                       var volume = new X.volume();\
-                       volume.spacing = [0.7,0.7,0.7 ];\
-                       volume.file = '" + bbGetInputImagePath() + "';\
-                       " +w->jsRef() + ".mVolume = volume;\
-                       setTimeout(function(){\
-                       var center = [0,0,0\
-                  ];\
-                       " +w->jsRef() + ".mVolume.center = center;\
-                       volume.center = [0,0,0];\
-                       " + wtWindow1->jsRef() + ".mRenderer.add(" + w->jsRef() + ".mVolume);\
-                       " + wtWindow1->jsRef() + ".mRenderer.onShowTime = function(){\
-                       " + w->jsRef() +".mVolume.upperThreshold =20000;\
-                       " + w->jsRef() +".mVolume.windowHigh =1670;\
-                       var gui = new dat.GUI();\
-                  var volumegui = gui.addFolder('Volume');\
-                  var vrController = volumegui.add(" + w->jsRef() +".mVolume, 'volumeRendering');\
-                  var opacityController = volumegui.add(" + w->jsRef() +".mVolume, 'opacity', 0, 1);\
-                  var lowerWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowLow', 0,2000);\
-                  var upperWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowHigh', 0,2000);\
-                  var sliceXController = volumegui.add(" + w->jsRef() +".mVolume, 'indexX', 0,volume.range[0] - 1);\
-                  var sliceYController = volumegui.add(" + w->jsRef() +".mVolume, 'indexY', 0,volume.range[1] - 1);\
-                  var sliceZController = volumegui.add(" + w->jsRef() +".mVolume, 'indexZ', 0,volume.range[2] - 1);\
-                       " + wtWindow2->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                         " + wtWindow2->jsRef() + ".mRenderer.render();\
-                       " + wtWindow3->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                         " + wtWindow3->jsRef() + ".mRenderer.render();\
-                       " + wtWindow4->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                         " + wtWindow4->jsRef() + ".mRenderer.render();\
-                         };\
-                       " + wtWindow1->jsRef() + ".mRenderer.render();\
-                       },500";
-
-
-       if (firstTime==false)
+       std::string jsCom;      
+printf("EED ViewerNVWeb::Process %s\n", bbGetInputImagePath().c_str() );
+       bool ok;
+       FILE *ff=fopen( bbGetInputImagePath().c_str() , "r" );
+       if (ff)
        {
-               firstTime=false;
-                 jsCom = "\
-                       var volume = new X.volume();\
-                       volume.spacing = [0.7,0.7,0.7 ];\
-                       volume.file = '" + bbGetInputImagePath() + "';\
-                       " +w->jsRef() + ".mVolume = volume;\
-                       var center = [0,0,0];\
-                       " +w->jsRef() + ".mVolume.center = center;\
-                       volume.center = [0,0,0];\
-                       setTimeout(function(){\
-                       " + wtWindow1->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                       " + wtWindow1->jsRef() + ".mRenderer.render();\
-                     },300);\
-                     ";
-               w->doJavaScript(jsCom);
-       }
+               ok=true;
+               fclose(ff);
+       } else {
+               ok=false;
+       }       
 
-       if (firstTime==true)
+       if (ok==true)
        {
-               firstTime=false;
-                 jsCom = "\
-                       var volume = new X.volume();\
-                       volume.spacing = [0.7,0.7,0.7 ];\
-                       volume.file = '" + bbGetInputImagePath() + "';\
-                       " +w->jsRef() + ".mVolume = volume;\
-                       var center = [0,0,0];\
-                       " +w->jsRef() + ".mVolume.center = center;\
-                       volume.center = [0,0,0];\
-                       setTimeout(function(){\
-                       " + wtWindow1->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                       " + wtWindow1->jsRef() + ".mRenderer.render();\
-                     },300);\
-                       setTimeout(function(){\
-                       " + w->jsRef() +".mVolume.upperThreshold =20000;\
-                       " + w->jsRef() +".mVolume.windowHigh =1670;\
-                       var gui = new dat.GUI();\
-                  var volumegui = gui.addFolder('Volume');\
-                  var vrController = volumegui.add(" + w->jsRef() +".mVolume, 'volumeRendering');\
-                  var opacityController = volumegui.add(" + w->jsRef() +".mVolume, 'opacity', 0, 1);\
-                  var lowerWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowLow', 0,2000);\
-                  var upperWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowHigh', 0,2000);\
-                  var sliceXController = volumegui.add(" + w->jsRef() +".mVolume, 'indexX', 0,volume.range[0] - 1);\
-                  var sliceYController = volumegui.add(" + w->jsRef() +".mVolume, 'indexY', 0,volume.range[1] - 1);\
-                  var sliceZController = volumegui.add(" + w->jsRef() +".mVolume, 'indexZ', 0,volume.range[2] - 1);\
-                       " + wtWindow2->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                         " + wtWindow2->jsRef() + ".mRenderer.render();\
-                       " + wtWindow3->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                         " + wtWindow3->jsRef() + ".mRenderer.render();\
-                       " + wtWindow4->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                         " + wtWindow4->jsRef() + ".mRenderer.render();\
-                     },3000);\
-                               ";
-                     
-   // jsCom = "\
-                       var volume = new X.volume();\
-                       volume.spacing = [0.7,0.7,0.7 ];\
-                       volume.file = '" + bbGetInputImagePath() + "';\
-                       " +w->jsRef() + ".mVolume = volume;\
-                       var center = [0,0,0\
-                  ];\
-                       " +w->jsRef() + ".mVolume.center = center;\
-                       volume.center = [0,0,0];\
-                       setTimeout(function(){\
-                       " + wtWindow1->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                     },300);\
-                       " + wtWindow1->jsRef() + ".mRenderer.onShowTime = function(){\
-                       " + w->jsRef() +".mVolume.upperThreshold =20000;\
-                       " + w->jsRef() +".mVolume.windowHigh =1670;\
-                       var gui = new dat.GUI();\
-                  var volumegui = gui.addFolder('Volume');\
-                  var vrController = volumegui.add(" + w->jsRef() +".mVolume, 'volumeRendering');\
-                  var opacityController = volumegui.add(" + w->jsRef() +".mVolume, 'opacity', 0, 1);\
-                  var lowerWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowLow', 0,2000);\
-                  var upperWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowHigh', 0,2000);\
-                  var sliceXController = volumegui.add(" + w->jsRef() +".mVolume, 'indexX', 0,volume.range[0] - 1);\
-                  var sliceYController = volumegui.add(" + w->jsRef() +".mVolume, 'indexY', 0,volume.range[1] - 1);\
-                  var sliceZController = volumegui.add(" + w->jsRef() +".mVolume, 'indexZ', 0,volume.range[2] - 1);\
-                       " + wtWindow2->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                         " + wtWindow2->jsRef() + ".mRenderer.render();\
-                       " + wtWindow3->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                         " + wtWindow3->jsRef() + ".mRenderer.render();\
-                       " + wtWindow4->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
-                         " + wtWindow4->jsRef() + ".mRenderer.render();\
-                         };\
-                       " + wtWindow1->jsRef() + ".mRenderer.render();";
-                       
-                       std::cout<<"LOADzzzzzzzzzzzzzzzzzzzzzzzzzzzz"<<jsCom<<std::endl;
+               if (firstTime==false)
+               {
+
+/*
+                         jsCom = "\
+                               try{\
+                                       var volume = new X.volume();\
+                               volume.spacing = [0.7,0.7,0.7 ];\
+                                   volume.file = '" + bbGetInputImagePath() + "';\
+                                   " +w->jsRef() + ".mVolume = volume;\
+                                   var center = [0,0,0];\
+                                   " +w->jsRef() + ".mVolume.center = center;\
+                               volume.center = [0,0,0];\
+                                   setTimeout(function(){\
+                               " + wtWindow1->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                                   " + wtWindow1->jsRef() + ".mRenderer.render();\
+                             },300);\
+                               } catch (err) {\
+                               } \
+                  ";
+*/
+
+/*
+                         jsCom = "\
+                               try{\
+                                   " +w->jsRef() + ".mVolume.file = '" + bbGetInputImagePath() + "';\
+                                   setTimeout(function(){\
+                               " + wtWindow1->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                                   " + wtWindow1->jsRef() + ".mRenderer.render();\
+                             },300);\
+                               } catch (err) {\
+                               } \
+                  ";
+
                        w->doJavaScript(jsCom);
-       }
-       
+*/
+
+               }
+
+               if (firstTime==true)
+               {
+                       firstTime=false;
+                         jsCom = "\
+                                       try{\
+                               var volume = new X.volume();\
+                               volume.spacing = [0.7,0.7,0.7 ];\
+                                   volume.file = '" + bbGetInputImagePath() + "';\
+                                   " +w->jsRef() + ".mVolume = volume;\
+                                   var center = [0,0,0];\
+                                   " +w->jsRef() + ".mVolume.center = center;\
+                               volume.center = [0,0,0];\
+                                   setTimeout(function(){\
+                                       " + wtWindow1->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                                           " + wtWindow1->jsRef() + ".mRenderer.render();\
+                               },300);\
+                                   setTimeout(function(){\
+                                       " + w->jsRef() +".mVolume.upperThreshold =20000;\
+                                       " + w->jsRef() +".mVolume.windowHigh =1670;\
+                                       var gui = new dat.GUI();\
+                                       var volumegui = gui.addFolder('Volume');\
+                                       var vrController = volumegui.add(" + w->jsRef() +".mVolume, 'volumeRendering');\
+                                       var opacityController = volumegui.add(" + w->jsRef() +".mVolume, 'opacity', 0, 1);\
+                                       var lowerWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowLow', 0,2000);\
+                                       var upperWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowHigh', 0,2000);\
+                                       var sliceXController = volumegui.add(" + w->jsRef() +".mVolume, 'indexX', 0,volume.range[0] - 1);\
+                                       var sliceYController = volumegui.add(" + w->jsRef() +".mVolume, 'indexY', 0,volume.range[1] - 1);\
+                                       var sliceZController = volumegui.add(" + w->jsRef() +".mVolume, 'indexZ', 0,volume.range[2] - 1);\
+                                       " + wtWindow2->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                                       " + wtWindow2->jsRef() + ".mRenderer.render();\
+                                       " + wtWindow3->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                                       " + wtWindow3->jsRef() + ".mRenderer.render();\
+                                       " + wtWindow4->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                                       " + wtWindow4->jsRef() + ".mRenderer.render();\
+                               },3000);\
+                                       } catch(err) { \
+                                       } \
+                                       ";
+                             
+          // jsCom = "\
+                               var volume = new X.volume();\
+                               volume.spacing = [0.7,0.7,0.7 ];\
+                                   volume.file = '" + bbGetInputImagePath() + "';\
+                                   " +w->jsRef() + ".mVolume = volume;\
+                                   var center = [0,0,0\
+                             ];\
+                                   " +w->jsRef() + ".mVolume.center = center;\
+                               volume.center = [0,0,0];\
+                                   setTimeout(function(){\
+                               " + wtWindow1->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                             },300);\
+                               " + wtWindow1->jsRef() + ".mRenderer.onShowTime = function(){\
+                               " + w->jsRef() +".mVolume.upperThreshold =20000;\
+                                   " + w->jsRef() +".mVolume.windowHigh =1670;\
+                                   var gui = new dat.GUI();\
+                             var volumegui = gui.addFolder('Volume');\
+                             var vrController = volumegui.add(" + w->jsRef() +".mVolume, 'volumeRendering');\
+                             var opacityController = volumegui.add(" + w->jsRef() +".mVolume, 'opacity', 0, 1);\
+                             var lowerWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowLow', 0,2000);\
+                             var upperWindowController = volumegui.add(" + w->jsRef() +".mVolume, 'windowHigh', 0,2000);\
+                             var sliceXController = volumegui.add(" + w->jsRef() +".mVolume, 'indexX', 0,volume.range[0] - 1);\
+                             var sliceYController = volumegui.add(" + w->jsRef() +".mVolume, 'indexY', 0,volume.range[1] - 1);\
+                             var sliceZController = volumegui.add(" + w->jsRef() +".mVolume, 'indexZ', 0,volume.range[2] - 1);\
+                               " + wtWindow2->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                                     " + wtWindow2->jsRef() + ".mRenderer.render();\
+                               " + wtWindow3->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                                     " + wtWindow3->jsRef() + ".mRenderer.render();\
+                               " + wtWindow4->jsRef() + ".mRenderer.add(" +w->jsRef() + ".mVolume);\
+                                     " + wtWindow4->jsRef() + ".mRenderer.render();\
+                                     };\
+                                   " + wtWindow1->jsRef() + ".mRenderer.render();";
+                                   
+                               w->doJavaScript(jsCom);
+               } //if firsttime == true
+       } // ok
        
        //Wt::WApplication::instance()->refresh();
        // wtWindow2->resize(Wt::WLength::Auto, 200);
@@ -229,9 +227,6 @@ void ViewerNVWeb::Process()
         
         Wt::WApplication::instance()->refresh();
        
-  
-  printf("EED ViewerNVWeb::Process END\n ");
-
 
 }