]> Creatis software - bbtk.git/commitdiff
#3212 BBTK Feature New Normal - vtk8itk4wx3-mingw64
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Tue, 7 Aug 2018 13:28:32 +0000 (15:28 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Tue, 7 Aug 2018 13:28:32 +0000 (15:28 +0200)
31 files changed:
packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx
packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h
packages/std/bbs/appli/exampleSetElementVector.bbg [new file with mode: 0644]
packages/std/bbs/appli/exampleSetElementVector.bbs [new file with mode: 0644]
packages/std/src/bbstdGetVectorPointer.cxx [new file with mode: 0644]
packages/std/src/bbstdGetVectorPointer.h [new file with mode: 0644]
packages/std/src/bbstdMixingVectors.cxx
packages/std/src/bbstdSetElementVector.cxx [new file with mode: 0644]
packages/std/src/bbstdSetElementVector.h [new file with mode: 0644]
packages/std/src/bbstdSharedMemory.cxx
packages/std/src/bbstdSharedMemory.h
packages/std/src/bbstdStringToVector.h
packages/std/src/bbstdStringVectorToNumericalVector.h
packages/vtk/src/bbvtkCreateImage.cxx
packages/vtk/src/bbvtkImageBoundaries.cxx
packages/vtk/src/bbvtkImagePlanes.cxx
packages/vtk/src/bbvtkImagePlanes.h
packages/vtk/src/bbvtkImageVtkProperties.cxx
packages/vtk/src/bbvtkImageVtkProperties.h
packages/vtk/src/bbvtkInversCrop.cxx
packages/vtk/src/bbvtkInversCrop.h
packages/vtk/src/bbvtkPolyDataToActor.cxx
packages/vtk/src/bbvtkSliceImage.cxx
packages/vtk/src/bbvtkSliceImage.h
packages/vtk/src/bbvtkSurfaceTexture.cxx
packages/wx/src/bbwxComboBox.cxx
packages/wx/src/bbwxComboBox.h
packages/wx/src/bbwxCommandButton.cxx
packages/wx/src/bbwxHtmlWindow.cxx [new file with mode: 0644]
packages/wx/src/bbwxHtmlWindow.h [new file with mode: 0644]
packages/wx/src/bbwxRadioButton.cxx

index c1d16ba58fb15afc84ccce9badb0f3705362fa51..39ff153e69dc68fc743921f10c94b4f4f0f2ba66 100644 (file)
@@ -146,9 +146,7 @@ void GetXCoherentInfoGdcmReader::Process()
    // Should only contain one!
    l = sh->GetFirstSingleSerieUIDFileSet();
 
-   int nbFiles;
-   double zspacing     = 0.;
-   nbFiles                     = l->size() ;
+   double zspacing = 0.;
    sh->OrderFileList(l); // this one should compute the *actual* Z Spacing!
    zspacing            = sh->GetZSpacing();
    std::vector<double> v_pixelspacing;
@@ -159,6 +157,35 @@ void GetXCoherentInfoGdcmReader::Process()
 //      v_pixelspacing.push_back(f->GetZSpacing());
 //   }
    bbSetOutputPixelSpacing(v_pixelspacing);
+
+       VectorMapInfoDicom vectormapinfodicom;
+       uint16_t group;
+       uint16_t elem;
+       std::string key;
+       std::string strTagValue;  // read on disc
+       int iTag,sizeDicomTagsVector=bbGetInputDicomTags().size();
+       GDCM_NAME_SPACE::FileList::const_iterator iitt = l->begin();
+       //iitt ++;
+       for ( ; iitt != l->end(); ++iitt)
+       {
+               MapInfoDicom mapinfodicom;
+
+               for (iTag=0; iTag<sizeDicomTagsVector; iTag++)
+               {
+                       key = bbGetInputDicomTags()[iTag];
+                       group = elem = 0;
+                       if ( (key.size()==10) && (key[0] == 'D') && (key[5] == '_') )
+                       {
+                               sscanf(key.c_str(),"D%04hx_%04hx ",&group,&elem);  
+                       }// if key
+                       strTagValue = (*iitt)->GetEntryString(group,elem);
+                       mapinfodicom.insert ( std::pair<std::string,std::string>(key,strTagValue) );
+               } // for iTag
+
+               vectormapinfodicom.push_back( mapinfodicom );
+   } // for iitt
+   bbSetOutputDicomInfo( vectormapinfodicom );
+
    if (reader!=NULL)
    { 
       reader->Delete();
@@ -172,7 +199,6 @@ void GetXCoherentInfoGdcmReader::Process()
    reader->Update();
    reader->GetOutput();
 
-printf("EED GetXCoherentInfoGdcmReader::Process \n");
    bbSetOutputOut( reader->GetOutput() );
 }
 #endif
index a37304beca30d6ecb9562e799de41b3667abbd05..f0b3c2134f78e455b5feaa81c6b2dfc5d73a2547 100644 (file)
 #include "vtkImageData.h"
 namespace bbgdcmvtk
 {
+       typedef std::map<std::string, std::string>      MapInfoDicom;
+       typedef std::vector< MapInfoDicom >             VectorMapInfoDicom;
 
 class bbgdcmvtk_EXPORT GetXCoherentInfoGdcmReader
  : 
    public bbtk::AtomicBlackBox
 {
+
   BBTK_BLACK_BOX_INTERFACE(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
 
-  BBTK_DECLARE_INPUT(In,            std::vector<std::string>);
-  BBTK_DECLARE_INPUT(IPPSort,       bool);
+  BBTK_DECLARE_INPUT(In                                , std::vector<std::string>);
+  BBTK_DECLARE_INPUT(IPPSort           , bool);
+  BBTK_DECLARE_INPUT(DicomTags         , std::vector<std::string>);
   
-  BBTK_DECLARE_OUTPUT(Out,          vtkImageData *);
-  BBTK_DECLARE_OUTPUT(IPP,          std::vector<double>);
-  BBTK_DECLARE_OUTPUT(IOP,          std::vector<double>);
-  BBTK_DECLARE_OUTPUT(PixelSpacing, std::vector<double>);
+  BBTK_DECLARE_OUTPUT(Out                      , vtkImageData *);
+  BBTK_DECLARE_OUTPUT(IPP                      , std::vector<double>);
+  BBTK_DECLARE_OUTPUT(IOP                      , std::vector<double>);
+  BBTK_DECLARE_OUTPUT(PixelSpacing     , std::vector<double>);
+  BBTK_DECLARE_OUTPUT(DicomInfo                , VectorMapInfoDicom);
        
   BBTK_PROCESS(Process);
   void Process();
@@ -83,18 +88,20 @@ class bbgdcmvtk_EXPORT GetXCoherentInfoGdcmReader
   //=================================================================
   // UserBlackBox description
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
-BBTK_NAME("GetXCoherentInfoGdcmReader");
-BBTK_AUTHOR("jpr, eduardo");
-BBTK_DESCRIPTION("Get Dicom info from a File Set (a list of Dicom image file names) and read (as a vtkImageData)");
-BBTK_CATEGORY("");
-
-BBTK_INPUT(GetXCoherentInfoGdcmReader,In,     "List of Dicom image file names", std::vector<std::string>,"");
-BBTK_INPUT(GetXCoherentInfoGdcmReader,IPPSort,"Sort on Image Position Patient",bool,"");
-
-BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out,         "Output image",                vtkImageData *,"");
-BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP,         "Image Position (Patient)",    std::vector<double>,"");
-BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IOP,         "Image Orientation (Patient)", std::vector<double>,"");
-BBTK_OUTPUT(GetXCoherentInfoGdcmReader,PixelSpacing,"Pixel Spacing",               std::vector<double>,"");
+  BBTK_NAME("GetXCoherentInfoGdcmReader");
+  BBTK_AUTHOR("jpr, eduardo");
+  BBTK_DESCRIPTION("Get Dicom info from a File Set (a list of Dicom image file names) and read (as a vtkImageData)");
+  BBTK_CATEGORY("");
+
+  BBTK_INPUT(GetXCoherentInfoGdcmReader,In                             ,"List of Dicom image file names", std::vector<std::string>,"");
+  BBTK_INPUT(GetXCoherentInfoGdcmReader,IPPSort                        ,"Sort on Image Position Patient", bool,"");
+  BBTK_INPUT(GetXCoherentInfoGdcmReader,DicomTags              ,"Dicom Tags (vector of Dicom tags ex: D0028_0030  D0020_0037)", std::vector<std::string>,"");
+
+  BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out                   ,"Output image"                                 , vtkImageData *,"");
+  BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP                   ,"Image Position (Patient)"             , std::vector<double>,"");
+  BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IOP                   ,"Image Orientation (Patient)"  , std::vector<double>,"");
+  BBTK_OUTPUT(GetXCoherentInfoGdcmReader,PixelSpacing  ,"Pixel Spacing"                                , std::vector<double>,"");
+  BBTK_OUTPUT(GetXCoherentInfoGdcmReader,DicomInfo             ,"vector of maps of Dicom tags" , VectorMapInfoDicom,"");
 BBTK_END_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader);
 } // EO namespace bbgdcmvtk
 
diff --git a/packages/std/bbs/appli/exampleSetElementVector.bbg b/packages/std/bbs/appli/exampleSetElementVector.bbg
new file mode 100644 (file)
index 0000000..783093b
--- /dev/null
@@ -0,0 +1,73 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /tmpEED/creaTools/creatools_source/bbtk/packages/std/bbs/appli/exampleSetElementVector.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:5
+BOX
+std:GetVectorStringPointer:Box01
+ISEXEC:FALSE
+6.522014:14.475352:-900.000000
+77.697014:4.475352:-900.000000
+PORT
+In:"A B C D E"
+FIN_BOX
+BOX
+std:SetElementVectorVectorString:Box02
+ISEXEC:FALSE
+-11.680621:-19.993209:-900.000000
+59.494379:-29.993209:-900.000000
+PORT
+I:"2"
+PORT
+Value:"2"
+FIN_BOX
+BOX
+wx:OutputText:Box03
+ISEXEC:FALSE
+-54.917469:-70.666633:-900.000000
+-9.342469:-80.666633:-900.000000
+FIN_BOX
+BOX
+wx:LayoutSplit:Box04
+ISEXEC:TRUE
+-73.506336:-93.307343:-900.000000
+-27.931336:-103.307343:-900.000000
+FIN_BOX
+BOX
+wx:Slider:Box05
+ISEXEC:FALSE
+-59.907189:56.689901:-900.000000
+-8.507189:46.689901:-900.000000
+PORT
+ReactiveOnTrack:"true"
+FIN_BOX
+CONNECTIONS:7
+CONNECTION
+Box05:Widget:Box04:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box05:BoxChange:Box03:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box05:BoxChange:Box02:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box02:Value
+NumberOfControlPoints:0
+CONNECTION
+Box03:Widget:Box04:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box01:PVec:Box02:PVec
+NumberOfControlPoints:0
+CONNECTION
+Box02:Vec:Box03:In
+NumberOfControlPoints:0
+APP_END
diff --git a/packages/std/bbs/appli/exampleSetElementVector.bbs b/packages/std/bbs/appli/exampleSetElementVector.bbs
new file mode 100644 (file)
index 0000000..615607e
--- /dev/null
@@ -0,0 +1,50 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /tmpEED/creaTools/creatools_source/bbtk/packages/std/bbs/appli/exampleSetElementVector.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include std
+include wx
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new std:GetVectorStringPointer Box01
+  set Box01.In "A B C D E"
+
+new std:SetElementVectorVectorString Box02
+  set Box02.I "2"
+  set Box02.Value "2"
+
+new wx:OutputText Box03
+
+new wx:LayoutSplit Box04
+
+new wx:Slider Box05
+  set Box05.ReactiveOnTrack "true"
+
+
+connect Box05.Widget Box04.Widget1
+
+connect Box05.BoxChange Box03.BoxExecute
+
+connect Box05.BoxChange Box02.BoxExecute
+
+connect Box05.Out Box02.Value
+
+connect Box03.Widget Box04.Widget2
+
+connect Box01.PVec Box02.PVec
+
+connect Box02.Vec Box03.In
+
+
+
+# Complex input ports
+exec Box04
diff --git a/packages/std/src/bbstdGetVectorPointer.cxx b/packages/std/src/bbstdGetVectorPointer.cxx
new file mode 100644 (file)
index 0000000..a4f4abd
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # 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: bbstdGetVectorElement.cxx,v $
+  Language:  C++
+  Date:      $Date: 2012/11/16 08:51:32 $
+  Version:   $Revision: 1.4 $
+=========================================================================*/
+
+
+#include "bbstdGetVectorPointer.h"
+#include "bbstdPackage.h"
+
+
+namespace bbstd
+{
+  //====================================================================
+  BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(GetVectorPointer,
+                                        bbtk::AtomicBlackBox);
+  //====================================================================
+
+//====================================================================
+// Add the specialized boxes to the package
+
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,int8_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,uint8_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,int16_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,uint16_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,int32_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,uint32_t);
+///\todo : diff between uint32_t and long?
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,long);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,float);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,double);
+typedef std::string string;
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,string);
+//====================================================================
+
+} // namespace bbstd
diff --git a/packages/std/src/bbstdGetVectorPointer.h b/packages/std/src/bbstdGetVectorPointer.h
new file mode 100644 (file)
index 0000000..931dc66
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # 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: bbstdGetVectorElement.h,v $
+  Language:  C++
+  Date:      $Date: 2012/11/16 08:51:32 $
+  Version:   $Revision: 1.9 $
+=========================================================================*/
+
+
+#ifndef __bbstdGetVectorPointer_INCLUDED_h__
+#define __bbstdGetVectorPointer_INCLUDED_h__
+
+#include "bbtkAtomicBlackBox.h"
+#include "bbstd_EXPORT.h"
+
+namespace bbstd
+{
+  //=================================================================
+  // BlackBox declaration
+  template <class T>
+  class bbstd_EXPORT GetVectorPointer : public bbtk::AtomicBlackBox
+  {
+    BBTK_TEMPLATE_BLACK_BOX_INTERFACE(GetVectorPointer,bbtk::AtomicBlackBox,T);
+    BBTK_DECLARE_INPUT(In,std::vector<T>);
+    BBTK_DECLARE_OUTPUT(PVec,std::vector<T>*);
+    BBTK_PROCESS(DoIt);
+    void DoIt();
+       std::vector<T> vec;
+  };
+  //=================================================================
+
+  //=================================================================
+  // BlackBox description
+  BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorPointer,bbtk::AtomicBlackBox);
+  BBTK_NAME("Get"+bbtk::HumanTypeName<std::vector<T> >()+"Pointer");
+  BBTK_AUTHOR("info-dev@creatis.insa-lyon.fr");
+ // BBTK_DEFAULT_ADAPTOR();
+  BBTK_DESCRIPTION("Gets the the pointer of the input vector ("+bbtk::TypeName<std::vector<T> >());
+  typedef std::vector<T> Tvector;
+  BBTK_TEMPLATE_INPUT(GetVectorPointer, In,"Input",Tvector);
+//  BBTK_TEMPLATE_INPUT(GetVectorPointer, I, "Input",int);  
+//  BBTK_TEMPLATE_INPUT(GetVectorPointer, ErrorValue, "ErrorValue",T);
+//  BBTK_TEMPLATE_OUTPUT(GetVectorPointer,Out,"Output",T);
+  BBTK_TEMPLATE_OUTPUT(GetVectorPointer,PVec,"Output Pointer Vector",std::vector<T>*);
+  BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorPointer);
+  //=================================================================
+
+  //=================================================================
+  template <class T>
+  void GetVectorPointer<T>::DoIt()
+  {
+         vec = bbGetInputIn();
+         bbSetOutputPVec( &vec );
+  }
+  //=================================================================
+
+  //=================================================================  
+  template <class T>
+  void GetVectorPointer<T>::bbUserSetDefaultValues()
+  {
+
+  }
+  //=================================================================
+  //=================================================================  
+  template <class T>
+  void GetVectorPointer<T>::bbUserInitializeProcessing()
+  {
+
+  }
+  //=================================================================
+  //=================================================================  
+  template <class T>
+  void GetVectorPointer<T>::bbUserFinalizeProcessing()
+  {
+
+  }
+  //=================================================================
+
+} // namespace bbstd
+
+#endif //__bbstdGetVectorPointer_INCLUDED_h__
+
index f0427247cd23c3840c78f05d839ea514d863f73a..6386db5cca484c3e344299fddc5a8be5a616bacc 100644 (file)
@@ -36,41 +36,30 @@ BBTK_BLACK_BOX_IMPLEMENTATION(MixingVectors,bbtk::AtomicBlackBox);
 void MixingVectors::Process()
 {
 // THE MAIN PROCESSING METHOD BODY
-   int size1 = bbGetInputIn1().size();
-   int size2 = bbGetInputIn2().size();
-   int size3 = bbGetInputIn3().size();
-   int size4 = bbGetInputIn4().size();
-   int size5 = bbGetInputIn5().size();
-   int size6 = bbGetInputIn6().size();
-   int size7 = bbGetInputIn7().size();
-   int size8 = bbGetInputIn8().size();
-   int size9 = bbGetInputIn9().size();
-   int size10 = bbGetInputIn10().size();
-   std::vector<double> outputVector;
-
-   for (int i = 0; i < size1; i++)
-     {
+       int size1 = bbGetInputIn1().size();
+       int size2 = bbGetInputIn2().size();
+       int size3 = bbGetInputIn3().size();
+       int size4 = bbGetInputIn4().size();
+       int size5 = bbGetInputIn5().size();
+       int size6 = bbGetInputIn6().size();
+       int size7 = bbGetInputIn7().size();
+       int size8 = bbGetInputIn8().size();
+       int size9 = bbGetInputIn9().size();
+       int size10 = bbGetInputIn10().size();
+       std::vector<double> outputVector;
+       for (int i = 0; i < size1; i++)
+       {
        outputVector.push_back( bbGetInputIn1()[i] );
-       if (i < size2)
-         outputVector.push_back( bbGetInputIn2()[i] );
-        if (i < size3)
-         outputVector.push_back( bbGetInputIn3()[i] );
-        if (i < size4)
-         outputVector.push_back( bbGetInputIn4()[i] );
-        if (i < size5)
-         outputVector.push_back( bbGetInputIn5()[i] );
-        if (i < size6)
-         outputVector.push_back( bbGetInputIn6()[i] );
-        if (i < size7)
-         outputVector.push_back( bbGetInputIn7()[i] );
-        if (i < size8)
-         outputVector.push_back( bbGetInputIn8()[i] );
-        if (i < size9)
-         outputVector.push_back( bbGetInputIn9()[i] );
-        if (i < size10)
-         outputVector.push_back( bbGetInputIn10()[i] );
+       if (i < size2)  { outputVector.push_back( bbGetInputIn2()[i] );  }
+       if (i < size3)  { outputVector.push_back( bbGetInputIn3()[i] );  }
+       if (i < size4)  { outputVector.push_back( bbGetInputIn4()[i] );  }
+       if (i < size5)  { outputVector.push_back( bbGetInputIn5()[i] );  }
+       if (i < size6)  { outputVector.push_back( bbGetInputIn6()[i] );  }
+       if (i < size7)  { outputVector.push_back( bbGetInputIn7()[i] );  }
+       if (i < size8)  { outputVector.push_back( bbGetInputIn8()[i] );  }
+       if (i < size9)  { outputVector.push_back( bbGetInputIn9()[i] );  }
+       if (i < size10) { outputVector.push_back( bbGetInputIn10()[i] ); }
      }
-
    bbSetOutputOut(outputVector);  
 }
 
@@ -88,5 +77,5 @@ void MixingVectors::bbUserFinalizeProcessing()
 {
   
 }
-}
-// EO namespace bbstd
+
+// EO namespace bbstd
diff --git a/packages/std/src/bbstdSetElementVector.cxx b/packages/std/src/bbstdSetElementVector.cxx
new file mode 100644 (file)
index 0000000..cbd79b4
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # 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: bbstdGetVectorElement.cxx,v $
+  Language:  C++
+  Date:      $Date: 2012/11/16 08:51:32 $
+  Version:   $Revision: 1.4 $
+=========================================================================*/
+
+
+#include "bbstdSetElementVector.h"
+#include "bbstdPackage.h"
+
+
+namespace bbstd
+{
+  //====================================================================
+  BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(SetElementVector,
+                                        bbtk::AtomicBlackBox);
+  //====================================================================
+
+//====================================================================
+// Add the specialized boxes to the package
+
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,int8_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,uint8_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,int16_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,uint16_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,int32_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,uint32_t);
+///\todo : diff between uint32_t and long?
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,long);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,float);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,double);
+typedef std::string string;
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,string);
+//====================================================================
+
+} // namespace bbstd
diff --git a/packages/std/src/bbstdSetElementVector.h b/packages/std/src/bbstdSetElementVector.h
new file mode 100644 (file)
index 0000000..be232b2
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # 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: bbstdGetVectorElement.h,v $
+  Language:  C++
+  Date:      $Date: 2012/11/16 08:51:32 $
+  Version:   $Revision: 1.9 $
+=========================================================================*/
+
+
+#ifndef __bbstdSetElementVector_INCLUDED_h__
+#define __bbstdSetElementVector_INCLUDED_h__
+
+#include "bbtkAtomicBlackBox.h"
+#include "bbstd_EXPORT.h"
+
+namespace bbstd
+{
+  //=================================================================
+  // BlackBox declaration
+  template <class T>
+  class bbstd_EXPORT SetElementVector : public bbtk::AtomicBlackBox
+  {
+    BBTK_TEMPLATE_BLACK_BOX_INTERFACE(SetElementVector,bbtk::AtomicBlackBox,T);
+    BBTK_DECLARE_INPUT(PVec,std::vector<T>*);
+    BBTK_DECLARE_INPUT(I,int);
+    BBTK_DECLARE_INPUT(Value,T);
+    BBTK_DECLARE_OUTPUT(Vec,std::vector<T>);
+   BBTK_PROCESS(DoIt);
+    void DoIt();
+  };
+  //=================================================================
+
+  //=================================================================
+  // BlackBox description
+  BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(SetElementVector,bbtk::AtomicBlackBox);
+  BBTK_NAME("SetElementVector"+bbtk::HumanTypeName<std::vector<T> >());
+  BBTK_AUTHOR("info-dev@creatis.insa-lyon.fr");
+ // BBTK_DEFAULT_ADAPTOR();
+  BBTK_DESCRIPTION("Sets the value of the i-element ("+bbtk::TypeName<std::vector<T> >());
+  typedef std::vector<T>* pTvector;
+  BBTK_TEMPLATE_INPUT(SetElementVector, PVec,"Pointer to Vector",pTvector);
+  BBTK_TEMPLATE_INPUT(SetElementVector, I, "id-element",int);  
+  BBTK_TEMPLATE_INPUT(SetElementVector, Value, "Input Value",T);  
+  BBTK_TEMPLATE_OUTPUT(SetElementVector,Vec,"Output Vector",std::vector<T>);
+  BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(SetElementVector);
+  //=================================================================
+
+  //=================================================================
+  template <class T>
+  void SetElementVector<T>::DoIt()
+  {    
+       if ( (bbGetInputI()>=0) && (bbGetInputI()<bbGetInputPVec()->size()) )   
+       {
+               (*( bbGetInputPVec() ))[ bbGetInputI() ] = bbGetInputValue();
+       }
+       bbSetOutputVec( *( bbGetInputPVec() ) );
+//     bbSignalOutputModification(std::string("Vec")); 
+  }
+  //=================================================================
+
+  //=================================================================  
+  template <class T>
+  void SetElementVector<T>::bbUserSetDefaultValues()
+  {
+
+  }
+  //=================================================================
+  //=================================================================  
+  template <class T>
+  void SetElementVector<T>::bbUserInitializeProcessing()
+  {
+
+  }
+  //=================================================================
+  //=================================================================  
+  template <class T>
+  void SetElementVector<T>::bbUserFinalizeProcessing()
+  {
+
+  }
+  //=================================================================
+
+} // namespace bbstd
+
+#endif //__bbstdSetElementVector_INCLUDED_h__
+
index 75aea8742ac701d6ebfde7bd1d2f6d036a8e567a..5dfd30a6a03ee5c167766c123cd576990320da54 100644 (file)
@@ -70,7 +70,8 @@ namespace bbstd
 
   void SharedMemory::bbUserSetDefaultValues()
   {
-    mCanSet = true;
+    mCanSet    = true;
+       firsttime       = true;
   }
   void SharedMemory::bbUserInitializeProcessing() 
   { 
@@ -81,6 +82,11 @@ namespace bbstd
   void SharedMemory::DoProcess()
   { 
     mCanSet = true;
+       if (firsttime==true)
+       {
+               firsttime = false;
+           bbSetOutputOut( bbGetInputIn() );   
+       }
   }
 
   BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,SharedMemory);
index a981f28b3ea20d53cf5e45b56194cb2317ce5d8e..7e8c5be4f6334d823871e432b736b75bd11032b6 100644 (file)
@@ -57,7 +57,10 @@ public:                                                                      \
     public bbtk::AtomicBlackBox
   {
     BBTK_BLACK_BOX_INTERFACE(SharedMemory,bbtk::AtomicBlackBox);
+
+//    BBTK_DECLARE_INPUT(In,bbtk::Data);
     BBTK_MB_DECLARE_INPUT(In,bbtk::Data);
+
     BBTK_MB_DECLARE_INPUT(In1,bbtk::Data);
     BBTK_MB_DECLARE_INPUT(In2,bbtk::Data);
     BBTK_MB_DECLARE_INPUT(In3,bbtk::Data);
@@ -75,6 +78,7 @@ public:                                                                       \
     virtual void bbSetStatusAndPropagate(bbtk::BlackBoxInputConnector* c,
                                         bbtk::IOStatus s);
     bool mCanSet;
+    bool firsttime;
  };
   //==================================================================
   
index 39153b54cb4b2f38c8dafee470053ab642170632..6e68911584a32e5f90ed0f79ca8b3053cf606529 100644 (file)
@@ -90,18 +90,21 @@ namespace bbstd
     std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
     // Find first "non-delimiter".
     std::string::size_type pos     = str.find_first_of(delimiters, lastPos);
-    bbmOutputOut.clear();
+//    bbmOutputOut.clear();
+std::vector<T> out;
     while (std::string::npos != pos || std::string::npos != lastPos)
       {
        // Found a token, add it to the vector.
-       bbmOutputOut.push_back( 
-                              this->decode_item( str.substr(lastPos, pos - lastPos) ) );
+//     bbmOutputOut.push_back( this->decode_item( str.substr(lastPos, pos - lastPos) ) );
+       out.push_back( this->decode_item( str.substr(lastPos, pos - lastPos) ) );
        //      std::cout << this->bbGetOutputOut().back() << std::endl;
        // Skip delimiters.  Note the "not_of"
        lastPos = str.find_first_not_of(delimiters, pos);
        // Find next "non-delimiter"
        pos = str.find_first_of(delimiters, lastPos);
       }
+bbSetOutputOut (out);
+//bbSignalOutputModification();
     //  std::cout << "s=" << this->bbGetOutputOut().size() << std::endl;
   }
   //=================================================================
index e292bd23dfafa048c7fda206a700dde1ad512131..9bd9f63d12bdcb605ac008cc3e4cc3074642f166 100644 (file)
@@ -79,13 +79,12 @@ namespace bbstd
   template <class T>
   void StringVectorToNumericalVector<T>::DoIt()
   {
-      std::cout << "StringVectorToNumericalVector<"<<bbtk::TypeName<T>()<<">::DoIt()  start "<<std::endl;
-    
     typedef T type; 
 
     // \TODO :Affecter bbGetInputIn() Ã  un std::vector<std::string> // recopie? // JPR 
     //std::vector<std::string> vect (bbGetInputIn() );
 
+    bbmOutputOut.clear();   
     // get a  std::string, add it to the <std::vector< >>
     int lgt=bbGetInputIn().size();
     for (int i=0; i<lgt; i++)
@@ -93,7 +92,7 @@ namespace bbstd
        bbmOutputOut.push_back( decode_item( bbGetInputIn()[i]) );    
     }
     // bbmOutputOut.clear();   // ? JPR
+
     // just to see // JPR      
 //EED    int lgrOut=this->bbGetOutputOut().size();  
 //EED    for (int j=0; j<lgrOut; j++)
@@ -102,8 +101,6 @@ namespace bbstd
 //EED    }
     // end just to see // JPR  
          
-      std::cout << "StringVectorToNumericalVector<"<<bbtk::TypeName<T>()<<">::DoIt()  end "<<std::endl;
-         
   }
   //=================================================================
   
index cb9d77bf0d920e156f4de703db005274e643e7f3..007c34718cc779e17897a44f3ddd81ec35f4dddc 100644 (file)
@@ -53,7 +53,7 @@ void CreateImage::Process()
 //    * TYPE is the C++ type of the input/output
 //      (the one provided in the attribute 'type' of the tag 'input')
 
-       double  spc[6];
+       double  spc[3];
        int             dim[3]; 
        int             outputformat = VTK_UNSIGNED_SHORT;
        
@@ -80,15 +80,30 @@ void CreateImage::Process()
        else if (bbGetInputOutputFormat()=="VTK_DOUBLE")                        outputformat = VTK_DOUBLE;              // 11           
        else if (bbGetInputOutputFormat()=="MET_DOUBLE")                        outputformat = VTK_DOUBLE;              // 11  
 
-
        spc[0] = bbGetInputSpacing()[0];
        spc[1] = bbGetInputSpacing()[1];
        spc[2] = bbGetInputSpacing()[2];
-       
        dim[0] =  bbGetInputDimensions()[0];
        dim[1] =  bbGetInputDimensions()[1];
        dim[2] =  bbGetInputDimensions()[2];
-       
+       if ((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0))
+       {
+               dim[0]=1;
+               dim[1]=1;
+               dim[2]=1;
+       }
+       if ((spc[0]<=0)||(spc[1]<=0)||(spc[2]<=0))
+       {
+               spc[0]=1;
+               spc[1]=1;
+               spc[2]=1;
+       }
+//EED 2017-12-7
+       if (imageoutput!=NULL) 
+       {
+               imageoutput->Delete();
+       }       
+       imageoutput = vtkImageData::New();
        imageoutput->Initialize();
        imageoutput->SetSpacing( spc );
        imageoutput->SetDimensions(  dim[0], dim[1], dim[2] );
@@ -102,7 +117,6 @@ void CreateImage::Process()
        imageoutput->AllocateScalars( outputformat,1 );
 #endif
        
-
        int i,j,k;
        long sizeBlock; 
 
@@ -122,7 +136,7 @@ void CreateImage::Process()
        {
                memcpy(  imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer()  , sizeBlock );
        } // for k
-
+       
 
 //EED 2017-01-01 Migration VTK7
 #if (VTK_MAJOR_VERSION <= 5) 
@@ -170,7 +184,7 @@ void CreateImage::bbUserInitializeProcessing()
 //    but this is where you should allocate the internal/output pointers 
 //    if any 
 
-       imageoutput = vtkImageData::New();
+//EED 2017-12-7        imageoutput = vtkImageData::New();
 
 }
        
index e947bb36046a60fc60f98339f0f070825d5a1b6f..8d003bdca2e01f1634bf17bc93060f1c0e0ebf89 100644 (file)
@@ -30,6 +30,9 @@
 //===== 
 #include "bbvtkImageBoundaries.h"
 #include "bbvtkPackage.h"
+#include "creaVtk_MACROS.h"
+
+#include <omp.h>
 namespace bbvtk
 {
 
@@ -57,7 +60,6 @@ void ImageBoundaries::Process()
                int maxX        = ext[1]-ext[0]+1;
                int maxY        = ext[3]-ext[2]+1;
                int maxZ        = ext[5]-ext[4]+1;
-                               
                int bXMax       = 0;
                int bYMax       = 0;
                int bZMax       = 0;
@@ -65,13 +67,17 @@ void ImageBoundaries::Process()
                int bYMin       = maxY-1;
                int bZMin       = maxZ-1;
                
-               for (i=0 ; i<maxX ; i++)
+/*
+               #pragma omp parallel for
+               for (int i=0 ; i<maxX ; i++)
                {
+                       int j;  
+                       int k;
                        for (j=0 ; j<maxY ; j++)
                        {
                                for (k=0 ; k<maxZ ; k++)
                                {
-                                       value = bbGetInputIn()->GetScalarComponentAsDouble(i, j, k,0);
+                                       double value = bbGetInputIn()->GetScalarComponentAsDouble(i, j, k,0);
                                        if ( (value>=bbGetInputLowerValue()) && (value<=bbGetInputUpperValue())  )
                                        {
                                                if (i<bXMin) bXMin=i;
@@ -84,10 +90,35 @@ void ImageBoundaries::Process()
                                } // for k
                        } // for j
                } // i
-                       
+*/
+
+               DEF_POINTER_IMAGE_VTK_CREA(vI,ssI,pI,stI,bbGetInputIn())        
+               int i;
+               int j;  
+               long int index=0;
+               for (int k=0 ; k<maxZ ; k++)
+               {
+                       for (j=0 ; j<maxY ; j++)
+                       {
+                               for (i=0 ; i<maxX ; i++)
+                               {
+//                                     double value = bbGetInputIn()->GetScalarComponentAsDouble(i, j, k,0);
+                                       GETVALUE2_VTK_CREA(vI,pI,stI,index) 
+                                       index++;
+                                       if ( (vI>=bbGetInputLowerValue()) && (vI<=bbGetInputUpperValue())  )
+                                       {
+                                               if (i<bXMin) bXMin=i;
+                                               if (j<bYMin) bYMin=j;
+                                               if (k<bZMin) bZMin=k;
+                                               if (i>bXMax) bXMax=i;
+                                               if (j>bYMax) bYMax=j;
+                                               if (k>bZMax) bZMax=k;
+                                       }
+                               } // for k
+                       } // for j
+               } // i
                std::vector<int> tmpIndex;              
                std::vector<int> tmpSize;
-               
                if (bXMin>bXMax){
                        tmpIndex.push_back(0);
                        tmpIndex.push_back(0);
@@ -103,13 +134,11 @@ void ImageBoundaries::Process()
                        tmpSize.push_back(bYMax-bYMin+1);
                        tmpSize.push_back(bZMax-bZMin+1);
                }
-                       
                bbSetOutputIndex(tmpIndex);
                bbSetOutputSize(tmpSize);
        } else {
                printf("bbtk warnning: bbtk:vtk:ImageBoundaries box, Input image (In) not initialized..\n");
        }
-       printf("bbtk:vtk::ImageBoundaries::Process end\n");
 }
 //===== 
 // 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)
index 6f2808219c3faf75f60d7a828e03adbe58aedaca..9f6bc7d20c36e4fce83d2c320fcfe4eaca8c1fdb 100644 (file)
@@ -153,13 +153,13 @@ namespace bbvtk
 
    void ImagePlanes::bbUserSetDefaultValues() 
    { 
-     bbSetOutputPlaneX(0);
-     bbSetOutputPlaneY(0);
-     bbSetOutputPlaneZ(0);
-     bbSetOutputImageX(0);
-     bbSetOutputImageY(0);
-     bbSetOutputImageZ(0);
-     bbSetInputIn(0);
+     bbSetOutputPlaneX(NULL);
+     bbSetOutputPlaneY(NULL);
+     bbSetOutputPlaneZ(NULL);
+     bbSetOutputImageX(NULL);
+     bbSetOutputImageY(NULL);
+     bbSetOutputImageZ(NULL);
+     bbSetInputIn(NULL);
      std::vector<double> vect;
      vect.push_back(0);
      vect.push_back(0);
@@ -274,8 +274,10 @@ namespace bbvtk
      //bbSetOutputImage3Pts(planeWidget3Pts->GetResliceOutput());
 
         if(picker != 0)
+     {
                picker->UnRegister(NULL);
-     
+        }
+
      mVtkCallback = VtkCallbackType::New();
      mVtkCallback->SetBlackBox(this);
      planeWidgetX->AddObserver(vtkCommand::InteractionEvent,mVtkCallback);
@@ -428,27 +430,27 @@ namespace bbvtk
 
                        //Get the corresponding three points out of the vectors
                        double origin[3];
-                       origin[0] = pointsx[0];
-                       origin[1] = pointsy[0];
-                       origin[2] = pointsz[0];
+                       origin[0]                       = pointsx[0];
+                       origin[1]                       = pointsy[0];
+                       origin[2]                       = pointsz[0];
 
                        double point1[3];
-                       point1[0] = pointsx[1];
-                       point1[1] = pointsy[1];
-                       point1[2] = pointsz[1];
+                       point1[0]                       = pointsx[1];
+                       point1[1]                       = pointsy[1];
+                       point1[2]                       = pointsz[1];
                        double point2[3];
-                       point2[0]= pointsx[2];
-                       point2[1]= pointsy[2];
-                       point2[2]= pointsz[2];  
+                       point2[0]                       = pointsx[2];
+                       point2[1]                       = pointsy[2];
+                       point2[2]                       = pointsz[2];   
 
                        //With the three points we create the corresponding X, Y and Z vectors all orthogonal to each other
-                       double* vect1= getNormal(makeVector(origin, point1));
-                       double* vect2= getNormal(makeVector(origin, point2));                           
-                       double* crossp = getCrossProduct(vect1, vect2);
+                       double* vect1           = getNormal(makeVector(origin, point1));
+                       double* vect2           = getNormal(makeVector(origin, point2));                                
+                       double* crossp          = getCrossProduct(vect1, vect2);
 
-                       double *newx = getCrossProduct(vect2, crossp);
+                       double *newx            = getCrossProduct(vect2, crossp);
 
-                       int ext[6],factor=0;
+                       int ext[6],factor       =       0;
                        bbGetInputIn()->GetExtent(ext);
 
                        factor = ext[0]<ext[3]? ext[3] : ext[0];
@@ -484,12 +486,13 @@ namespace bbvtk
 #endif
 
 //To get the slice of image out of the selected volume
-                       if (_imageReslicer==NULL){
+                       if (_imageReslicer==NULL)
+                       {
                                _imageReslicer = vtkImageReslice::New();                                        
                                _imageReslicer->SetOutputDimensionality(2);
                                _transform = vtkTransform::New();
                                _matrix = vtkMatrix4x4::New();  
-                       }
+                       } // if
                        _imageReslicer->SetInterpolationMode( bbGetInputInterpolation() );
 
 //EED 2017-01-01 Migration VTK7
@@ -545,23 +548,24 @@ namespace bbvtk
        } // bbGetInputIn
   }
        
-  void ImagePlanes::updateInteractor(){
-
-       vtkRenderWindowInteractor* interactor = bbGetInputInteractor();
-
-       if(interactor){
-               bbGetOutputPlaneX()->SetInteractor(interactor);
-               bbGetOutputPlaneX()->EnabledOn();
-               bbGetOutputPlaneY()->SetInteractor(interactor);
-               bbGetOutputPlaneY()->EnabledOn();
-               bbGetOutputPlaneZ()->SetInteractor(interactor);
-               bbGetOutputPlaneZ()->EnabledOn();
-               bbGetOutputPlane3Pts()->SetInteractor(interactor);
-               bbGetOutputPlane3Pts()->EnabledOn();
-       }
-  }
+       void ImagePlanes::updateInteractor()
+       {
+               vtkRenderWindowInteractor* interactor = bbGetInputInteractor(); 
+               if(interactor)
+               {
+                       bbGetOutputPlaneX()->SetInteractor(interactor);
+                       bbGetOutputPlaneX()->EnabledOn();
+                       bbGetOutputPlaneY()->SetInteractor(interactor);
+                       bbGetOutputPlaneY()->EnabledOn();
+                       bbGetOutputPlaneZ()->SetInteractor(interactor);
+                       bbGetOutputPlaneZ()->EnabledOn();
+                       bbGetOutputPlane3Pts()->SetInteractor(interactor);
+                       bbGetOutputPlane3Pts()->EnabledOn();
+               } // if
+       }
+
        //-----------------------------------------------------------------     
-  void vtkImageDataPointerRelay::bbUserSetDefaultValues()
+       void vtkImageDataPointerRelay::bbUserSetDefaultValues()
        {
                
        }
index 3ff20db583c93582e5c80adde649ef461fbb1784..a93a9e4a6e7d570afcb797280e00481c849beedc 100644 (file)
@@ -101,19 +101,19 @@ namespace bbvtk
 
   private:
     class VtkCallbackType;
-    VtkCallbackTypemVtkCallback;
-    vtkImageDataimage;
-    vtkImageReslice_imageReslicer;
-
-    vtkTransform_transform;
-    vtkMatrix4x4_matrix;
-
-    doublegetCrossProduct(double* vect0,double* vect1);
-    double getPodoubleProduct(double* vect0,double* vect1);
-    doublegetNormal(double* vect);
-    double getMagnitud(double* vect);
-    doublemakeVector(double podouble0[3], double podouble1[3]);
-    void updateInteractor();
+    VtkCallbackType    *mVtkCallback;
+    vtkImageData       *image;
+    vtkImageReslice    *_imageReslicer;
+
+    vtkTransform       *_transform;
+    vtkMatrix4x4       *_matrix;
+
+    double     *getCrossProduct(double* vect0,double* vect1);
+    double     getPodoubleProduct(double* vect0,double* vect1);
+    double     *getNormal(double* vect);
+    double     getMagnitud(double* vect);
+    double     *makeVector(double podouble0[3], double podouble1[3]);
+    void       updateInteractor();
 
     vtkImagePlaneWidget* GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker);
   };
index 50506435bc6026d0c686b66b98c97fd684551874..a065023d1f2d8d09bd310d200bea42574d90890f 100644 (file)
@@ -40,20 +40,21 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ImageVtkProperties,bbtk::AtomicBlackBox);
 //===== 
 void ImageVtkProperties::Process()
 {
-       unsigned int dim;
-       int ext[6];
-       double spc[3];
-       double range[2];
-       std::string nametype;
-       int numberoOfComponents;
-       std::vector<int> vsize;
-       std::vector<float> vspacing;
-       std::vector<float> vrange;
+       unsigned int            dim;
+       int                             ext[6];
+       double                          spc[3];
+       double                          range[2];
+       double                          origin[3];
+       std::string             nametype;
+       int                             numberoOfComponents;
+       std::vector<int>        vsize;
+       std::vector<double> vspacing;
+       std::vector<double> vrange;
+       std::vector<double> vorigin;
 
        if ( bbGetInputIn() )
        {
                bbGetInputIn()->Modified();
-               
 //EED 2017-01-01 Migration VTK7
 #if (VTK_MAJOR_VERSION <= 5) 
                bbGetInputIn()->Update();
@@ -66,24 +67,21 @@ void ImageVtkProperties::Process()
                vsize.push_back(ext[1]-ext[0]+1);
                vsize.push_back(ext[3]-ext[2]+1);
                vsize.push_back(ext[5]-ext[4]+1);
-               
                dim = 0;
                if (vsize[0]>1) dim++;
                if (vsize[1]>1) dim++;
                if (vsize[2]>1) dim++;
-               
                bbGetInputIn()->GetScalarRange(range);
+               bbGetInputIn()->GetOrigin(origin);
                numberoOfComponents=bbGetInputIn()->GetNumberOfScalarComponents();
-       
                bbGetInputIn()->GetSpacing(spc);
                for (unsigned int i=0;i<dim;++i) 
                {
-                       vspacing.push_back((float)spc[i]);
+                       vspacing.push_back( (double)spc[i] );
+                       vorigin.push_back( (double)origin[i] );
                }
-
-               vrange.push_back((float)range[0]);
-               vrange.push_back((float)range[1]);
-
+               vrange.push_back((double)range[0]);
+               vrange.push_back((double)range[1]);
                if (bbGetInputIn()->GetScalarType()==VTK_BIT)                           nametype="VTK_BIT";                     // 1
                if (bbGetInputIn()->GetScalarType()==VTK_CHAR)                          nametype="VTK_CHAR";                    // 2
                if (bbGetInputIn()->GetScalarType()==VTK_SIGNED_CHAR)           nametype="VTK_SIGNED_CHAR";     // 15
@@ -109,13 +107,13 @@ void ImageVtkProperties::Process()
                vrange.push_back(0);
                nametype                        = "VOID";                               
        }       
-       bbSetOutputDimension( dim );
-       bbSetOutputSize( vsize );
-       bbSetOutputSpacing( vspacing );
-       bbSetOutputMinMax( vrange );
-       bbSetOutputTypeName( nametype );
-       bbSetOutputComponents( numberoOfComponents );
-       
+       bbSetOutputDimension    ( dim );
+       bbSetOutputOrigin               ( vorigin );
+       bbSetOutputSize                 ( vsize );
+       bbSetOutputSpacing              ( vspacing );
+       bbSetOutputMinMax               ( vrange );
+       bbSetOutputTypeName             ( nametype );
+       bbSetOutputComponents   ( numberoOfComponents );
 }
 //===== 
 // 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)
index 9569d3a2db23de0f15078460444399155a6b60a3..eb1a196f663edadcec13bcd9e3e4cdd11acfbc4e 100644 (file)
@@ -48,10 +48,11 @@ class bbvtk_EXPORT ImageVtkProperties
 // 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,vtkImageData*);
+       BBTK_DECLARE_OUTPUT(Origin,std::vector<double>);
        BBTK_DECLARE_OUTPUT(Dimension,unsigned int);
-       BBTK_DECLARE_OUTPUT(MinMax,std::vector<float>);
+       BBTK_DECLARE_OUTPUT(MinMax,std::vector<double>);
        BBTK_DECLARE_OUTPUT(Size,std::vector<int>);
-       BBTK_DECLARE_OUTPUT(Spacing,std::vector<float>);
+       BBTK_DECLARE_OUTPUT(Spacing,std::vector<double>);
        BBTK_DECLARE_OUTPUT(TypeName,std::string);
        BBTK_DECLARE_OUTPUT(Components,int);
   BBTK_PROCESS(Process);
@@ -67,10 +68,11 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageVtkProperties,bbtk::AtomicBlackBox);
  BBTK_DESCRIPTION("Image information Dim, Spc, Type, MinMax");
  BBTK_CATEGORY("filter");
  BBTK_INPUT(ImageVtkProperties,In,"Input image (vtk)",vtkImageData*,"");
+ BBTK_OUTPUT(ImageVtkProperties,Origin,"Origin", std::vector<double>  ,"");
  BBTK_OUTPUT(ImageVtkProperties,Dimension,"Dimensions 1D 2D 3D",unsigned int,"");
- BBTK_OUTPUT(ImageVtkProperties,MinMax,"Gray level range min and max",std::vector<float>,"");
+ BBTK_OUTPUT(ImageVtkProperties,MinMax,"Gray level range min and max",std::vector<double>,"");
  BBTK_OUTPUT(ImageVtkProperties,Size,"Size of the image",std::vector<int>,"");
- BBTK_OUTPUT(ImageVtkProperties,Spacing,"Spacing of the image",std::vector<float>,"");
+ BBTK_OUTPUT(ImageVtkProperties,Spacing,"Spacing of the image",std::vector<double>,"");
  BBTK_OUTPUT(ImageVtkProperties,TypeName,"Type format of the image",std::string,"");
  BBTK_OUTPUT(ImageVtkProperties,Components,"Number of scalar components",int,"");
 BBTK_END_DESCRIBE_BLACK_BOX(ImageVtkProperties);
index 8581943820eb2e983ad2861975efcda79f2223cb..29be94cabe1ed7bd18a5b9e3f2b6b89130773987 100644 (file)
@@ -26,13 +26,15 @@ void InversCrop::Process()
 //    * TYPE is the C++ type of the input/output
 //      (the one provided in the attribute 'type' of the tag 'input')
 
-    if ((bbGetInputImageFix()!=NULL) && (bbGetInputImageMove()!=NULL) )
-    {
-     if ( bbGetInputImageFix()->GetScalarType()==bbGetInputImageMove()->GetScalarType() ) 
-     {
-        // Creating Image
-       int dim[3];
-       int ext[6];
+       if (bbGetInputActive()==true)
+       {
+           if ( (bbGetInputImageFix()!=NULL) && (bbGetInputImageMove()!=NULL) )
+           {
+            if ( bbGetInputImageFix()->GetScalarType()==bbGetInputImageMove()->GetScalarType() ) 
+            {
+               // Creating Image
+               int dim[3];
+               int ext[6];
        
 //EED 2017-01-01 Migration VTK7
 #if (VTK_MAJOR_VERSION <= 5) 
@@ -111,21 +113,75 @@ void InversCrop::Process()
                     (py>=0)    && (pz>=0)      &&
                     (sizeXM>0) ) 
                {
-                       memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM );
+                       _imageoutput = vtkImageData::New();
+                       _imageoutput->Initialize();
+                       _imageoutput->SetScalarType( bbGetInputImageFix()->GetScalarType() );
+                       _imageoutput->SetSpacing( bbGetInputImageFix()->GetSpacing() );
+                       _imageoutput->SetDimensions(  dim[0], dim[1], dim[2] );
+                       _imageoutput->AllocateScalars();
+                       // Duplicating Fix Image
+                       long sizeimage = dim[0]*dim[1]*dim[2]*bbGetInputImageFix()->GetScalarSize();    
+                       memcpy( _imageoutput->GetScalarPointer() , bbGetInputImageFix()->GetScalarPointer() , sizeimage);
+               }
+               if (bbGetInputType()==1)
+               {
+                       _imageoutput=bbGetInputImageFix();
                }
 
-          } // for j
-       } // for k
-        _imageoutput->Modified();
-      } // If Image Fixe Move the same GetScalarType
-        else {
-           printf ("ERROR: InversCrop  both ImageFixe and ImageMove need the same format.\n");
-      }  
-    } // If Image Fixe Move != NULL
-     else {
-        printf ("ERROR: InversCrop  need ImageFixe and ImageMove to run.\n");
-    } 
-    bbSetOutputOut(_imageoutput);
+
+
+               // Copy the Move Image
+               int j,k; 
+               int px,py,pz;
+
+               bbGetInputImageMove()->GetWholeExtent(ext);
+               int dimMoveX    = ext[1]-ext[0]+1;
+               int dimMoveY    = ext[3]-ext[2]+1;
+               int dimMoveZ    = ext[5]-ext[4]+1;
+
+               int spxM                = 0;  // start px MoveImage
+               int sizeXM              = 0;  // sizeX MoveImage
+
+               px                              = bbGetInputOrigin()[0];
+               spxM                    = 0;
+               if (px<0)
+               { 
+                  spxM=px*(-1);
+                  px=0;
+               }
+               sizeXM = dimMoveX-spxM;
+               if (px+sizeXM>=dim[0]) sizeXM=dim[0]-px;
+               sizeXM=sizeXM*bbGetInputImageFix()->GetScalarSize();
+               for (k=0; k<dimMoveZ; k++)
+               {
+                  for (j=0; j<dimMoveY; j++)
+                  {
+                       py=j+bbGetInputOrigin()[1];
+                               pz=k+bbGetInputOrigin()[2];
+                               if ( (py<dim[1]) && (pz<dim[2]) &&
+                                (py>=0)    && (pz>=0)  &&
+                                        (sizeXM>0) ) 
+                               {
+                                       memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM );
+                               }
+
+                  } // for j
+               } // for k
+               _imageoutput->Modified();
+             } // If Image Fixe Move the same GetScalarType
+               else {
+                  printf ("ERROR: InversCrop  both ImageFixe and ImageMove need the same format.\n");
+                  printf ("       type ImageFix:%d   type ImageMove:%d\n", bbGetInputImageFix()->GetScalarType(), bbGetInputImageMove()->GetScalarType() );
+
+             }  
+           } // If Image Fixe Move != NULL   
+            else {
+               printf ("ERROR: InversCrop  need ImageFixe and ImageMove to run.\n");
+           } 
+           bbSetOutputOut(_imageoutput);
+
+       } // if Active
+
 }
 
 //===== 
@@ -133,19 +189,17 @@ void InversCrop::Process()
 //===== 
 void InversCrop::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
+   bbSetInputActive(true);
    bbSetInputType(0);
    bbSetInputImageFix(NULL);
    bbSetInputImageMove(NULL);
-
    std::vector<int> origin;
    origin.push_back(0);
    origin.push_back(0);
    origin.push_back(0);
    bbSetInputOrigin(origin);
-   
    _imageoutput=NULL;
 }
 //===== 
index 59d90dc0fafb91446211c8e57a68834952962ee3..fc56a555dd7dd74a5ab807e5f31d7b49ac343429 100644 (file)
@@ -21,6 +21,8 @@ class bbvtk_EXPORT InversCrop
 //===== 
 // 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(Active,bool);
   BBTK_DECLARE_INPUT(Type,int);
   BBTK_DECLARE_INPUT(ImageFix,vtkImageData*);
   BBTK_DECLARE_INPUT(ImageMove,vtkImageData*);
@@ -40,14 +42,12 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(InversCrop,bbtk::AtomicBlackBox);
   BBTK_AUTHOR("InfoDev");
   BBTK_DESCRIPTION("Invers Crop, Both images had to have the same format");
   BBTK_CATEGORY("");
-
+  BBTK_INPUT(InversCrop,Active,"true/false (default true)",bool,"");
   BBTK_INPUT(InversCrop,Type,"(default 0) 0=Create image for the result FixImage+MoveImage, 1=Use the FixImage as output",int,"");
   BBTK_INPUT(InversCrop,ImageFix,"Fix Image (necesary). Need same format of ImageMove",vtkImageData*,"");
   BBTK_INPUT(InversCrop,ImageMove,"Move Image (necesary). Need same format of ImageFix",vtkImageData*,"");
   BBTK_INPUT(InversCrop,Origin,"Position to be put de Move Image (default 0,0,0 )",std::vector<int>,"");
-
   BBTK_OUTPUT(InversCrop,Out,"First output",vtkImageData*,"");
-
 BBTK_END_DESCRIBE_BLACK_BOX(InversCrop);
 //===== 
 // 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)
index 0a2fdfdb24074331ed862707a18e2c28901bfb3b..ed7966c13c7f48e50ba0572d2d847cdbdb9762b7 100644 (file)
@@ -47,6 +47,7 @@
 #include "bbvtkPolyDataToActor.h"
 #include "bbvtkPackage.h"
 
+
 namespace bbvtk
 {
    BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,PolyDataToActor)
@@ -60,7 +61,6 @@ namespace bbvtk
           colour.push_back(1.0);
           colour.push_back(0.5);
           bbSetInputColour(colour);
-
           bbSetInputActive(true);
           bbSetInputIn(NULL);
           bbSetInputRenderer(NULL);
@@ -69,7 +69,6 @@ namespace bbvtk
           bbSetInputRepresentation(2);
           bbSetInputLineWidth(1);
           bbSetInputScalarVisibility(false);
-
           polydatamapper = NULL;
           vtkactor       = NULL;
    }
@@ -118,6 +117,16 @@ namespace bbvtk
 #endif
 
                         vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
+
+                       if (bbGetInputRepresentation()==1)
+                       {
+                                vtkactor->GetProperty()->SetAmbient(1);
+                                vtkactor->GetProperty()->SetDiffuse(1);
+                                vtkactor->GetProperty()->SetSpecular(0);
+                       } else {
+printf("EED WARNNING!  PolyDataToActor::DoProcess  which is the default values of Ambient, Diffuse, Specular ? \n");
+                       }
+
                         vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
                           
                         vtkactor->GetProperty()->SetColor( bbGetInputColour()[0],  
@@ -125,6 +134,7 @@ namespace bbvtk
                                                        bbGetInputColour()[2] );
                                  
                         vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
+
                         
                         if ( bbGetInputTransform()!=NULL )
                         {
index 4e82b55862039db015962fc5b20292ff2c4d69ad..497e304db098280df9ef29b6f1dcbd4b8ffc42bd 100755 (executable)
@@ -34,6 +34,9 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,SliceImage)
 BBTK_BLACK_BOX_IMPLEMENTATION(SliceImage,bbtk::AtomicBlackBox);
 void SliceImage::Process()
 {
+
+printf("EED ********************************** bbtk-box vtk:SliceImage (Deprecated)\n");
+printf("EED **********************************   >> use bbtk-box creaMaracasVisu:SliceImage \n");
        vtkImageData* original = bbGetInputIn();
 
        if (original == NULL)
index 121a129e950a331ded261465193d1bf89dc14ae2..500bd36418671aebb7db86c59bc9acfa9bc03671 100755 (executable)
@@ -63,7 +63,7 @@ BBTK_AUTHOR("_author_");
 BBTK_DESCRIPTION("_description_");
 BBTK_CATEGORY("__CATEGORY__");
 BBTK_INPUT(SliceImage,In,"3D Image",vtkImageData*,"");
-BBTK_INPUT(SliceImage,Z,"shoice",int,"");
+BBTK_INPUT(SliceImage,Z,"schoice",int,"");
 BBTK_OUTPUT(SliceImage,Out,"2D Slice",vtkImageData*,"");
 BBTK_OUTPUT(SliceImage,Max,"Maximum",int,"");
 BBTK_END_DESCRIBE_BLACK_BOX(SliceImage);
index 119e612c470e8630de8e844c686f7280e5308094..76b0b6d953f49286a4ac0530ef2917d1352640bc 100644 (file)
@@ -5,7 +5,7 @@
 #include "bbvtkPackage.h"
 
 #include <vtkPointData.h>
-
+#include <vtkMath.h>
 
 namespace bbvtk
 {
@@ -83,6 +83,72 @@ void SurfaceTexture::Process()
                  colorLookupTable->SetTableValue(      iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
                } // for iLookTable
 
+//EED 2018-06-8 ***********************ARDS Projet***********************************************
+               if (bbGetInputColorType()==2)
+               {
+                       int tableSize=256;
+                       colorLookupTable = vtkLookupTable::New();
+//                     colorLookupTable->SetNumberOfTableValues(tableSize); 
+                       colorLookupTable->SetTableRange(range[0],range[1]);
+//                     colorLookupTable->SetTableRange(0,11);
+                       colorLookupTable->Build();
+
+/*
+  for (unsigned int i = 0; i < tableSize; ++i)
+    {
+    colorLookupTable->SetTableValue(i,
+                       vtkMath::Random(.25, 1.0),
+                       vtkMath::Random(.25, 1.0),
+                       vtkMath::Random(.25, 1.0),
+                       1.0);
+    }
+*/
+
+                       double rgba1[4];
+                       double rgba2[4];
+                       int i,j;
+                       for (int iLookTable = 0; iLookTable<tableSize*3; iLookTable++)
+                       {
+                               i=rand() % tableSize;
+                               j=rand() % tableSize;
+                               colorLookupTable->GetTableValue(i, rgba1);
+                               colorLookupTable->GetTableValue(j, rgba2);
+
+                         colorLookupTable->SetTableValue(j, rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
+                         colorLookupTable->SetTableValue(i, rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
+                       } // for iLookTable
+
+               } // type 2
+
+
+               if (bbGetInputColorType()==3)
+               {
+                       int tableSize=13;
+                       colorLookupTable = vtkLookupTable::New();
+                       colorLookupTable->SetNumberOfTableValues(tableSize); 
+                       colorLookupTable->SetTableRange(6,range[1]);
+                       colorLookupTable->Build();
+
+                 colorLookupTable->SetTableValue(0, 1  ,1      ,1      ,1);
+                 colorLookupTable->SetTableValue(1, 1  ,0      ,0      ,1);
+                 colorLookupTable->SetTableValue(2, 0  ,1      ,0      ,1);
+                 colorLookupTable->SetTableValue(3, 0  ,0      ,1      ,1);
+                 colorLookupTable->SetTableValue(4, 0  ,1      ,1      ,1);
+                 colorLookupTable->SetTableValue(5, 1  ,1      ,0      ,1);
+                 colorLookupTable->SetTableValue(6, 1  ,0      ,1      ,1);
+
+                 colorLookupTable->SetTableValue(7, 0.5,1      ,1      ,1);
+                 colorLookupTable->SetTableValue(8, 1  ,0.5,1  ,1);
+                 colorLookupTable->SetTableValue(9, 1  ,1      ,0.5,1);
+
+                 colorLookupTable->SetTableValue(10,1  ,0.5,0.5,1);
+                 colorLookupTable->SetTableValue(11,0.5,0.5,1  ,1);
+
+               } // type 2
+
+
+
+
        }
 
        bbGetInputMesh()->GetPointData()->SetScalars(colors);
index 5b8ab4529fd67dc9d3f18f03cab898b5fd70eae2..8b2ea6479994078fb7d8d89022cd8f34382064ab 100644 (file)
@@ -23,17 +23,18 @@ namespace bbwx
                     int iSelection, 
                     std::string title, 
                     std::vector< std::string > lstIn, 
-                                       int typeForm );
+                                       int typeForm, 
+                                       int sizeX, int sizeY );
        ~ComboBoxWidget();
        void OnComboBoxSelection(int iSelection);
        void OnComboBox(wxEvent& event);
        void FillItems( int iSelection, std::vector< std::string > lstIn);
+    void VerifyDeselect(int iSelection);
 
   private:
     int                        mTypeForm;
     ComboBox           *mBox;
-       wxListBox               *wxlistbox;
-       wxChoice                *wxchoice;
+       wxItemContainer* itemcontainer;
   };
   
 
@@ -44,19 +45,21 @@ namespace bbwx
 
   //-------------------------------------------------------------------------
   ComboBoxWidget::ComboBoxWidget( ComboBox* box,
-               wxWindow *parent,
-               int iSelection,
-               std::string title,
-               std::vector< std::string > lstIn,
-                                       int typeForm)
+            wxWindow *parent,
+            int iSelection,
+            std::string title,
+            std::vector< std::string > lstIn,
+                       int typeForm,
+                       int sizeX, 
+                       int sizeY
+               )
     :
-    wxPanel( parent, -1) ,
+    wxPanel( parent, -1,wxDefaultPosition,wxSize(sizeX,sizeY) ) ,
     mBox(box),
     mTypeForm(typeForm)
   {
        wxPanel         *panel          = this;
-       wxlistbox                               = NULL;
-       wxchoice                                = NULL;
+       itemcontainer                   = NULL;
        int i;
 
     //---------------------------------------------------------------------
@@ -70,90 +73,77 @@ namespace bbwx
     }
     sizer->AddGrowableCol(0);
     panel->SetSizer(sizer);
-               
     //---------------------------------------------------------------------
-    // 1) Creation de wxChoise widget
-
-               if (mTypeForm==1)
-               {
-
-                       wxlistbox = new wxListBox ( panel , -1 );                       
-                       Connect( wxlistbox->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); 
-               for (i=0;i<lstIn.size(); i++)
-               {
-                               wxlistbox->Append(  bbtk::std2wx( lstIn[i] )  ); 
-                       } // for i
-               wxlistbox->SetSelection(iSelection);
-                  sizer->Add( wxlistbox,1,wxGROW ); 
-
-               } else {
-
-                       wxchoice = new wxChoice ( panel , -1 );
-                       Connect( wxchoice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); 
-               for (i=0;i<lstIn.size(); i++)
-               {
-                               wxchoice->Append(  bbtk::std2wx( lstIn[i] )  ); 
-                       } // for i
-               wxchoice->SetSelection(iSelection);
-                  sizer->Add( wxchoice,1,wxGROW ); 
-               }
-//    panel->SetAutoLayout(true);
-//    panel->Layout();
+       if (mTypeForm==1)
+       {
+               wxListBox *wxlistbox = new wxListBox ( panel , -1 , wxDefaultPosition,wxSize(sizeX,sizeY),0, NULL, wxLB_SINGLE );       
+               itemcontainer=wxlistbox;
+               sizer->Add( wxlistbox,1,wxEXPAND ); 
+               Connect( wxlistbox->GetId(), 
+                 wxEVT_COMMAND_LISTBOX_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); 
+       } else if (mTypeForm==0) {
+               wxChoice *wxchoice = new wxChoice ( panel , -1 );
+               itemcontainer=wxchoice;
+               sizer->Add( wxchoice,1,wxGROW ); 
+               Connect( wxchoice->GetId(), 
+                 wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); 
+       }
+       for (i=0;i<lstIn.size(); i++)
+       {
+               itemcontainer->Append(  bbtk::std2wx( lstIn[i] )  ); 
+       } // for i
+//     itemcontainer->SetSelection(iSelection);
   }
-  //-------------------------------------------------------------------------
-  
+
+  //-------------------------------------------------------------------------  
   ComboBoxWidget::~ComboBoxWidget()
   {
   }
 
+  //--------------------------------------------------------------------------
+  void ComboBoxWidget::VerifyDeselect(int iSelection)
+  {
+       if ((iSelection>=0) && (mBox->bbGetInputDeselect()==true) )
+       {
+               if (mTypeForm==1) 
+               { 
+                       ((wxListBox*)itemcontainer)->Deselect( iSelection ); 
+               } // if mTypeForm
+       } // if iSelection
+  }
 
   //--------------------------------------------------------------------------
   void ComboBoxWidget::OnComboBoxSelection(int iSelection)
   {
-    mBox->bbSetInputSelection( iSelection );
-    mBox->bbSetOutputOut( iSelection );
-    mBox->bbSetOutputOutString(    bbtk::wx2std( wxchoice->GetString(iSelection) )     );
-    mBox->bbSignalOutputModification("Out");
-    mBox->bbSignalOutputModification("OutString");
+       if (iSelection>=0) 
+       {
+               mBox->bbSetInputSelection( iSelection );
+               mBox->bbSetOutputOut( iSelection );
+               mBox->bbSetOutputOutString(    bbtk::wx2std( itemcontainer->GetString(iSelection) )     );
+               mBox->bbSignalOutputModification();
+
+               VerifyDeselect(iSelection);
+
+//             mBox->bbSignalOutputModification("Out");
+//             mBox->bbSignalOutputModification("OutString");
+       } // if iSelection
   }
 
   //--------------------------------------------------------------------------
   void ComboBoxWidget::OnComboBox(wxEvent& event)
   {
-        int iSelection;
-        if (mTypeForm==1)
-        {
-                iSelection = wxlistbox->GetSelection();
-        } else {
-                iSelection = wxchoice->GetSelection();
-        }
-        OnComboBoxSelection(iSelection);
+       OnComboBoxSelection( itemcontainer->GetSelection() );
   }
 //--------------------------------------------------------------------------
-  void ComboBoxWidget::FillItems(
-               int iSelection,
-               std::vector< std::string > lstIn
-       )
+  void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn )
        {
                int i;
-               if (mTypeForm==1)
-               {
-                       wxlistbox->Clear();
-
-               for (i=0;i<lstIn.size(); i++)
-               {
-                               wxlistbox->Append(  bbtk::std2wx( lstIn[i] )  ); 
-                       } // for i
-
-               wxlistbox->SetSelection(iSelection);
-               } else {
-                       wxchoice->Clear();
-               for (i=0;i<lstIn.size(); i++)
-               {
-                               wxchoice->Append(  bbtk::std2wx( lstIn[i] )  ); 
-                       } // for i
-               wxchoice->SetSelection(iSelection);
-               } // if
+               itemcontainer->Clear();
+       for (i=0;i<lstIn.size(); i++)
+       {
+                       itemcontainer->Append(  bbtk::std2wx( lstIn[i] )  ); 
+               } // for i
+               if (iSelection>=0) itemcontainer->SetSelection(iSelection);
        } 
 
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox)
@@ -169,39 +159,30 @@ void ComboBox::Process()
        w->FillItems( iSelection, bbGetInputIn() );
     bbSetInputSelection( iSelection );
     bbSetOutputOut( iSelection );
-
     int size = bbGetInputIn().size();
     if         (  (iSelection>0) && ( (size-1)<=iSelection) ) 
     { 
        bbSetOutputOutString( bbGetInputIn()[ iSelection ] );
-    }
-//    bbSignalOutputModification("Out");
-//    bbSignalOutputModification("OutString");
-}
+    } // if iSelection
 
+       w->VerifyDeselect(iSelection);
+}
 //===== 
 // 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 ComboBox::CreateWidget(wxWindow* parent)
 {
-
-//   bbSetOutputWidget( new wxStaticText ( parent , -1 , _T("") ) );
-//   bbSetOutputWidget( new wxComboBox ( parent , -1 , _T("ups") ) );  
-//   bbSetOutputWidget( new wxChoice ( parent , -1 ) );  
-
     ComboBoxWidget *w = new ComboBoxWidget(
                                this,
                                                        parent,
                                bbGetInputSelection() ,
                                bbGetInputTitle(),
                                bbGetInputIn(),
-                               bbGetInputForm() );
-
+                               bbGetInputForm(),
+                                                       bbGetInputWinWidth(), bbGetInputWinHeight()  );
    bbSetOutputOut( bbGetInputSelection() );
    bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
    bbSetOutputWidget( w );
-
-
 }
 //===== 
 // 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)
@@ -211,13 +192,15 @@ void ComboBox::bbUserSetDefaultValues()
        bbSetInputSelection(0);
        bbSetInputTitle("");
        bbSetInputForm(0);
+       bbSetInputWinWidth(100);
+       bbSetInputWinHeight(200);
+       bbSetInputDeselect(false);
 }
 //===== 
 // 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 ComboBox::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)
index a1182f9d42588823db4d5b1fffba5ebb6f67f761..6b1e702b2675047f75585f70f5dc70cc90c4bccb 100644 (file)
@@ -22,6 +22,7 @@ class bbwx_EXPORT ComboBox
   BBTK_DECLARE_INPUT(Selection, int );
   BBTK_DECLARE_INPUT(In,std::vector< std::string >);
   BBTK_DECLARE_INPUT(Form, int );
+  BBTK_DECLARE_INPUT(Deselect, bool );
   BBTK_DECLARE_OUTPUT(Out, int );
   BBTK_DECLARE_OUTPUT(OutString, std::string );
   BBTK_PROCESS(Process);
@@ -42,10 +43,9 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ComboBox,bbtk::WxBlackBox);
        BBTK_INPUT(ComboBox,Selection,"i element to be selected (default 0)",int,"");
        BBTK_INPUT(ComboBox,In,"Vector of strings",std::vector< std::string >,"");
        BBTK_INPUT(ComboBox,Form,"0 Combobox, 1 List  (default 0)",int,"");
-
-   BBTK_OUTPUT(ComboBox,Out,"i Item selected",int,"");
-   BBTK_OUTPUT(ComboBox,OutString,"string Item selected",std::string,"");
-
+       BBTK_INPUT(ComboBox,Deselect,"(default false) Just for List form",bool,"");
+    BBTK_OUTPUT(ComboBox,Out,"i Item selected",int,"");
+    BBTK_OUTPUT(ComboBox,OutString,"string Item selected",std::string,"");
 BBTK_END_DESCRIBE_BLACK_BOX(ComboBox);
 //===== 
 // 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)
index e2d9ac08dd10636453ce59e6460a581036f26f74..206d90c4774c8690ceef2572c61fd86231229001 100644 (file)
@@ -78,30 +78,24 @@ namespace bbwx
     : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
       mBox(box)
   { 
-
     wxPanel *panel     = this;
-
     mwxCommandButton = new wxButton( panel, -1, title);
     Connect( mwxCommandButton->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , 
             (wxObjectEventFunction) 
             (void (wxPanel::*)(wxEvent&))
             &CommandButtonWidget::OnCommandButton ); 
-    
     wxFlexGridSizer *sizer     = new wxFlexGridSizer(1);
     sizer -> Add( mwxCommandButton,1,wxGROW | wxALL,10 ); 
     sizer      -> AddGrowableCol(0);
-    
     panel      -> SetSizer(sizer);
     panel      -> SetAutoLayout(true);
     panel      -> Layout();
-    
   }
   
   CommandButtonWidget::~CommandButtonWidget()
   {
   }
   
-  
   void CommandButtonWidget::OnCommandButton( wxEvent& )
   {
     // Look for the interpreter or the executer if no interpreter
@@ -160,27 +154,25 @@ namespace bbwx
          }             
        I->InterpretLine( ccommand );
        pos1=pos2+1;
-       pos2 = commandstr.find(";",pos2+1);
-       
+       pos2 = commandstr.find(";",pos2+1);     
       }
-   
     mBox->UpdateLabel();
     mBox->UpdateColour();
     mBox->bbSignalOutputModification();
   }
 
-  
-  //--------------------------------------------------------------------------
-  
+  //--------------------------------------------------------------------------  
   void CommandButtonWidget::SetLabel(wxString title)
   {
     mwxCommandButton->SetLabel(title);
   }
+
   //--------------------------------------------------------------------------
-  
   void CommandButtonWidget::SetColour(wxColour color)
   {
     mwxCommandButton->SetBackgroundColour(color);
+       mwxCommandButton->Refresh();
+       mwxCommandButton->ClearBackground();
   }
 
 
@@ -235,15 +227,12 @@ namespace bbwx
          (bbGetInputColour()[2]==-1) )
       {
        wxwidget->SetColour( wxwidget->GetParent()->GetBackgroundColour() );
-      } 
-    else 
-      {
+      }  else  {
       int r=(int) (255*bbGetInputColour()[0]);
       int g=(int) (255*bbGetInputColour()[1]);
       int b=(int) (255*bbGetInputColour()[2]);
       wxwidget->SetColour( wxColour(r,g,b) );
     }
-
   } 
        
   void CommandButton::UpdateLabel()
diff --git a/packages/wx/src/bbwxHtmlWindow.cxx b/packages/wx/src/bbwxHtmlWindow.cxx
new file mode 100644 (file)
index 0000000..0298362
--- /dev/null
@@ -0,0 +1,56 @@
+//===== 
+// 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 "bbwxHtmlWindow.h"
+#include "bbwxPackage.h"
+#include <wx/html/htmlwin.h>
+
+namespace bbwx
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,HtmlWindow)
+BBTK_BLACK_BOX_IMPLEMENTATION(HtmlWindow,bbtk::WxBlackBox);
+//===== 
+// 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 HtmlWindow::Process()
+{
+       wxHtmlWindow* html = (wxHtmlWindow*)bbGetOutputWidget();
+       html->LoadPage( bbtk::std2wx( bbGetInputFileName() ));
+
+}
+//===== 
+// 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 HtmlWindow::CreateWidget(wxWindow* parent)
+{
+   bbSetOutputWidget( new wxHtmlWindow(parent, -1, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_AUTO) );
+}
+//===== 
+// 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 HtmlWindow::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 HtmlWindow::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 HtmlWindow::bbUserFinalizeProcessing()
+{
+
+}
+}
+// EO namespace bbwx
+
+
diff --git a/packages/wx/src/bbwxHtmlWindow.h b/packages/wx/src/bbwxHtmlWindow.h
new file mode 100644 (file)
index 0000000..3707c9c
--- /dev/null
@@ -0,0 +1,46 @@
+//===== 
+// 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)
+//===== 
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbwxHtmlWindow_h_INCLUDED__
+#define __bbwxHtmlWindow_h_INCLUDED__
+#include "bbwx_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+namespace bbwx
+{
+
+class bbwx_EXPORT HtmlWindow
+ : 
+   public bbtk::WxBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(HtmlWindow,bbtk::WxBlackBox);
+//===== 
+// 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(FileName,std::string);
+  BBTK_PROCESS(Process);
+  void Process();
+  BBTK_CREATE_WIDGET(CreateWidget);
+  void CreateWidget(wxWindow*);
+//===== 
+// 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(HtmlWindow,bbtk::WxBlackBox);
+       BBTK_NAME("HtmlWindow");
+       BBTK_AUTHOR("InfoDev");
+       BBTK_DESCRIPTION("No Description.");
+       BBTK_CATEGORY("__CategoryBlackBox__");
+       BBTK_INPUT(HtmlWindow,FileName,"Web page (.html)",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(HtmlWindow);
+//===== 
+// 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 bbwx
+
+#endif // __bbwxHtmlWindow_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
index ce0f36b5c84c03f1a3c158b202b19b3f44d06c11..8ff7751aeeb00911f08b3e5c6e9077b154ea3f64 100644 (file)
@@ -65,11 +65,14 @@ namespace bbwx
 
     int GetValue();
     void OnRadioButton(wxEvent& event);
+       void AddElements(std::vector<wxString> lstIn, int In, wxString title);
 
   private:
     RadioButton      *mBox;
     int                     MAX_RADIOBUTTON;
     wxRadioButton    *mwxRadioButton[10];
+
+       wxFlexGridSizer  *sizer;
   };
   
   //------------------------------------------------------------------------
@@ -86,8 +89,10 @@ namespace bbwx
     wxPanel( parent, -1) ,
     mBox(box)
   {
-    wxPanel *panel     = this;
+
+/*
     MAX_RADIOBUTTON = lstIn.size();
+    wxPanel *panel     = this;
     int i;
     long style=wxRB_GROUP;
     for (i=0;i<MAX_RADIOBUTTON; i++)
@@ -103,9 +108,7 @@ namespace bbwx
              if (In==i)
              {
                      mwxRadioButton[i]->SetValue(true);
-             } 
-             else 
-             {
+             } else {
                      mwxRadioButton[i]->SetValue(false);
              }
               Connect( mwxRadioButton[i]->GetId(),  
@@ -113,18 +116,20 @@ namespace bbwx
                   (wxObjectEventFunction) 
                   (void (wxPanel::*)(wxEvent&))
                   &RadioButtonWidget::OnRadioButton ); 
-          } 
-          else 
-          {
+          } else {
               mwxRadioButton[i]=NULL;
-          }
-    }
+          } // if
+    } // for 
     
     //---------------------------------------------------------------------
     // 2) Insertion of the components in the window
     
     // We use a FlexGridSizer
-    wxFlexGridSizer *sizer     = new wxFlexGridSizer(1);
+
+//EED 2018-04-18
+//    wxFlexGridSizer *sizer   = new wxFlexGridSizer(1);
+    sizer      = new wxFlexGridSizer(1);
+
     if (title!=_T(""))
     {
           sizer->Add( new wxStaticText(panel,-1, title ) ); 
@@ -141,6 +146,7 @@ namespace bbwx
 
 //    panel->SetAutoLayout(true);
 //    panel->Layout();
+*/
 
   }
   //-------------------------------------------------------------------------
@@ -176,6 +182,73 @@ namespace bbwx
     mBox->bbSignalOutputModification("Out");
   }
 
+
+  //--------------------------------------------------------------------------
+  void RadioButtonWidget::AddElements( std::vector<wxString> lstIn ,int In, wxString title)
+  {
+       DestroyChildren();
+
+    MAX_RADIOBUTTON = lstIn.size();
+    wxPanel *panel     = this;
+    int i;
+    long style=wxRB_GROUP;
+    for (i=0;i<MAX_RADIOBUTTON; i++)
+    {
+          if ( lstIn[i]!=_T(""))
+          {
+    //---------------------------------------------------------------------
+    // 1) Creation of the components of the widget
+    // Any top level sub-widget must have the panel returned by panel
+    // for parent
+             mwxRadioButton[i] = new wxRadioButton( panel, -1, lstIn[i],wxDefaultPosition, wxDefaultSize, style);
+             style=0;
+             if (In==i)
+             {
+                     mwxRadioButton[i]->SetValue(true);
+             } else {
+                     mwxRadioButton[i]->SetValue(false);
+             }
+              Connect( mwxRadioButton[i]->GetId(),  
+                   wxEVT_COMMAND_RADIOBUTTON_SELECTED, 
+                  (wxObjectEventFunction) 
+                  (void (wxPanel::*)(wxEvent&))
+                  &RadioButtonWidget::OnRadioButton ); 
+          } else {
+              mwxRadioButton[i]=NULL;
+          } // if
+    } // for 
+    
+    //---------------------------------------------------------------------
+    // 2) Insertion of the components in the window
+    
+    // We use a FlexGridSizer
+
+//EED 2018-04-18
+//    wxFlexGridSizer *sizer   = new wxFlexGridSizer(1);
+    sizer      = new wxFlexGridSizer(1);
+
+    if (title!=_T(""))
+    {
+          sizer->Add( new wxStaticText(panel,-1, title ) ); 
+    }
+    for (i=0;i<MAX_RADIOBUTTON; i++)
+    {
+       if (mwxRadioButton[i]!=NULL)
+       {
+          sizer->Add( mwxRadioButton[i],1,wxGROW ); 
+       }
+    }
+    sizer->AddGrowableCol(0);
+    panel->SetSizer(sizer);
+
+//    panel->SetAutoLayout(true);
+//    panel->Layout();
+
+
+
+  }
+
+
   //--------------------------------------------------------------------------
   //-------------------------------------------------------------------------
   //--------------------------------------------------------------------------
@@ -216,6 +289,24 @@ namespace bbwx
   { 
     bbtkDebugMessageInc("Core",9,"RadioButton::Process()"<<std::endl);
     bbtkDebugDecTab("Core",9);
+
+
+    std::vector<wxString> lstIn;
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn0()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn1()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn2()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn3()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn4()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn5()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn6()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn7()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn8()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn9()) );
+
+
+       ( (RadioButtonWidget*)bbGetOutputWidget() )->AddElements(lstIn, bbGetInputIn() , bbtk::std2wx(bbGetInputTitle()) );
+
+
   }
 
   /**
@@ -241,7 +332,7 @@ namespace bbwx
     RadioButtonWidget *w = new RadioButtonWidget(
                          this,
 //                         bbGetWxParent(),
-                                                       parent, 
+                                                parent,        
                          bbGetInputIn() ,
                          bbtk::std2wx(bbGetInputTitle()),
                          lstIn );