]> Creatis software - bbtk.git/commitdiff
Merge branch 'master' of ssh://gitolite@git.creatis.insa-lyon.fr/bbtk
authorRicardo A Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Thu, 28 Mar 2013 20:04:45 +0000 (21:04 +0100)
committerRicardo A Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Thu, 28 Mar 2013 20:04:45 +0000 (21:04 +0100)
kernel/cmake/BBTKConfigurePackage.cmake
packages/gdcmvtk/CMakeLists.txt
packages/gdcmvtk/PackageConfig.cmake.in
packages/gdcmvtk/src/CMakeLists.txt
packages/gdcmvtk/src/bbgdcmvtkGetInfoGdcmReader.cxx
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/src/bbvtkSphereList.cxx
packages/vtk/src/bbvtkSphereList.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;
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++;                        
                }       
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;
 
 };