]> Creatis software - bbtk.git/commitdiff
Merge remote-tracking branch 'origin/master'
authorDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Fri, 26 Apr 2013 09:52:05 +0000 (11:52 +0200)
committerDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Fri, 26 Apr 2013 09:52:05 +0000 (11:52 +0200)
29 files changed:
kernel/cmake/BBTKConfigurePackage.cmake
packages/gdcmvtk/CMakeLists.txt
packages/gdcmvtk/PackageConfig.cmake.in
packages/gdcmvtk/src/CMakeLists.txt
packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx
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/std/src/bbstdReadColumnsDouble.cxx
packages/vtk/bbs/appli/exampleMeasureLength.bbg [new file with mode: 0644]
packages/vtk/bbs/appli/exampleMeasureLength.bbs [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/bbvtkBinaryOperations.h
packages/vtk/src/bbvtkMarchingCubes.cxx
packages/vtk/src/bbvtkMarchingCubes.h
packages/vtk/src/bbvtkMeasureLength.cxx [new file with mode: 0644]
packages/vtk/src/bbvtkMeasureLength.h [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/vtk/src/bbvtkPointsXYZtoVTKPoints.cxx [new file with mode: 0644]
packages/vtk/src/bbvtkPointsXYZtoVTKPoints.h [new file with mode: 0644]
packages/vtk/src/bbvtkSphereList.cxx
packages/vtk/src/bbvtkSphereList.h
packages/wxvtk/src/bbwxvtkViewer3D.cxx
packages/wxvtk/src/bbwxvtkViewer3D.h

index 83cc430bf52178a1eebaee1ccef7a9838aabfcf3..27fea041200fcfe4e6bd148130024f4c70eccf67 100644 (file)
@@ -142,6 +142,17 @@ IF(${BBTK_PACKAGE_NAME}_USE_ITK)
     ${${BBTK_PACKAGE_NAME}_LIBS}
     ${ITK_LIBRARIES}
     )
+
+       #Need to add additional gdcm  libraries provided by system
+       IF(WIN32)
+               IF(USE_GDCM2)
+                       SET(${BBTK_PACKAGE_NAME}_LIBS
+                               ${${BBTK_PACKAGE_NAME}_LIBS}
+                                vtkgdcm gdcmIOD gdcmMSFF gdcmexpat gdcmCommon gdcmMEXD gdcmDSED gdcmDICT 
+                                       gdcmjpeg8 gdcmjpeg12 gdcmjpeg16 socketxx gdcmopenjpeg gdcmcharls 
+                               )
+               ENDIF()
+       ENDIF(WIN32)
 ENDIF(${BBTK_PACKAGE_NAME}_USE_ITK)
 
 IF(${BBTK_PACKAGE_NAME}_USE_QT)
@@ -162,6 +173,7 @@ IF(${BBTK_PACKAGE_NAME}_USE_GDCM)
     ${${BBTK_PACKAGE_NAME}_LIBS}
     ${GDCM_LIBRARIES}
     )
+
        IF(USE_GDCM)
                IF(USE_GDCM2)
                message(FATAL_ERROR "You cannot select both GDCM and GDCM2 (DICOM library readers)")
@@ -174,10 +186,20 @@ ENDIF(${BBTK_PACKAGE_NAME}_USE_GDCM)
 IF(${BBTK_PACKAGE_NAME}_USE_GDCM2)
   SET(USE_GDCM2 ON CACHE BOOL "Use GDCM2" FORCE)
   SET(USE_GDCM2_VTK ON CACHE BOOL "Use GDCM2_VTK" FORCE)
-  SET(${BBTK_PACKAGE_NAME}_LIBS
-    ${${BBTK_PACKAGE_NAME}_LIBS}
-    ${GDCM2_LIBRARIES}
-    )
+  #For some reasons GDCM_LIBRARY is not defined for gdcm2 in windows
+  IF(WIN32)
+       SET(${BBTK_PACKAGE_NAME}_LIBS
+               ${${BBTK_PACKAGE_NAME}_LIBS}
+               vtkgdcm gdcmIOD gdcmMSFF gdcmexpat gdcmCommon gdcmMEXD gdcmDSED gdcmDICT 
+               gdcmjpeg8 gdcmjpeg12 gdcmjpeg16 socketxx gdcmopenjpeg gdcmcharls 
+               )
+  ELSE(WIN32)
+       SET(${BBTK_PACKAGE_NAME}_LIBS
+               ${${BBTK_PACKAGE_NAME}_LIBS}
+               ${GDCM_LIBRARY}
+               )
+       ENDIF(WIN32)
+               
        IF(USE_GDCM2)
                IF(USE_GDCM)
                message(FATAL_ERROR "You cannot select both GDCM and GDCM2 (DICOM library readers)")
index d28951bfd1e67ac424b0e152ad74dc518810e5c9..a0878263c005c7889e6900c3fec6ad7c5d79a229 100644 (file)
@@ -154,13 +154,12 @@ SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS
   )
 #===========================================================================
 
-#===========================================================================
+IF(USE_GDCM)
 SET(${BBTK_PACKAGE_NAME}_LIBS 
-  # LIST HERE THE ADDITIONAL LIBS TO LINK AGAINST
-  # EXCEPT : the same libs than for INCLUDE_DIRS
    vtkgdcm
-  )
-#===========================================================================
+   )
+ENDIF(USE_GDCM)
+
 
 
 #===========================================================================
index f41eef5e9eaf29c283fba6ff03d17cc617e38ab2..f682910f01e4aba713afd08b11848b51e5d908b3 100644 (file)
@@ -41,6 +41,8 @@ SET(@BBTK_PACKAGE_NAME@_MINOR_VERSION @BBTK_PACKAGE_MINOR_VERSION@)
 SET(@BBTK_PACKAGE_NAME@_BUILD_VERSION @BBTK_PACKAGE_BUILD_VERSION@)
 SET(@BBTK_PACKAGE_NAME@_INCLUDE_DIRS  @BBTK_PACKAGE_INCLUDE_DIRS@)
 SET(@BBTK_PACKAGE_NAME@_LIBS          @BBTK_PACKAGE_LIBS@)
+
+
 # A BBTK PACKAGE NEEDS BBTK
 FIND_PACKAGE(BBTK REQUIRED)
 # BBTK Package configuration file inclusion
index 651c9f97c5171bb092b6f7d66b5849fece1857be..b18ebf6aa9b842af2b71aa00098001fb9885bc63 100644 (file)
@@ -26,7 +26,8 @@
 #---------------------------------------------------------------------------
 # Include src configuration cmake script
 INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_src.cmake)
-#EED 6Mars2010
+
+
 add_dependencies(bb${BBTK_PACKAGE_NAME} bbfy)
 #---------------------------------------------------------------------------
 
index f9512461cf5b1a3b34aee2fbaed2126cabe6b214..50dea74200da26e88a6ded11c07e2f199f75fa99 100644 (file)
@@ -165,7 +165,7 @@ void GetInfoGdcmReader::Process()
 void GetInfoGdcmReader::bbUserSetDefaultValues()
 {
 #if defined USE_GDCM2
-   read=NULL;
+   reader=NULL;
 #endif   
 #if defined USE_GDCM
    reader=NULL;
index 458531f91ed39e83a063441cf44a87c2732d8bf6..7e5f47dbd62272fd195bd9c26da125fb560b9abe 100644 (file)
@@ -104,11 +104,22 @@ namespace bbitk
    if (dim==2)
         vsz.push_back(1);
     bbSetOutputSize(vsz);
+    
+    const typename itkImageType::PointType& orgn = im->GetOrigin();
+    std::vector<float> vog;
+    for (unsigned int i=0;i<dim;++i) 
+       vog.push_back(orgn[i]);
+       
+ // brute hack to avoid failure of most black boxes that expects 3D images. // EC
+    if (dim==2)
+       vog.push_back(1.0);
+  
+    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 a1c90dfd8b6a3d80b10fdbb2ff2a6676d84f5773..f1bf25bfd2296df8ba241d150500b7f9c2129aac 100644 (file)
@@ -69,7 +69,9 @@ namespace bbitk
     BBTK_DECLARE_OUTPUT(LargestPossibleRegion,anyImageRegion);
     BBTK_DECLARE_OUTPUT(Index,std::vector<int>);
     BBTK_DECLARE_OUTPUT(Size,std::vector<int>);
-    BBTK_DECLARE_OUTPUT(Spacing,std::vector<float>);
+    BBTK_DECLARE_OUTPUT(Origin,std::vector<float>);
+    BBTK_DECLARE_OUTPUT(Spacing,std::vector<double>);
+
        BBTK_DECLARE_OUTPUT(MinMax,std::vector<float>);
     BBTK_PROCESS(DoIt);
     void DoIt();
@@ -91,9 +93,10 @@ namespace bbitk
   BBTK_OUTPUT(ImageProperties,TypeName,"Pixel type name",std::string,"pixel type");
   BBTK_OUTPUT(ImageProperties,Dimension,"Dimension",unsigned int,"image dimension");
   BBTK_OUTPUT(ImageProperties,LargestPossibleRegion,"Global extent of the image",anyImageRegion,"");
-  BBTK_OUTPUT(ImageProperties,Index,"Origin of the image",std::vector<int>,"image index");
+  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,Spacing,"Size of the voxels",std::vector<float>,"voxel size");
+  BBTK_OUTPUT(ImageProperties,Origin,"Origin of the image",std::vector<float>,"image origin");
+  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__
+
index 95a8576a432aa975795da5efac6e959deaf3db15..c74a39fd1ff6e68a03059648200135ad841ce4b2 100644 (file)
@@ -56,13 +56,16 @@ void ReadColumnsDouble::Process()
        FILE *ff1 = fopen( bbGetInputFileName().c_str() , "r+" );
        if (ff1!=NULL)
        {
+                if (!feof(ff1))
+                        fscanf(ff1,"%s",tmpValue);
+
                while (!feof(ff1))
                {
                        for( i=0 ;  i<bbGetInputDimension() ; i++)
                        {
-                               fscanf(ff1,"%s",tmpValue);
                                vecData=tlst[i];
                                vecData->push_back( atof(tmpValue) );
+                                fscanf(ff1,"%s",tmpValue);
                        }       
                        numberOfLines++;                        
                }       
diff --git a/packages/vtk/bbs/appli/exampleMeasureLength.bbg b/packages/vtk/bbs/appli/exampleMeasureLength.bbg
new file mode 100644 (file)
index 0000000..f1ac03b
--- /dev/null
@@ -0,0 +1,119 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/corredor/Software/CreaTools/All_Dec2012/creatools_source/bbtk/packages/vtk/bbs/appli/exampleMeasureLength.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:example
+DESCRIPTION:Evaluates the sum of the Euclidean distances among the points in the list following their order. Put some points in the image using the Points Widget and the click on Evaluate Length button. 
+AUTHOR:Ricardo A Corredor
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:8
+BOX
+creaMaracasVisu:ShowNPoints:Box00
+ISEXEC:TRUE
+-51.309471:11.810349:-900.000000
+-2.989471:1.810349:-900.000000
+PORT
+WinTitle:"Points Widget"
+PORT
+WinWidth:"200"
+FIN_BOX
+BOX
+creaMaracasVisu:ViewerNV:Box02
+ISEXEC:TRUE
+-26.721828:47.483487:-900.000000
+33.918172:37.483487:-900.000000
+PORT
+WinTitle:"Image Viewer"
+FIN_BOX
+BOX
+wx:CommandButton:Box03
+ISEXEC:TRUE
+-128.980270:47.281481:-900.000000
+-83.405270:37.281481:-900.000000
+PORT
+Label:"Evaluate length..."
+PORT
+WinHeight:"200"
+PORT
+WinTitle:"Measure Length"
+PORT
+WinWidth:"200"
+FIN_BOX
+BOX
+vtk:MeasureLength:Box04
+ISEXEC:FALSE
+-112.956474:-50.441103:-900.000000
+-67.381474:-60.441103:-900.000000
+FIN_BOX
+BOX
+vtk:PointsXYZtoVTKPoints:Box05
+ISEXEC:FALSE
+-54.277786:-36.674180:-900.000000
+16.897214:-46.674180:-900.000000
+FIN_BOX
+BOX
+wx:OutputText:Box06
+ISEXEC:FALSE
+-113.407849:-80.683196:-900.000000
+-67.832849:-90.683196:-900.000000
+FIN_BOX
+BOX
+vtk:MetaImageReader:Box07
+ISEXEC:FALSE
+-58.531222:83.907503:-900.000000
+-12.956222:73.907503:-900.000000
+FIN_BOX
+BOX
+wx:FileSelector:Box08
+ISEXEC:FALSE
+-57.766108:111.196570:-900.000000
+-12.191108:101.196570:-900.000000
+PORT
+Message:"Select an image ..."
+PORT
+Title:"Select an image ..."
+FIN_BOX
+CONNECTIONS:13
+CONNECTION
+Box02:Renderer1:Box00:Renderer
+NumberOfControlPoints:0
+CONNECTION
+Box02:Point:Box00:In
+NumberOfControlPoints:0
+CONNECTION
+Box02:BoxChange:Box00:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box00:lstPointsX:Box05:LstPointsX
+NumberOfControlPoints:0
+CONNECTION
+Box00:lstPointsY:Box05:LstPointsY
+NumberOfControlPoints:0
+CONNECTION
+Box00:lstPointsZ:Box05:LstPointsZ
+NumberOfControlPoints:0
+CONNECTION
+Box05:Points:Box04:Points
+NumberOfControlPoints:0
+CONNECTION
+Box03:BoxChange:Box06:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box04:Length:Box06:In
+NumberOfControlPoints:0
+CONNECTION
+Box07:Out:Box02:In
+NumberOfControlPoints:0
+CONNECTION
+Box07:Out:Box04:ImageData
+NumberOfControlPoints:0
+CONNECTION
+Box07:Out:Box00:Image
+NumberOfControlPoints:0
+CONNECTION
+Box08:Out:Box07:In
+NumberOfControlPoints:0
+APP_END
diff --git a/packages/vtk/bbs/appli/exampleMeasureLength.bbs b/packages/vtk/bbs/appli/exampleMeasureLength.bbs
new file mode 100644 (file)
index 0000000..4ffc5a7
--- /dev/null
@@ -0,0 +1,76 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /home/corredor/Software/CreaTools/All_Dec2012/creatools_source/bbtk/packages/vtk/bbs/appli/exampleMeasureLength.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include creaMaracasVisu
+include wx
+include vtk
+
+author "Ricardo A Corredor"
+description "Evaluates the sum of the Euclidean distances among the points in the list following their order. Put some points in the image using the Points Widget and the click on Evaluate Length button. "
+category "example"
+
+new ShowNPoints Box00
+  set Box00.WinTitle "Points Widget"
+  set Box00.WinWidth "200"
+
+new ViewerNV Box02
+  set Box02.WinTitle "Image Viewer"
+
+new CommandButton Box03
+  set Box03.Label "Evaluate length..."
+  set Box03.WinHeight "200"
+  set Box03.WinTitle "Measure Length"
+  set Box03.WinWidth "200"
+
+new MeasureLength Box04
+
+new PointsXYZtoVTKPoints Box05
+
+new OutputText Box06
+
+new MetaImageReader Box07
+
+new FileSelector Box08
+  set Box08.Message "Select an image ..."
+  set Box08.Title "Select an image ..."
+
+
+connect Box02.Renderer1 Box00.Renderer
+
+connect Box02.Point Box00.In
+
+connect Box02.BoxChange Box00.BoxExecute
+
+connect Box00.lstPointsX Box05.LstPointsX
+
+connect Box00.lstPointsY Box05.LstPointsY
+
+connect Box00.lstPointsZ Box05.LstPointsZ
+
+connect Box05.Points Box04.Points
+
+connect Box03.BoxChange Box06.BoxExecute
+
+connect Box04.Length Box06.In
+
+connect Box07.Out Box02.In
+
+connect Box07.Out Box04.ImageData
+
+connect Box07.Out Box00.Image
+
+connect Box08.Out Box07.In
+
+
+
+# Complex input ports
+exec Box00
+exec Box02
+exec Box03
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
index b9d8683e8923bac0d692449ae5d4cf4fd1b235eb..9e6bd034774f0807f5a07860a6adcb814bfe350c 100644 (file)
@@ -68,7 +68,7 @@ class bbvtk_EXPORT BinaryOperations
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(BinaryOperations,bbtk::AtomicBlackBox);
 BBTK_NAME("BinaryOperations");
 BBTK_AUTHOR("Info-Dev");
-BBTK_DESCRIPTION("Math operation between two images");
+BBTK_DESCRIPTION("Arithmetic operations between two images: add, substract, multiply, divide");
 BBTK_CATEGORY("filter");
 BBTK_INPUT(BinaryOperations,In1,"first image to be operated",vtkImageData*,"NULL default");
 BBTK_INPUT(BinaryOperations,In2,"second image to be operated",vtkImageData*,"NULL default");
index ebadda0e286a5e67c68cb5a38d9b8f83f21ea33f..972c72f5d696c03abccfd0a0af810c98c9fa12a7 100644 (file)
@@ -54,6 +54,15 @@ namespace bbvtk
        void MarchingCubes::Process()
        {
                bbGetVtkObject()->SetValue(0, bbGetInputValue() );
+               if(bbGetInputComputeNormalsOn())
+                       bbGetVtkObject()->ComputeNormalsOn();
+               else
+                       bbGetVtkObject()->ComputeNormalsOff();
+
+               if(bbGetInputComputeScalarsOn())
+                       bbGetVtkObject()->ComputeScalarsOn();
+               else
+                       bbGetVtkObject()->ComputeScalarsOff();
                bbGetVtkObject()->Update();             
        }
        
@@ -62,6 +71,8 @@ namespace bbvtk
        {
                 BBTK_VTK_SET_DEFAULT_VALUES();
                bbSetInputValue(400);
+               bbSetInputComputeNormalsOn(true);
+               bbSetInputComputeScalarsOn(true);
        }
        
        //-----------------------------------------------------------------     
index 083e34b4245228244107c1a1919e8714f9266771..6198ee99860b78b363f20af51fc3af8d1e9b1e2c 100644 (file)
@@ -75,6 +75,8 @@ namespace bbvtk
 
     BBTK_DECLARE_VTK_INPUT(In,vtkImageData *);
        BBTK_DECLARE_INPUT(Value,double);
+       BBTK_DECLARE_INPUT(ComputeNormalsOn,bool);
+       BBTK_DECLARE_INPUT(ComputeScalarsOn,bool);
     BBTK_DECLARE_VTK_OUTPUT(Out,vtkPolyData *);
 
     // For the 'Value' parameter, the standard bbtk macro does not work 
@@ -112,6 +114,8 @@ namespace bbvtk
 
   BBTK_INPUT(MarchingCubes,In,"Image",vtkImageData*,"");
   BBTK_INPUT(MarchingCubes,Value,"Value of the iso-surface",double,"");
+  BBTK_INPUT(MarchingCubes,ComputeNormalsOn,"Set the computation of normals",bool,"");
+  BBTK_INPUT(MarchingCubes,ComputeScalarsOn,"Set the computation of scalars",bool,"");
   BBTK_OUTPUT(MarchingCubes,Out,"Output iso-surface",vtkPolyData*,"");
   
   BBTK_END_DESCRIBE_BLACK_BOX(MarchingCubes);
diff --git a/packages/vtk/src/bbvtkMeasureLength.cxx b/packages/vtk/src/bbvtkMeasureLength.cxx
new file mode 100644 (file)
index 0000000..1b2a645
--- /dev/null
@@ -0,0 +1,95 @@
+//===== 
+// 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 "bbvtkMeasureLength.h"
+#include "bbvtkPackage.h"
+namespace bbvtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,MeasureLength)
+BBTK_BLACK_BOX_IMPLEMENTATION(MeasureLength,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 MeasureLength::Process()
+{
+       //std::cout << "RaC MeasureLength::Process START"<< std::endl;
+
+       _points = bbGetInputPoints();
+       _image = bbGetInputImageData();
+
+       double sumLength =0;
+       if(_image != NULL && _points->GetNumberOfPoints()>1)
+       {
+
+               double spc[3];
+               double origin[3];
+
+               _image->GetSpacing(spc);
+               _image->GetOrigin(origin);
+
+               double* first;
+               first = _points->GetPoint(0);
+
+               double firstWorld[3];
+               firstWorld[0] = first[0]*spc[0] + origin[0];
+               firstWorld[1] = first[1]*spc[1] + origin[1];
+               firstWorld[2] = first[2]*spc[2] + origin[2];
+
+
+
+               for(int i = 1; i<_points->GetNumberOfPoints();i++)
+               {
+                       double* second;
+                       second = _points->GetPoint(i);
+                       double secondWorld[3];
+                       secondWorld[0] = second[0]*spc[0] + origin[0];
+                       secondWorld[1] = second[1]*spc[1] + origin[1];
+                       secondWorld[2] = second[2]*spc[2] + origin[2];
+
+                       double XFactor = secondWorld[0]-firstWorld[0];
+                       double YFactor = secondWorld[1]-firstWorld[1];
+                       double ZFactor = secondWorld[2]-firstWorld[2];
+                       sumLength += XFactor*XFactor + YFactor*YFactor + ZFactor*ZFactor;
+
+                       firstWorld[0] = secondWorld[0];
+                       firstWorld[1] = secondWorld[1];
+                       firstWorld[2] = secondWorld[2];
+
+               }
+       }
+
+       bbSetOutputLength(sumLength);
+
+       //std::cout << "RaC MeasureLength::Process END"<< 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 MeasureLength::bbUserSetDefaultValues()
+{
+       bbSetOutputLength(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 MeasureLength::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 MeasureLength::bbUserFinalizeProcessing()
+{
+
+
+  
+}
+}
+// EO namespace bbvtk
+
+
diff --git a/packages/vtk/src/bbvtkMeasureLength.h b/packages/vtk/src/bbvtkMeasureLength.h
new file mode 100644 (file)
index 0000000..d7110e9
--- /dev/null
@@ -0,0 +1,57 @@
+//===== 
+// 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 __bbvtkMeasureLength_h_INCLUDED__
+#define __bbvtkMeasureLength_h_INCLUDED__
+#include "bbvtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+
+#include "iostream"
+#include "vector"
+#include "math.h"
+
+//VTK
+#include "vtkPoints.h"
+#include "vtkImageData.h"
+
+namespace bbvtk
+{
+
+class bbvtk_EXPORT MeasureLength
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(MeasureLength,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(Points,vtkPoints*);
+  BBTK_DECLARE_INPUT(ImageData,vtkImageData*);
+  BBTK_DECLARE_OUTPUT(Length,double);
+  BBTK_PROCESS(Process);
+  void Process();
+private:
+  vtkImageData* _image;
+  vtkPoints* _points;
+//===== 
+// 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(MeasureLength,bbtk::AtomicBlackBox);
+BBTK_NAME("MeasureLength");
+BBTK_AUTHOR("Ricardo A Corredor");
+BBTK_DESCRIPTION("Evaluates the sum of the Euclidean distances among the points in the list following their order.");
+BBTK_CATEGORY("");
+BBTK_INPUT(MeasureLength,Points,"List of points",vtkPoints*,"");
+BBTK_INPUT(MeasureLength,ImageData,"Set an image if you want real lentgh (usually in mm)",vtkImageData*,"");
+BBTK_OUTPUT(MeasureLength,Length,"Sum of the Euclidean distances among the points",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(MeasureLength);
+//===== 
+// 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 // __bbvtkMeasureLength_h_INCLUDED__
+
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__
+
diff --git a/packages/vtk/src/bbvtkPointsXYZtoVTKPoints.cxx b/packages/vtk/src/bbvtkPointsXYZtoVTKPoints.cxx
new file mode 100644 (file)
index 0000000..0a825a2
--- /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 "bbvtkPointsXYZtoVTKPoints.h"
+#include "bbvtkPackage.h"
+namespace bbvtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,PointsXYZtoVTKPoints)
+BBTK_BLACK_BOX_IMPLEMENTATION(PointsXYZtoVTKPoints,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 PointsXYZtoVTKPoints::Process()
+{
+
+       //std::cout << "RaC PointsXYZtoVTKPoints::Process START"<< std::endl;
+       std::vector<int> lstPointsX = bbGetInputLstPointsX();
+       std::vector<int> lstPointsY = bbGetInputLstPointsY();
+       std::vector<int> lstPointsZ = bbGetInputLstPointsZ();
+
+       if(_points==NULL)
+               _points=vtkPoints::New();
+       else
+               _points->Reset();//CLEAR
+
+       for (int i =0; i < lstPointsX.size(); ++i)
+       {
+               double point[3];
+               point[0]=lstPointsX[i];
+               point[1]=lstPointsY[i];
+               point[2]=lstPointsZ[i];
+               _points->InsertPoint(i,point);
+       }
+       bbSetOutputPoints(_points);
+
+       //std::cout << "RaC PointsXYZtoVTKPoints::Process END"<< 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 PointsXYZtoVTKPoints::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 PointsXYZtoVTKPoints::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 PointsXYZtoVTKPoints::bbUserFinalizeProcessing()
+{
+
+       _points->Delete();
+  
+}
+}
+// EO namespace bbvtk
+
+
diff --git a/packages/vtk/src/bbvtkPointsXYZtoVTKPoints.h b/packages/vtk/src/bbvtkPointsXYZtoVTKPoints.h
new file mode 100644 (file)
index 0000000..2a513ff
--- /dev/null
@@ -0,0 +1,57 @@
+//===== 
+// 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 __bbvtkPointsXYZtoVTKPoints_h_INCLUDED__
+#define __bbvtkPointsXYZtoVTKPoints_h_INCLUDED__
+#include "bbvtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+
+#include "iostream"
+#include "vector"
+
+//VTK
+#include "vtkPoints.h"
+
+namespace bbvtk
+{
+
+class bbvtk_EXPORT PointsXYZtoVTKPoints
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(PointsXYZtoVTKPoints,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( LstPointsX, std::vector<int> );
+  BBTK_DECLARE_INPUT( LstPointsY, std::vector<int> );
+  BBTK_DECLARE_INPUT( LstPointsZ, std::vector<int> );
+  BBTK_DECLARE_OUTPUT(Points,vtkPoints*);
+  BBTK_PROCESS(Process);
+  void Process();
+
+private:
+  vtkPoints* _points;
+//===== 
+// 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(PointsXYZtoVTKPoints,bbtk::AtomicBlackBox);
+BBTK_NAME("PointsXYZtoVTKPoints");
+BBTK_AUTHOR("Ricardo A Corredor");
+BBTK_DESCRIPTION("Transforms independent vectors of X, Y and Z coordinates into a vtkPoints object");
+BBTK_CATEGORY("");
+BBTK_INPUT(PointsXYZtoVTKPoints,LstPointsX,"List of points X-coordinate", std::vector<int> ,"");
+BBTK_INPUT(PointsXYZtoVTKPoints,LstPointsY,"List of points Y-coordinate", std::vector<int> ,"");
+BBTK_INPUT(PointsXYZtoVTKPoints,LstPointsZ,"List of points Z-coordinate", std::vector<int> ,"");
+BBTK_OUTPUT(PointsXYZtoVTKPoints,Points,"Points in vtkPoints",vtkPoints*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(PointsXYZtoVTKPoints);
+//===== 
+// 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 // __bbvtkPointsXYZtoVTKPoints_h_INCLUDED__
+
index 7577a0a7ed47a6d1c5e980a03102507a2b5c235d..50889bd9dc746a47fba9e79a37a34de6f5f8c0c8 100644 (file)
@@ -41,7 +41,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(SphereList,bbtk::AtomicBlackBox);
 void SphereList::Process()
 {
 
-    int iMin, iMax;
+        int iMin, iMax;
        double px = 0.0;
        double py = 0.0;
        double pz = 0.0;
@@ -50,23 +50,40 @@ void SphereList::Process()
  
        int last_valid_color_index = 0;
 
+
        if (bbGetInputRenderer()!=NULL)
        {
-               if (bbGetInputSpacing().size()==3)
-               {
+                // If it is not the first time Process is executed, the actors have already been created. The only thing to do is to update the opacity. 
+               if (sphereActor.size() != 0)
+                {
+                  for (int i = 0; i < sphereActor.size(); i++)
+                    sphereActor[i] -> GetProperty() -> SetOpacity( bbGetInputOpacity() );
+               }
+                else
+                {
+                    if (bbGetInputSpacing().size()==3)
+                    {
                        spc[0]=bbGetInputSpacing()[0];
                        spc[1]=bbGetInputSpacing()[1];
                        spc[2]=bbGetInputSpacing()[2];
-               } else {
+                    }
+                    else
+                    {
                        spc[0]=spc[1]=spc[2]=1;
-               }
-
-               iMin=0;
-               iMax=bbGetInputlstPointX().size();
-               printf("EED SphereList::Process   iMax=%d \n", iMax);
-               // If the vector Y or respectively the vector Z has a different size from the vector X, the position value py or respectively pz is set to 0.
-               for ( int i=iMin ; i<iMax ; i=i+1 )
-               {
+                    }
+
+                    iMin=0;
+                    iMax=bbGetInputlstPointX().size();
+                    printf("EED SphereList::Process   iMax=%d \n", iMax);
+                    for (int i = 0; i < iMax; i++)
+                      {
+                        std::cout << "CM SphereList::Process i=" <<  i  << " bbGetInputlstPointX()[i]=" << bbGetInputlstPointX()[i] << std::endl;
+                        std::cout << "CM SphereList::Process i=" <<  i  << " bbGetInputlstPointY()[i]=" << bbGetInputlstPointY()[i] << std::endl;
+                        std::cout << "CM SphereList::Process i=" <<  i  << " bbGetInputlstPointZ()[i]=" << bbGetInputlstPointZ()[i] << std::endl;
+                      }
+                    // If the vector Y or respectively the vector Z has a different size from the vector X, the position value py or respectively pz is set to 0.
+                    for ( int i=iMin ; i<iMax; i=i+1 )
+                    {
                        px = bbGetInputlstPointX()[i]*spc[0];
                        if (bbGetInputlstPointY().size() == bbGetInputlstPointX().size() )
                        {
@@ -79,28 +96,29 @@ void SphereList::Process()
 
                        // If the number of elements in the radio list is different from the number of X coordinates, the radio value is set to 1.
                        if (bbGetInputlstRadio().size() == bbGetInputlstPointX().size() )
-                         {
+                       {
                            radio = bbGetInputlstRadio()[i];
-                         }
+                        }
                        else
-                         {
-                           if  (bbGetInputlstRadio().size()>=1){
-                              radio = bbGetInputlstRadio()[ bbGetInputlstRadio().size() - 1 ];
-                               } else {
-                                       radio = 1.0;
-                               }
-                         }
+                       {
+                            if (bbGetInputlstRadio().size()>=1)
+                            {
+                                radio = bbGetInputlstRadio()[ bbGetInputlstRadio().size() - 1 ];
+                            } 
+                            else 
+                            {
+                                radio = 1.0;
+                            }
+                       }
 
                        // Sphere
                        vtkSphereSource * newSphere =  vtkSphereSource::New();
-                       vtkSphere.push_back(newSphere);
 
                        newSphere -> SetThetaResolution(20);
                        newSphere -> SetPhiResolution(20);
                        newSphere -> SetRadius(radio); 
 
                        vtkPolyDataMapper * newMapper = vtkPolyDataMapper::New();
-                       sphereMapper.push_back(newMapper);
                        newMapper -> SetInput( newSphere -> GetOutput() );
        
                        vtkActor * newActor = vtkActor::New();
@@ -110,10 +128,10 @@ void SphereList::Process()
                        
                        unsigned int j = 3*i +2;
                        if (j < bbGetInputColour().size() )
-                         {
+                       {
                            newActor -> GetProperty() -> SetColor( bbGetInputColour()[3*i] , bbGetInputColour()[3*i + 1] , bbGetInputColour()[3*i + 2] );
                            last_valid_color_index = 3*i;
-                         }
+                       }
                        else
                          newActor -> GetProperty() -> SetColor( bbGetInputColour()[last_valid_color_index] , bbGetInputColour()[last_valid_color_index + 1] , bbGetInputColour()[last_valid_color_index + 2] );
 
@@ -127,21 +145,21 @@ void SphereList::Process()
        
 
                        if (bbGetInputRenderer()!=NULL)
-                         {
+                       {
                            bbGetInputRenderer() -> AddActor( newActor );
-                         }
-
-               } // for
-
-               if (sphereActor.size() != 0)
-                 {
-                   // Sets the output.
-                   bbSetOutputActorList(sphereActor);
-                 }
+                       }
 
-       } // if (bbGetInputRenderer()!=NULL)
+                    } // for
 
+                    if (sphereActor.size() != 0)
+                    {
+                        // Sets the output.
+                        bbSetOutputActorList(sphereActor);
+                    }
+                    
+                } // if (bbGetInputRenderer()!=NULL)
 
+        } // if (sphereActor.size() != 0)
 }
 
 void SphereList::bbUserSetDefaultValues()
index edb397103263c3fc6dff5b035602cd25e12e9b9d..ac45d5ed087e0ff95a789996cebe5ab60bca89e1 100644 (file)
@@ -62,8 +62,6 @@ class bbvtk_EXPORT SphereList
   void Process();
 
   std::vector<vtkActor *> sphereActor;
-  std::vector<vtkPolyDataMapper *> sphereMapper;
-  std::vector<vtkSphereSource *> vtkSphere;
 
 };
 
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 *,"");