]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Thu, 18 Dec 2008 11:54:44 +0000 (11:54 +0000)
committerguigues <guigues>
Thu, 18 Dec 2008 11:54:44 +0000 (11:54 +0000)
kernel/src/bbtkKWBlackBox.cxx
packages/appli/bbs/appli/Renderer.bbs [new file with mode: 0644]
packages/kw/bbs/appli/kwTour.bbs
packages/kw/bbs/boxes/bbVolumeRendererWithControls.bbs [new file with mode: 0644]
packages/kw/src/bbkwLayoutSplit.cxx
packages/kw/src/bbkwTransferFunctionEditor.cxx
packages/vtk/src/bbvtkImagePlanes.cxx
packages/vtk/src/bbvtkImagePlanes.h

index 6994d8bcc5386662726e619c0ff308762a0f8fb3..08679361b1b485a4123fd916b7c12f5ba0e38066 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkKWBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/11 09:50:35 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/12/18 11:54:44 $
+  Version:   $Revision: 1.8 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -153,13 +153,19 @@ namespace bbtk
                win->Create();
                win->SetResizable(0,0);
 
-               bbUserCreateWidget(win->GetFrame());            
+               bbUserCreateWidget(win->GetFrame());
+               /*
+               KW::GetApplication()->Script
+                 ("pack %s -expand yes -fill both",
+                  bbGetOutputWidget()->GetWidgetName());
+               */
+               
                KW::GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d",
                                             bbGetOutputWidget()->GetWidgetName(),
                                             bbGetInputWinWidth(),
                                             bbGetInputWinHeight());
                
-
+               
 
 
 
diff --git a/packages/appli/bbs/appli/Renderer.bbs b/packages/appli/bbs/appli/Renderer.bbs
new file mode 100644 (file)
index 0000000..7e1cb9e
--- /dev/null
@@ -0,0 +1,28 @@
+description "A 3D image renderer (uses kw)"
+author "laurent.guigues@creatis.insa-lyon.fr"
+category "application"
+
+load vtk
+load std
+load itk
+load itkvtk
+include kw
+
+load creaImageIO 
+new Gimmick reader
+
+new kwVolumeRendererWithControls renderer
+new kwViewer3D viewer
+
+connect reader.Out renderer.In
+connect renderer.Out viewer.In1
+connect renderer.BoxChange viewer.BoxExecute
+
+new kwLayoutSplit main
+connect viewer.Widget main.Widget2
+connect renderer.Widget main.Widget1
+
+set main.WinTitle "Volume renderer"
+
+exec main
+
index 0c5c075d5eb0d9239750873d0eac2c0b0f4c6bb5..f47bd3285d9c640c34ced7d366f92dd59877bb10 100644 (file)
@@ -7,8 +7,11 @@ load std
 include vtk
 load wx
 
+message Help 0
+
 print "=================================="
 print "A Slider whose output is plugged into an OutputText"
+print "=================================="
 message echo 2
 
 new kwSlider in
@@ -24,6 +27,8 @@ message echo 0
 clear
 print "=================================="
 print "The kwSlicer widget"
+print "=================================="
+help kwSlicer
 message echo 2
 
 new LoadHola r
@@ -33,8 +38,10 @@ exec s
 
 message echo 0
 clear
+/*
 print "=================================="
 print "Using both kw and wx"
+print "=================================="
 message echo 2
 
 new OutputText t
@@ -48,3 +55,32 @@ exec s
 
 message echo 0
 clear
+*/
+print "=================================="
+print "Volume renderer with controls"
+print "=================================="
+help kwVolumeRendererWithControls
+message echo 2
+
+new LoadHola image
+new kwVolumeRendererWithControls renderer
+new kwViewer3D viewer
+
+connect image.Out renderer.In
+connect renderer.Out viewer.In1
+connect renderer.BoxChange viewer.BoxExecute
+
+new kwLayoutSplit main
+connect viewer.Widget main.Widget2
+connect renderer.Widget main.Widget1
+
+exec main
+
+message echo 0
+message Help 1
+clear
+print " "
+print "====================================="
+print " END OF TOUR"
+print "====================================="
+
diff --git a/packages/kw/bbs/boxes/bbVolumeRendererWithControls.bbs b/packages/kw/bbs/boxes/bbVolumeRendererWithControls.bbs
new file mode 100644 (file)
index 0000000..ac3d037
--- /dev/null
@@ -0,0 +1,42 @@
+load vtk
+load std
+load kw
+
+
+define kwVolumeRendererWithControls kw
+  author "laurent.guigues@creatis.insa-lyon.fr"
+  description "Volume renderer (vtk::VolumeRenderer) with associated control panel (transfer function and opacity editors)"
+  category "image;widget;viewer"
+
+  new kwTransferFunctionEditor color
+  new kwTransferFunctionEditor opacity
+  new VolumeRenderer renderer
+  new kwLayoutSplit controls
+
+  connect color.Out renderer.ColorFunction
+  connect opacity.Out renderer.OpacityFunction
+  connect color.Widget controls.Widget2
+  connect opacity.Widget controls.Widget1
+
+  new MultipleInputs refresh
+  connect color.BoxChange refresh.In1
+  connect opacity.BoxChange refresh.In2
+
+  new "vtkImageData*Relay" image
+  connect image.Out color.In
+  connect image.Out opacity.In
+  connect image.Out renderer.In
+
+  set color.Title "Transfer function"
+  set opacity.Title "Opacity"
+
+  input In image.In "3D image to render"
+  input BoxExecute renderer.BoxExecute "Box execution"
+
+  output Out renderer.Out "Output 3D object to plug into a 3D viewer"
+  output BoxChange refresh.Out "BoxChange" 
+  output Widget controls.Widget "Widget"
+
+  exec renderer
+endefine
+
index 10a2097d1e41e0a058598805eb16c679e5ac69b4..ecb942b15818d71fcd469e567a8c1b3bfb321b95 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbkwLayoutSplit.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/02 13:37:56 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2008/12/18 11:54:57 $
+  Version:   $Revision: 1.4 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -100,11 +100,16 @@ namespace bbkw
 
    width = width - 5;
    height = height - 5 ;
-    
+   /*   
     bbGetOutputWidget()->GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d",
                                                  bbGetOutputWidget()->GetWidgetName(),
                                                  parent->GetWidth(),
                                                  parent->GetHeight() );
+   */
+   bbGetOutputWidget()->GetApplication()->Script
+     ("pack %s -expand yes -fill both",
+      bbGetOutputWidget()->GetWidgetName());
 
     splitframe->SetReliefToGroove();
     splitframe->SetBorderWidth(2);
@@ -114,7 +119,17 @@ namespace bbkw
     
     vtkKWWidget* w2 = bbCreateWidgetOfInput("Widget2",splitframe->GetFrame2());
  
-
+    splitframe->GetApplication()->Script
+      ("pack %s -expand yes -fill both",
+       w1->GetWidgetName()) ;
+   splitframe->GetApplication()->Script
+      ("pack %s -expand yes -fill both",
+       w2->GetWidgetName()) ;
+
+    /*
+    splitframe->GetApplication()->Script("pack %s -expand yes -fill x -fill y",        w2->GetWidgetName());
+    */
+   /*
    splitframe->GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d",
                                        w1->GetWidgetName(),
                                        width,
@@ -125,7 +140,7 @@ namespace bbkw
                                       width,
                                       height);
   
-
+    */
 
   }
 
index 26ff610333fa5ecdd8e759044e189eae129c45ee..e562209f88a08bd742f9782efb7c84bcf78d299c 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbkwTransferFunctionEditor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/16 13:00:27 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2008/12/18 11:54:57 $
+  Version:   $Revision: 1.3 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -97,8 +97,7 @@ namespace bbkw
 
     vtkKWPiecewiseFunctionEditor *w = vtkKWPiecewiseFunctionEditor::New();
     bbSetOutputWidget(w);
-    //    w->SetWindowLevelModeChangedCommand((vtkObject*)this,(const char*)"OnChange");
-                                       //AddObserver(vtkKWPiecewiseFunctionEditor::FunctionChangedCommand,this);
+    w->AddObserver(vtkKWPiecewiseFunctionEditor::FunctionChangedEvent,this);
     w->SetParent((vtkKWWidget*)parent);
     w->Create();
 
@@ -160,9 +159,11 @@ namespace bbkw
        std::cout << "TransferFunctionEditor::OnChange()" << std::endl;
       }
   
-  void TransferFunctionEditor::Execute(vtkObject* caller, unsigned long, void*)
+  void TransferFunctionEditor::Execute(vtkObject* caller, unsigned long , void*)
   {
-    std::cout << "$$$$$$$$$$$$ TransferFunctionEditor CB $$$$$$$$$$$$"<<std::endl;
+    bbSignalOutputModification("Out");    
+    //  std::cout << "$$$$$$$$$$$$ TransferFunctionEditor CB $$$$$$$$$$$$"<<std::endl;
+    
     /*
     vtkKWScale* scale = (vtkKWScale*)caller;
     bbSetOutputOut( scale->GetValue() );
index 1de608420e0eef8fc4f66e970242d7965469553e..e93074fe32180da8f6878ff6a5bb35655e3209c2 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbvtkImagePlanes.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/15 13:13:47 $
-  Version:   $Revision: 1.17 $
+  Date:      $Date: 2008/12/18 11:55:00 $
+  Version:   $Revision: 1.18 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -58,6 +58,7 @@
 
 #include "vtkPlaneWidget.h"
 
+#include "bbstdRelay.h"
 
 namespace bbstd
 {
@@ -66,9 +67,15 @@ namespace bbstd
   BBTK_BLACK_BOX_TEMPLATE2_IMPLEMENTATION(Cast,
                                          bbtk::AtomicBlackBox);
   //====================================================================
+  //====================================================================
+  BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(Relay,
+                                        bbtk::AtomicBlackBox);
+  //====================================================================
 
 }
 using namespace bbstd;
+
+
 namespace bbvtk
 {
 
@@ -80,6 +87,8 @@ namespace bbvtk
 
   BBTK_ADD_TEMPLATE2_BLACK_BOX_TO_PACKAGE(vtk,Cast,I,O);
 
+  BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(vtk,Relay,vtkImageDataPointer);
+
 }
 
 namespace bbvtk
index 0bb4c788cd43c38875c6f70d6fade69224295e3d..08fe3f6cd75a7a45b5d13f27bb4aa13b8f9b3873 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbvtkImagePlanes.h,v $
   Language:  C++
-  Date:      $Date: 2008/12/03 13:35:32 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2008/12/18 11:55:00 $
+  Version:   $Revision: 1.11 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -58,6 +58,7 @@
 class vtkImageData;
 class vtkImagePlaneWidget;
 
+
 namespace bbvtk
 {
 
@@ -114,6 +115,17 @@ namespace bbvtk
 
 }//namespace bbvtk
 
+namespace bbvtk
+{
+  typedef vtkImageData* vtkImageDataPointer;
+}
+namespace bbtk
+{
+  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(bbvtk::vtkImageDataPointer,
+                                      "vtkImageDataPointer");
+}
+
+
 #endif  //__bbtvtkImagePlanes_h__
 
 #endif //_USE_VTK_