]> Creatis software - bbtk.git/commitdiff
Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/bbtk
authorEsteban Correa <esteban@maurosc3ner.fedora>
Tue, 16 Apr 2013 13:15:22 +0000 (09:15 -0400)
committerEsteban Correa <esteban@maurosc3ner.fedora>
Tue, 16 Apr 2013 13:15:22 +0000 (09:15 -0400)
Conflicts:
packages/itk/src/bbitkImageProperties.h

12 files changed:
packages/itk/src/bbitkImageProperties.cxx
packages/itk/src/bbitkImageProperties.h
packages/itk/src/bbitkImageStatistics.cxx [new file with mode: 0644]
packages/itk/src/bbitkImageStatistics.h [new file with mode: 0644]
packages/std/src/bbstdDoubleToInt.cxx [new file with mode: 0644]
packages/std/src/bbstdDoubleToInt.h [new file with mode: 0644]
packages/vtk/bbs/appli/examplePlaneClipPolyData.bbg [new file with mode: 0644]
packages/vtk/bbs/appli/examplePlaneClipPolyData.bbs [new file with mode: 0644]
packages/vtk/src/bbvtkPlaneClipPolyData.cxx [new file with mode: 0644]
packages/vtk/src/bbvtkPlaneClipPolyData.h [new file with mode: 0644]
packages/wxvtk/src/bbwxvtkViewer3D.cxx
packages/wxvtk/src/bbwxvtkViewer3D.h

index 2304ba8d3168087d4e1d40b8529a768a1fefda3a..7e5f47dbd62272fd195bd9c26da125fb560b9abe 100644 (file)
@@ -117,9 +117,9 @@ namespace bbitk
     bbSetOutputOrigin(vog);
 
     typename itkImageType::SpacingType sp = im->GetSpacing();
-    std::vector<float> vsp;
+    std::vector<double> vsp;
     for (unsigned int i=0;i<dim;++i) 
-       vsp.push_back(sp[i]);
+       vsp.push_back(double(sp[i]));
        
  // brute hack to avoid failure of most black boxes that expects 3D images. // JPR
     if (dim==2)
index 4149e44b420d51d01b7fb55544fbe6601720f0ce..f1bf25bfd2296df8ba241d150500b7f9c2129aac 100644 (file)
@@ -70,7 +70,8 @@ namespace bbitk
     BBTK_DECLARE_OUTPUT(Index,std::vector<int>);
     BBTK_DECLARE_OUTPUT(Size,std::vector<int>);
     BBTK_DECLARE_OUTPUT(Origin,std::vector<float>);
-    BBTK_DECLARE_OUTPUT(Spacing,std::vector<float>);
+    BBTK_DECLARE_OUTPUT(Spacing,std::vector<double>);
+
        BBTK_DECLARE_OUTPUT(MinMax,std::vector<float>);
     BBTK_PROCESS(DoIt);
     void DoIt();
@@ -95,7 +96,7 @@ namespace bbitk
   BBTK_OUTPUT(ImageProperties,Index,"Index of the image",std::vector<int>,"image index");
   BBTK_OUTPUT(ImageProperties,Size,"Size in each dimension",std::vector<int>,"image size");
   BBTK_OUTPUT(ImageProperties,Origin,"Origin of the image",std::vector<float>,"image origin");
-  BBTK_OUTPUT(ImageProperties,Spacing,"Size of the voxels",std::vector<float>,"voxel size");
+  BBTK_OUTPUT(ImageProperties,Spacing,"Size of the voxels",std::vector<double>,"voxel size");
   BBTK_OUTPUT(ImageProperties,MinMax,"Minimum and the maximum intensity values of an image",std::vector<float>,"");
   BBTK_END_DESCRIBE_BLACK_BOX(ImageProperties);
   //=================================================================
diff --git a/packages/itk/src/bbitkImageStatistics.cxx b/packages/itk/src/bbitkImageStatistics.cxx
new file mode 100644 (file)
index 0000000..3ed5384
--- /dev/null
@@ -0,0 +1,95 @@
+
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  This software is governed by the CeCILL-B license under French law and
+ #  abiding by the rules of distribution of free software. You can  use,
+ #  modify and/ or redistribute the software under the terms of the CeCILL-B
+ #  license as circulated by CEA, CNRS and INRIA at the following URL
+ #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ #  or in the file LICENSE.txt.
+ #
+ #  As a counterpart to the access to the source code and  rights to copy,
+ #  modify and redistribute granted by the license, users are provided only
+ #  with a limited warranty  and the software's author,  the holder of the
+ #  economic rights,  and the successive licensors  have only  limited
+ #  liability.
+ #
+ #  The fact that you are presently reading this means that you have had
+ #  knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+  Program:   bbtk
+  Module:    $RCSfile: bbitkImageStatistics.h,v $
+  Language:  C++
+  Date:      $Date: 2013/03/27 $
+  Version:   $Revision: 1.0 $
+  Modified by: Ricardo A Corredor (RaC)
+=========================================================================*/
+
+
+/**
+ * \file
+ * \brief class ITKImageStatistics : generic ITKImage statistics
+ */
+/**
+ * \class bbtk::ITKImageStatistics
+ * \brief Generic ITKImage statictis
+ */
+
+#ifdef _USE_ITK_
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbitkImageStatistics.h"
+#include "bbitkPackage.h"
+namespace bbitk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(itk,ImageStatistics)
+BBTK_BLACK_BOX_IMPLEMENTATION(ImageStatistics,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ImageStatistics::bbUserSetDefaultValues()
+{
+       bbSetOutputMin(0);
+       bbSetOutputMax(0);
+       bbSetOutputMean(0);
+       bbSetOutputStdDev(0);
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ImageStatistics::bbUserInitializeProcessing()
+{
+
+
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ImageStatistics::bbUserFinalizeProcessing()
+{
+  
+}
+}
+// EO namespace bbitk
+#endif
+
diff --git a/packages/itk/src/bbitkImageStatistics.h b/packages/itk/src/bbitkImageStatistics.h
new file mode 100644 (file)
index 0000000..9fa0049
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  This software is governed by the CeCILL-B license under French law and
+ #  abiding by the rules of distribution of free software. You can  use,
+ #  modify and/ or redistribute the software under the terms of the CeCILL-B
+ #  license as circulated by CEA, CNRS and INRIA at the following URL
+ #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ #  or in the file LICENSE.txt.
+ #
+ #  As a counterpart to the access to the source code and  rights to copy,
+ #  modify and redistribute granted by the license, users are provided only
+ #  with a limited warranty  and the software's author,  the holder of the
+ #  economic rights,  and the successive licensors  have only  limited
+ #  liability.
+ #
+ #  The fact that you are presently reading this means that you have had
+ #  knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+  Program:   bbtk
+  Module:    $RCSfile: bbitkImageStatistics.h,v $
+  Language:  C++
+  Date:      $Date: 2013/03/27 $
+  Version:   $Revision: 1.0 $
+  Modified by: Ricardo A Corredor (RaC)
+=========================================================================*/
+
+
+/**
+ * \file
+ * \brief class ITKImageStatistics : generic ITKImage statistics
+ */
+/**
+ * \class bbtk::ITKImageStatistics
+ * \brief Generic ITKImage statictis
+ */
+
+#ifdef _USE_ITK_
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbitkImageStatistics_h_INCLUDED__
+#define __bbitkImageStatistics_h_INCLUDED__
+//#include "bbitk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+
+#include "iostream"
+
+#include "bbitkImage.h"
+
+#include <itkStatisticsImageFilter.h>
+
+
+namespace bbitk
+{
+
+class /*bbitk_EXPORT*/ ImageStatistics
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(ImageStatistics,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(In,bbitk::anyImagePointer);
+  BBTK_DECLARE_OUTPUT(Min,double);
+  BBTK_DECLARE_OUTPUT(Max,double);
+  BBTK_DECLARE_OUTPUT(Mean,double);
+  BBTK_DECLARE_OUTPUT(StdDev,double);
+  BBTK_PROCESS(Process);
+private:
+  inline void Process();
+  template <class T> void ProcessTemplated();
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageStatistics,bbtk::AtomicBlackBox);
+BBTK_NAME("ImageStatistics");
+BBTK_AUTHOR("Ricardo A Corredor");
+BBTK_DESCRIPTION("Basic Image Statistics (minimim, maximum, mean, standard deviation)");
+BBTK_CATEGORY("");
+BBTK_INPUT(ImageStatistics,In,"Input image. Can be any itk::Image<T,D>*",bbitk::anyImagePointer,"");
+BBTK_OUTPUT(ImageStatistics,Min,"Image minimum",double,"");
+BBTK_OUTPUT(ImageStatistics,Max,"Image maximum",double,"");
+BBTK_OUTPUT(ImageStatistics,Mean,"Image mean",double,"");
+BBTK_OUTPUT(ImageStatistics,StdDev,"Image standard deviation",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ImageStatistics);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+
+
+//===================================================
+void ImageStatistics::Process()
+{
+       bbtk::TypeInfo t = bbGetInputIn().type();
+       BBTK_TEMPLATE_ITK_IMAGE_SWITCH(t, this->ProcessTemplated);
+}
+//===================================================
+
+
+//===================================================
+template <class ImageType>
+void ImageStatistics::ProcessTemplated()
+{
+       bbtkDebugMessageInc("Core",9,"bbitk::ImageStatistics::Process<"<<bbtk::TypeName<ImageType>()<<">()"<<std::endl);
+
+       typedef itk::StatisticsImageFilter<ImageType> StatisticsImageFilterType;
+       typename StatisticsImageFilterType::Pointer statisticsImageFilter = StatisticsImageFilterType::New ();
+
+       // Input
+       ImageType* in = this->bbGetInputIn().get<ImageType*>();
+
+       statisticsImageFilter->SetInput(in);
+       statisticsImageFilter->Update();
+
+       std::cout << "Mean: " << statisticsImageFilter->GetMean() << std::endl;
+       std::cout << "Std.: " << statisticsImageFilter->GetSigma() << std::endl;
+       std::cout << "Min: " << statisticsImageFilter->GetMinimum() << std::endl;
+       std::cout << "Max: " << statisticsImageFilter->GetMaximum() << std::endl;
+
+       bbSetOutputMin((double)statisticsImageFilter->GetMinimum());
+       bbSetOutputMax((double)statisticsImageFilter->GetMaximum());
+       bbSetOutputMean((double)statisticsImageFilter->GetMean());
+       bbSetOutputStdDev((double)statisticsImageFilter->GetSigma());
+
+       bbtkDebugDecTab("Core",9);
+}
+//===================================================
+
+}
+// EO namespace bbitk
+
+#endif // __bbitkImageStatistics_h_INCLUDED__
+
+#endif  // _USE_ITK_
diff --git a/packages/std/src/bbstdDoubleToInt.cxx b/packages/std/src/bbstdDoubleToInt.cxx
new file mode 100644 (file)
index 0000000..6c41981
--- /dev/null
@@ -0,0 +1,70 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbstdDoubleToInt.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,DoubleToInt)
+BBTK_BLACK_BOX_IMPLEMENTATION(DoubleToInt,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void DoubleToInt::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+  bbSetOutputOut( (int)bbGetInputIn() );
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void DoubleToInt::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputIn(0);
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void DoubleToInt::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void DoubleToInt::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbstd
+
+
diff --git a/packages/std/src/bbstdDoubleToInt.h b/packages/std/src/bbstdDoubleToInt.h
new file mode 100644 (file)
index 0000000..83df9df
--- /dev/null
@@ -0,0 +1,45 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbstdDoubleToInt_h_INCLUDED__
+#define __bbstdDoubleToInt_h_INCLUDED__
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT DoubleToInt
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(DoubleToInt,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(In,double);
+  BBTK_DECLARE_OUTPUT(Out,int);
+  BBTK_PROCESS(Process);
+  void Process();
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(DoubleToInt,bbtk::AtomicBlackBox);
+BBTK_NAME("DoubleToInt");
+BBTK_AUTHOR("Claire Mouton");
+BBTK_DESCRIPTION("Converts a double to an int");
+BBTK_CATEGORY("");
+BBTK_INPUT(DoubleToInt,In,"Double input",double,"");
+BBTK_OUTPUT(DoubleToInt,Out,"Int output",int,"");
+BBTK_END_DESCRIBE_BLACK_BOX(DoubleToInt);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbstd
+
+#endif // __bbstdDoubleToInt_h_INCLUDED__
+
diff --git a/packages/vtk/bbs/appli/examplePlaneClipPolyData.bbg b/packages/vtk/bbs/appli/examplePlaneClipPolyData.bbg
new file mode 100644 (file)
index 0000000..1bb0f12
--- /dev/null
@@ -0,0 +1,51 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/corredor/Software/CreaTools/All_Dec2012/creatools_source/bbtk/packages/vtk/bbs/appli/examplePlaneClipPolyData.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:4
+BOX
+vtk:SphereSource:Box00
+ISEXEC:FALSE
+-100.995049:79.554760:-900.000000
+-55.420049:69.554760:-900.000000
+FIN_BOX
+BOX
+vtk:PlaneClipPolyData:Box01
+ISEXEC:FALSE
+-100.543675:49.764041:-900.000000
+-54.968675:39.764041:-900.000000
+PORT
+PlaneNormal:"0 1 0"
+PORT
+PlaneOrigin:"0 0 0 "
+FIN_BOX
+BOX
+vtk:PolyDataToActor:Box02
+ISEXEC:FALSE
+-97.835428:23.810006:-900.000000
+-52.260428:13.810006:-900.000000
+FIN_BOX
+BOX
+wxvtk:Viewer3D:Box03
+ISEXEC:TRUE
+-96.029930:-5.755025:-900.000000
+-35.389930:-15.755025:-900.000000
+FIN_BOX
+CONNECTIONS:3
+CONNECTION
+Box00:Out:Box01:PolyData
+NumberOfControlPoints:0
+CONNECTION
+Box01:ClippedPolyData:Box02:In
+NumberOfControlPoints:0
+CONNECTION
+Box02:Out:Box03:In1
+NumberOfControlPoints:0
+APP_END
diff --git a/packages/vtk/bbs/appli/examplePlaneClipPolyData.bbs b/packages/vtk/bbs/appli/examplePlaneClipPolyData.bbs
new file mode 100644 (file)
index 0000000..a5bba25
--- /dev/null
@@ -0,0 +1,38 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /home/corredor/Software/CreaTools/All_Dec2012/creatools_source/bbtk/packages/vtk/bbs/appli/examplePlaneClipPolyData.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include vtk
+include wxvtk
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new SphereSource Box00
+
+new PlaneClipPolyData Box01
+  set Box01.PlaneNormal "0 1 0"
+  set Box01.PlaneOrigin "0 0 0 "
+
+new PolyDataToActor Box02
+
+new Viewer3D Box03
+
+
+connect Box00.Out Box01.PolyData
+
+connect Box01.ClippedPolyData Box02.In
+
+connect Box02.Out Box03.In1
+
+
+
+# Complex input ports
+exec Box03
diff --git a/packages/vtk/src/bbvtkPlaneClipPolyData.cxx b/packages/vtk/src/bbvtkPlaneClipPolyData.cxx
new file mode 100644 (file)
index 0000000..e3432ee
--- /dev/null
@@ -0,0 +1,65 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbvtkPlaneClipPolyData.h"
+#include "bbvtkPackage.h"
+namespace bbvtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,PlaneClipPolyData)
+BBTK_BLACK_BOX_IMPLEMENTATION(PlaneClipPolyData,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void PlaneClipPolyData::Process()
+{
+
+       //std::cout << "RaC PlaneClipPolyData::Process START"<< std::endl;
+
+       std::vector<double> origin = bbGetInputPlaneOrigin();
+       std::vector<double> normal = bbGetInputPlaneNormal();
+
+       vtkPolyData* inPolyData = bbGetInputPolyData();
+
+       vtkPlane* plane = vtkPlane::New();
+       plane->SetOrigin(origin[0],origin[1],origin[2]);
+       plane->SetNormal(normal[0],normal[1],normal[2]);
+
+       vtkClipPolyData* clipper = vtkClipPolyData::New();
+       clipper->SetInputConnection(inPolyData->GetProducerPort());
+       clipper->SetClipFunction(plane);
+       clipper->Update();
+
+       vtkPolyData* outPolydata = clipper->GetOutput();
+    bbSetOutputClippedPolyData(outPolydata);
+
+   // std::cout << "RaC PlaneClipPolyData::Process END "<<polydataCopy<< std::endl;
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void PlaneClipPolyData::bbUserSetDefaultValues()
+{
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void PlaneClipPolyData::bbUserInitializeProcessing()
+{
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void PlaneClipPolyData::bbUserFinalizeProcessing()
+{
+  
+}
+}
+// EO namespace bbvtk
+
+
diff --git a/packages/vtk/src/bbvtkPlaneClipPolyData.h b/packages/vtk/src/bbvtkPlaneClipPolyData.h
new file mode 100644 (file)
index 0000000..f68ea0e
--- /dev/null
@@ -0,0 +1,68 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbvtkPlaneClipPolyData_h_INCLUDED__
+#define __bbvtkPlaneClipPolyData_h_INCLUDED__
+#include "bbvtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <vtkSmartPointer.h>
+#include <vtkPolyData.h>
+#include <vtkClipPolyData.h>
+#include <vtkPlane.h>
+
+#include <vtkDataSetMapper.h>
+#include <vtkActor.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+
+#include <vtkCamera.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkActor.h>
+#include <vtkProperty.h>
+#include <vtkSphereSource.h>
+
+namespace bbvtk
+{
+
+class bbvtk_EXPORT PlaneClipPolyData
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(PlaneClipPolyData,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(PlaneOrigin,std::vector<double>);
+  BBTK_DECLARE_INPUT(PlaneNormal,std::vector<double>);
+  BBTK_DECLARE_INPUT(PolyData,vtkPolyData*);
+  BBTK_DECLARE_OUTPUT(ClippedPolyData,vtkPolyData*);
+  BBTK_PROCESS(Process);
+  void Process();
+
+
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlaneClipPolyData,bbtk::AtomicBlackBox);
+BBTK_NAME("PlaneClipPolyData");
+BBTK_AUTHOR("Ricardo A Corredor");
+BBTK_DESCRIPTION("Clips a polydata with a plane determined by the origin and normal given");
+BBTK_CATEGORY("");
+BBTK_INPUT(PlaneClipPolyData,PlaneOrigin,"Cutting plane origin",std::vector<double>,"");
+BBTK_INPUT(PlaneClipPolyData,PlaneNormal,"Cutting plane normal",std::vector<double>,"");
+BBTK_INPUT(PlaneClipPolyData,PolyData,"PolyData to be clipped",vtkPolyData*,"");
+BBTK_OUTPUT(PlaneClipPolyData,ClippedPolyData,"New PolyData clipped",vtkPolyData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(PlaneClipPolyData);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbvtk
+
+#endif // __bbvtkPlaneClipPolyData_h_INCLUDED__
+
index 20728947c3167cc07214b8e0023d06ad8295fc32..1d5fd58d97ee02fb2dcc677fd9e62856cfd9c10b 100644 (file)
@@ -184,6 +184,11 @@ void Viewer3DWidget::Refresh(bool eraseBackground , const wxRect* rect )
                bbSetOutputRenderer( NULL );
                bbSetOutputInteractor( NULL );
                bbSetOutputWidget(NULL);
+               std::vector<double> bckgrndColor(3);
+               bckgrndColor[0] = 0.1;
+               bckgrndColor[1] = 0.1;
+               bckgrndColor[2] = 0.2;
+               bbSetInputBackgroundColor(bckgrndColor);
        }
        
        //-----------------------------------------------------------------     
@@ -247,7 +252,7 @@ void Viewer3DWidget::Refresh(bool eraseBackground , const wxRect* rect )
 //       Viewer3DWidget* w = (Viewer3DWidget*)bbGetOutputWidget();
 //       if (w)   w->Update();
 
-         
+
          
     Viewer3DWidget* w = (Viewer3DWidget*)bbGetOutputWidget();
          if ((firsttime==true) && (w!=NULL)){ 
@@ -288,6 +293,8 @@ void Viewer3DWidget::Refresh(bool eraseBackground , const wxRect* rect )
                  vtkRenderer *renderer = w->GetRenderer();
                  if (renderer!=NULL)
                  {
+                         std::vector<double> bckgrndColor = bbGetInputBackgroundColor();
+                         renderer->SetBackground(bckgrndColor[0], bckgrndColor[1], bckgrndColor[2]);
                          bbSetOutputRenderer( renderer );
                          
                          /*if (bbGetInputIn1()!=NULL) {renderer->AddActor( bbGetInputIn1() ); }
index b3fb40f926307a1b96105cbb12a4cb57c1983dc7..25dc71231fad950babc9d346cc61ea3f70c08de9 100644 (file)
@@ -107,6 +107,7 @@ namespace bbwxvtk
     BBTK_DECLARE_INPUT(Obs4, vtkInteractorObserver *);
     BBTK_DECLARE_INPUT(Obs5, vtkInteractorObserver *);
     BBTK_DECLARE_INPUT(Stereo, bool);
+    BBTK_DECLARE_INPUT(BackgroundColor,std::vector<double>);
     BBTK_DECLARE_OUTPUT(Renderer,vtkRenderer*);
     BBTK_DECLARE_OUTPUT(Interactor,wxVTKRenderWindowInteractor*);
     BBTK_PROCESS(Process);
@@ -130,6 +131,7 @@ namespace bbwxvtk
   BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
   BBTK_DESCRIPTION("3D Viewer widget (vtk)");
   BBTK_CATEGORY("viewer");
+  BBTK_INPUT(Viewer3D,BackgroundColor,"Render background's color",std::vector<double>,"");
   BBTK_INPUT(Viewer3D,In1,"Input actor",vtkProp3D *,"");
   BBTK_INPUT(Viewer3D,In2,"Input actor",vtkProp3D *,"");
   BBTK_INPUT(Viewer3D,In3,"Input actor",vtkProp3D *,"");