From: Daniel Gonzalez Date: Fri, 26 Apr 2013 09:52:05 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/master' X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9a0cff4a61edd2b20bc0d7d00f4509193b8c50b6;hp=cfbdafc090592999f8d02e0c1412b0e15ac259d9;p=bbtk.git Merge remote-tracking branch 'origin/master' --- diff --git a/kernel/cmake/BBTKConfigurePackage.cmake b/kernel/cmake/BBTKConfigurePackage.cmake index 83cc430..27fea04 100644 --- a/kernel/cmake/BBTKConfigurePackage.cmake +++ b/kernel/cmake/BBTKConfigurePackage.cmake @@ -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)") diff --git a/packages/gdcmvtk/CMakeLists.txt b/packages/gdcmvtk/CMakeLists.txt index d28951b..a087826 100644 --- a/packages/gdcmvtk/CMakeLists.txt +++ b/packages/gdcmvtk/CMakeLists.txt @@ -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) + #=========================================================================== diff --git a/packages/gdcmvtk/PackageConfig.cmake.in b/packages/gdcmvtk/PackageConfig.cmake.in index f41eef5..f682910 100644 --- a/packages/gdcmvtk/PackageConfig.cmake.in +++ b/packages/gdcmvtk/PackageConfig.cmake.in @@ -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 diff --git a/packages/gdcmvtk/src/CMakeLists.txt b/packages/gdcmvtk/src/CMakeLists.txt index 651c9f9..b18ebf6 100644 --- a/packages/gdcmvtk/src/CMakeLists.txt +++ b/packages/gdcmvtk/src/CMakeLists.txt @@ -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) #--------------------------------------------------------------------------- diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx b/packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx index f951246..50dea74 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx +++ b/packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx @@ -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; diff --git a/packages/itk/src/bbitkImageProperties.cxx b/packages/itk/src/bbitkImageProperties.cxx index 458531f..7e5f47d 100644 --- a/packages/itk/src/bbitkImageProperties.cxx +++ b/packages/itk/src/bbitkImageProperties.cxx @@ -104,11 +104,22 @@ namespace bbitk if (dim==2) vsz.push_back(1); bbSetOutputSize(vsz); + + const typename itkImageType::PointType& orgn = im->GetOrigin(); + std::vector vog; + for (unsigned int i=0;iGetSpacing(); - std::vector vsp; + std::vector vsp; for (unsigned int i=0;i); BBTK_DECLARE_OUTPUT(Size,std::vector); - BBTK_DECLARE_OUTPUT(Spacing,std::vector); + BBTK_DECLARE_OUTPUT(Origin,std::vector); + BBTK_DECLARE_OUTPUT(Spacing,std::vector); + BBTK_DECLARE_OUTPUT(MinMax,std::vector); 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,"image index"); + BBTK_OUTPUT(ImageProperties,Index,"Index of the image",std::vector,"image index"); BBTK_OUTPUT(ImageProperties,Size,"Size in each dimension",std::vector,"image size"); - BBTK_OUTPUT(ImageProperties,Spacing,"Size of the voxels",std::vector,"voxel size"); + BBTK_OUTPUT(ImageProperties,Origin,"Origin of the image",std::vector,"image origin"); + BBTK_OUTPUT(ImageProperties,Spacing,"Size of the voxels",std::vector,"voxel size"); BBTK_OUTPUT(ImageProperties,MinMax,"Minimum and the maximum intensity values of an image",std::vector,""); BBTK_END_DESCRIBE_BLACK_BOX(ImageProperties); //================================================================= diff --git a/packages/itk/src/bbitkImageStatistics.cxx b/packages/itk/src/bbitkImageStatistics.cxx new file mode 100644 index 0000000..3ed5384 --- /dev/null +++ b/packages/itk/src/bbitkImageStatistics.cxx @@ -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 index 0000000..9fa0049 --- /dev/null +++ b/packages/itk/src/bbitkImageStatistics.h @@ -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 + + +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 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*",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 +void ImageStatistics::ProcessTemplated() +{ + bbtkDebugMessageInc("Core",9,"bbitk::ImageStatistics::Process<"<()<<">()"< StatisticsImageFilterType; + typename StatisticsImageFilterType::Pointer statisticsImageFilter = StatisticsImageFilterType::New (); + + // Input + ImageType* in = this->bbGetInputIn().get(); + + 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 index 0000000..6c41981 --- /dev/null +++ b/packages/std/src/bbstdDoubleToInt.cxx @@ -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 index 0000000..83df9df --- /dev/null +++ b/packages/std/src/bbstdDoubleToInt.h @@ -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/std/src/bbstdReadColumnsDouble.cxx b/packages/std/src/bbstdReadColumnsDouble.cxx index 95a8576..c74a39f 100644 --- a/packages/std/src/bbstdReadColumnsDouble.cxx +++ b/packages/std/src/bbstdReadColumnsDouble.cxx @@ -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 ; ipush_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 index 0000000..f1ac03b --- /dev/null +++ b/packages/vtk/bbs/appli/exampleMeasureLength.bbg @@ -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 index 0000000..4ffc5a7 --- /dev/null +++ b/packages/vtk/bbs/appli/exampleMeasureLength.bbs @@ -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 index 0000000..1bb0f12 --- /dev/null +++ b/packages/vtk/bbs/appli/examplePlaneClipPolyData.bbg @@ -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: +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 index 0000000..a5bba25 --- /dev/null +++ b/packages/vtk/bbs/appli/examplePlaneClipPolyData.bbs @@ -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 "" + +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/bbvtkBinaryOperations.h b/packages/vtk/src/bbvtkBinaryOperations.h index b9d8683..9e6bd03 100644 --- a/packages/vtk/src/bbvtkBinaryOperations.h +++ b/packages/vtk/src/bbvtkBinaryOperations.h @@ -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"); diff --git a/packages/vtk/src/bbvtkMarchingCubes.cxx b/packages/vtk/src/bbvtkMarchingCubes.cxx index ebadda0..972c72f 100644 --- a/packages/vtk/src/bbvtkMarchingCubes.cxx +++ b/packages/vtk/src/bbvtkMarchingCubes.cxx @@ -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); } //----------------------------------------------------------------- diff --git a/packages/vtk/src/bbvtkMarchingCubes.h b/packages/vtk/src/bbvtkMarchingCubes.h index 083e34b..6198ee9 100644 --- a/packages/vtk/src/bbvtkMarchingCubes.h +++ b/packages/vtk/src/bbvtkMarchingCubes.h @@ -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 index 0000000..1b2a645 --- /dev/null +++ b/packages/vtk/src/bbvtkMeasureLength.cxx @@ -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 index 0000000..d7110e9 --- /dev/null +++ b/packages/vtk/src/bbvtkMeasureLength.h @@ -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 index 0000000..e3432ee --- /dev/null +++ b/packages/vtk/src/bbvtkPlaneClipPolyData.cxx @@ -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 origin = bbGetInputPlaneOrigin(); + std::vector 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 "< +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +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); + BBTK_DECLARE_INPUT(PlaneNormal,std::vector); + 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,""); +BBTK_INPUT(PlaneClipPolyData,PlaneNormal,"Cutting plane normal",std::vector,""); +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 index 0000000..0a825a2 --- /dev/null +++ b/packages/vtk/src/bbvtkPointsXYZtoVTKPoints.cxx @@ -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 lstPointsX = bbGetInputLstPointsX(); + std::vector lstPointsY = bbGetInputLstPointsY(); + std::vector 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 index 0000000..2a513ff --- /dev/null +++ b/packages/vtk/src/bbvtkPointsXYZtoVTKPoints.h @@ -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 ); + BBTK_DECLARE_INPUT( LstPointsY, std::vector ); + BBTK_DECLARE_INPUT( LstPointsZ, std::vector ); + 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 ,""); +BBTK_INPUT(PointsXYZtoVTKPoints,LstPointsY,"List of points Y-coordinate", std::vector ,""); +BBTK_INPUT(PointsXYZtoVTKPoints,LstPointsZ,"List of points Z-coordinate", std::vector ,""); +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__ + diff --git a/packages/vtk/src/bbvtkSphereList.cxx b/packages/vtk/src/bbvtkSphereList.cxx index 7577a0a..50889bd 100644 --- a/packages/vtk/src/bbvtkSphereList.cxx +++ b/packages/vtk/src/bbvtkSphereList.cxx @@ -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,""); BBTK_INPUT(Viewer3D,In1,"Input actor",vtkProp3D *,""); BBTK_INPUT(Viewer3D,In2,"Input actor",vtkProp3D *,""); BBTK_INPUT(Viewer3D,In3,"Input actor",vtkProp3D *,"");