]> Creatis software - creaVtk.git/commitdiff
VectorField 2D view
authorEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Thu, 3 Jan 2019 15:58:29 +0000 (16:58 +0100)
committerEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Thu, 3 Jan 2019 15:58:29 +0000 (16:58 +0100)
12 files changed:
bbtk_creaVtk_PKG/bbs/boxes/VectorsVisu_Interface.bbg
bbtk_creaVtk_PKG/bbs/boxes/VectorsVisu_Interface.bbs
bbtk_creaVtk_PKG/bbs/boxes/VectorsVisu_Widget.bbg
bbtk_creaVtk_PKG/bbs/boxes/VectorsVisu_Widget.bbs
bbtk_creaVtk_PKG/src/bbcreaVtkVectorsVisu.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkVectorsVisu.h
lib/creaVtk/vtkImageDataStrucPoints.cpp
lib/creaVtk/vtkTensorsVisu.cpp
lib/creaVtk/vtkVectorsTensorsVisuBase.cpp
lib/creaVtk/vtkVectorsTensorsVisuBase.h
lib/creaVtk/vtkVectorsVisu.cpp
lib/creaVtk/vtkVectorsVisu.h

index 09bd8d8cb0943d33db6c629d7930739b3354d3a9..c60a0dd2f612bba237997e7588226c4f49f29a54 100644 (file)
@@ -49,7 +49,7 @@ BOX
 wx:Slider:Box01
 ISEXEC:FALSE
 -2.231532:70.499689:-900.000000
-49.168468:60.499689:-900.000000
+29.343468:60.499689:-900.000000
 PORT
 In:"100"
 PORT
@@ -83,7 +83,7 @@ BOX
 wx:LayoutTab:Box04
 ISEXEC:FALSE
 -83.037560:-20.291032:-900.000000
--25.477560:-30.291032:-900.000000
+-46.787560:-30.291032:-900.000000
 FIN_BOX
 BOX
 std:MultipleInputs:Box05
@@ -97,7 +97,7 @@ BOX
 wx:Slider:Box06
 ISEXEC:FALSE
 76.333366:74.957602:-900.000000
-127.733366:64.957602:-900.000000
+107.908366:64.957602:-900.000000
 PORT
 ChangeResolution:"true"
 PORT
@@ -128,6 +128,8 @@ ISEXEC:FALSE
 -30.731216:78.085161:-900.000000
 PORT
 In:"Line Arrow"
+PORT
+WinHeight:"50"
 FIN_BOX
 BOX
 wx:LayoutLine:Box09
index 02f5c8fd011812bd4f46fbe6cb2f3303b3855695..67df3f7ca21cd23cf830f5e565b8b23981337e7f 100644 (file)
@@ -51,6 +51,7 @@ new std:Div Box07
 
 new wx:ComboBox Box08
   set Box08.In "Line Arrow"
+  set Box08.WinHeight "50"
 
 new wx:LayoutLine Box09
   set Box09.Orientation "H"
index d47a5f17fd7420c3dde313be8e5bba49a240c9c4..b24dc42d390f4adfc67989db2edff9ca9126c799 100644 (file)
@@ -19,18 +19,22 @@ COMPLEX_PORT
 BoxChange
 -148.185967:-105.619763:-900.000000
 FIN_COMPLEX_PORT
-COMPLEXINPUTS:3
+COMPLEXINPUTS:4
 COMPLEX_PORT
 renderer
--116.813076:40.976013:-900.000000
+-115.777988:44.672757:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 vtkDataObject
--138.011324:45.349330:-900.000000
+-139.194282:43.574893:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 boxExecute
--196.920121:41.238358:-900.000000
+-196.920121:43.900014:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+orientation
+-95.893542:43.917320:-900.000000
 FIN_COMPLEX_PORT
 BOXES:3
 BOX
@@ -57,7 +61,7 @@ ISEXEC:FALSE
 PORT
 BoxProcessMode:"Reactive"
 FIN_BOX
-CONNECTIONS:11
+CONNECTIONS:12
 CONNECTION
 Box05:Opacity:Box03:Opacity
 NumberOfControlPoints:0
@@ -91,4 +95,7 @@ NumberOfControlPoints:0
 CONNECTION
 Box05:Type:Box03:TypeForm
 NumberOfControlPoints:0
+CONNECTION
+orientation:orientation:Box03:Orientation
+NumberOfControlPoints:0
 APP_END
index cddcb38c537e9ab248976f6182d21d93530ab031..032aaadee8259c463ce1ef11be9dc4b64baba8e4 100644 (file)
@@ -36,6 +36,7 @@ connect Box05.Type Box03.TypeForm
 input renderer Box03.Renderer " "
 input vtkDataObject Box03.In " "
 input boxExecute Box07.In1 " "
+input orientation Box03.Orientation " "
 
 # Complex output ports
 output BoxChange Box03.BoxChange " "
index 062e8e705e0870e3b201c616efed5c2dcfac0cd6..783fe6469e1c6b55ea136a0616e7baf440cdc3cc 100644 (file)
@@ -32,6 +32,7 @@ void VectorsVisu::Process()
      vectorsvisu.SetOpacity( bbGetInputOpacity() );
      vectorsvisu.SetRenderer( bbGetInputRenderer() );
      vectorsvisu.SetTypeForm( bbGetInputTypeForm() );
+     vectorsvisu.SetOrientation( bbGetInputOrientation() );
      vectorsvisu.Process();
      bbSetOutputOut( vectorsvisu.GetProp3D() );
   
@@ -51,6 +52,7 @@ void VectorsVisu::bbUserSetDefaultValues()
    bbSetInputScaleFactor(500);
    bbSetInputOpacity(1);
    bbSetInputTypeForm(0);  
+   bbSetInputOrientation(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)
index 27ad79c6ba950f244120585a08448b6928b10237..7c8c52c5cca527c89c4d9e07e5535a893c27e39e 100644 (file)
@@ -29,6 +29,7 @@ class bbcreaVtk_EXPORT VectorsVisu
   BBTK_DECLARE_INPUT(ScaleFactor,double);
   BBTK_DECLARE_INPUT(Opacity,double);
   BBTK_DECLARE_INPUT(TypeForm,int);
+  BBTK_DECLARE_INPUT(Orientation,int);
   BBTK_DECLARE_OUTPUT(Out,vtkProp3D*);
   BBTK_PROCESS(Process);
   void Process();
@@ -52,6 +53,7 @@ BBTK_CATEGORY("empty");
  BBTK_INPUT(VectorsVisu,Opacity,"Opacity (1 default)",double,"");
  BBTK_INPUT(VectorsVisu,Renderer,"vtkRenderer",vtkRenderer*,"");
  BBTK_INPUT(VectorsVisu,TypeForm,"0 Line, 1 Arrow   (default 0)",int,"");
+ BBTK_INPUT(VectorsVisu,Orientation,"(default 0) 0=3D, 1=xy, 2=yz, 3=xz",int,"");
  BBTK_OUTPUT(VectorsVisu,Out,"vtkProp3D of an vtkActor",vtkProp3D*,"");
 BBTK_END_DESCRIBE_BLACK_BOX(VectorsVisu);
 //===== 
index 1299cdc5c71bcac9de708eca6220b89fb085fb1f..b06c5f20c37987fb8f94e08b09ec4e2a4d0ab071 100644 (file)
@@ -52,8 +52,6 @@ void vtkImageDataStrucPoints::joinComponents(vtkImageData* imageX, vtkImageData*
        dim[0]=ext[1]-ext[0]+1;
        dim[1]=ext[3]-ext[2]+1;
        dim[2]=ext[5]-ext[4]+1; 
-       std::cout<<"dim "<< dim[0] <<" "<< dim[1] <<" "<< dim[2] <<std::endl;
-
        imageY->GetSpacing(spc);
 
 
@@ -75,7 +73,6 @@ void vtkImageDataStrucPoints::joinComponents(vtkImageData* imageX, vtkImageData*
 
   int i;
 
-printf("EED  vtkImageDataStrucPoints::joinComponents  sizeimage %d\n", sizeimage );
        for( i = 0 ; i < sizeimage ; i++ )
        {
                vx = *ptrX;
index 9a535195eb1666e548a0173ae90c2bf13490e4c3..c07942231a06686cf4cbe7c78a7dba1fb3bdece2 100644 (file)
@@ -37,7 +37,9 @@ vtkTensorsVisu::vtkTensorsVisu() : vtkVectorsTensorsVisuBase()
        ss                                      = vtkSphereSource::New();
        superquadratic          = vtkSuperquadricSource::New();
        cs                                      = vtkCubeSource::New(); 
-       tg                                      = vtkTensorGlyph::New();
+
+       tg                                      = NULL;
+
        pdn                             = vtkPolyDataNormals::New();
        pd                                      = vtkPolyData::New();
        pod                             = vtkPointData::New();
@@ -56,6 +58,8 @@ void vtkTensorsVisu::Process()
   {
        if(GetTypeForm()==2)                                                            // source superquadratic
        {
+               if (tg==NULL) { tg = vtkTensorGlyph::New(); }
+
                superquadratic->SetThetaResolution(20);
                superquadratic->SetPhiResolution(20);
 #if VTK_MAJOR_VERSION <= 5
index 3d7c20bba4595da8466fa35800fc7668c56c2e32..8da1d1a0cf5854268dc2b5e91ceb2d84de7b2200 100644 (file)
@@ -111,7 +111,7 @@ void vtkLookupTableMapDirVectorEED(vtkLookupTableDirectionVector *self, T *input
        
        
 inIncr=3;
-       printf("EED length %d  %p\n", length,input);
+//     printf("EED length %d  %p\n", length,input);
 //     mag = new double[length];
        for (i = 0; i < length; ++i)
     {
@@ -151,7 +151,7 @@ void vtkLookupTableDirectionVector::MapScalarsThroughTable2(void *input,
                                              int inputIncrement,
                                              int outputFormat)
 {
-  printf("vtkLookupTableEED::MapScalarsThroughTable2 inputIncrement=%d   inputDataType=%d\n",inputIncrement,inputDataType);
+//  printf("vtkLookupTableEED::MapScalarsThroughTable2 inputIncrement=%d   inputDataType=%d\n",inputIncrement,inputDataType);
 // if (this->UseMagnitude && inputIncrement > 1)
 // {
      switch (inputDataType)
@@ -194,6 +194,7 @@ vtkVectorsTensorsVisuBase::vtkVectorsTensorsVisuBase()
        _dataobject             = NULL;
        _renderer               = NULL;
        _typeForm               = 0;
+       _orientation    = 0;
 
        _LutEED         = vtkLookupTableDirectionVector::New();
        //_LutEED->SetVectorMode(0);
@@ -338,4 +339,16 @@ void vtkVectorsTensorsVisuBase::SetColor(std::vector<double> rgb)
        }
 }
 
+//------------------------------------------------------------------------------
+void vtkVectorsTensorsVisuBase::SetOrientation(int orientation)
+{
+       _orientation = orientation;
+}
+
+//------------------------------------------------------------------------------
+int vtkVectorsTensorsVisuBase::GetOrientation()
+{
+       return _orientation;
+}
+
 
index 831fc2ccde4b6a719f7da66562bf8ef68b7f2a47..f229542a7283f9341c04c438f496cc1063ef8d8e 100644 (file)
@@ -96,6 +96,7 @@ public :
    void                                        SetTypeForm(int);
    void                                        SetColorLaw(int);
    void                                        SetColor(std::vector<double>);
+   void                                SetOrientation(int orientation);
 
    bool                                GetActive();
    vtkDataObject*              GetDataObject();
@@ -104,6 +105,7 @@ public :
    double                              GetOpacity();
    vtkProp3D*                  GetProp3D();
    int                                 GetTypeForm();
+   int                                         GetOrientation();
 
    virtual void                Process();
    void                                VisibilityActor();
@@ -126,6 +128,7 @@ private:
        vtkDataObject                                                           *_dataobject;
        vtkRenderer                                                             *_renderer;
        int                                                                                     _typeForm;
+       int                                                                                     _orientation;
 
 protected:
        bool                                                                            _firsttime;
index 376d4036211699121b49e0d31a4b75de98b1f118..7c8a6bc1776e0d0d29ffa25e3e81e88ce74e9f8f 100644 (file)
@@ -38,8 +38,9 @@ vtkVectorsVisu::vtkVectorsVisu()
   :vtkVectorsTensorsVisuBase()
 {
        _vtkarrowsource         = vtkArrowSource::New();
-       _vtkglyph                       = vtkGlyph3D::New();
-       _vtklinesource          = vtkLineSource::New();
+       _vtkglyph                       = NULL;
+       _vtklinesource          = vtkLineSource ::New();
+       _trans                          = vtkTransform  ::New();
 
        double point1[3];
        double point2[3];
@@ -64,6 +65,19 @@ void vtkVectorsVisu::Process()
 {
      if(_active==true)
      {
+               if (_vtkglyph==NULL) 
+               {
+                       if (GetOrientation()==0)
+                       {
+                               _vtkglyph = vtkGlyph3D::New(); 
+                       } // _orientation                       
+                       if ((GetOrientation()>=1) && (GetOrientation()<=3))
+                       {
+                               _vtkglyph = vtkGlyph2D::New(); 
+                       } // _orientation                       
+               } // _vtkglyph NULL
+
+
 #if VTK_MAJOR_VERSION <= 5
          _vtkglyph->SetInput( GetDataObject() );  
 #else
@@ -101,11 +115,11 @@ vtkPointData      *data   = _vtkglyph->GetOutput()->GetPointData();
 //_vtkglyph->GetOutput()->Print(std::cout);
 //printf("EED -------------------------------------------\n");
 //data->Print(std::cout);
-int i,sizeDa = data->GetNumberOfArrays();
-for (i=0;i<sizeDa;i++)
-{
-       data->GetArray(i)->Print(std::cout);
-}
+//int i,sizeDa = data->GetNumberOfArrays();
+//for (i=0;i<sizeDa;i++)
+//{
+//     data->GetArray(i)->Print(std::cout);
+//}
 
        _pdm->ScalarVisibilityOn();
        _pdm->SetColorModeToMapScalars();
@@ -130,6 +144,27 @@ for (i=0;i<sizeDa;i++)
 #else
          _pdm->Update();
 #endif
+
+               // Orientation 0 3D     OK
+               // Orientation 1 2D xy  OK
+
+               // Orientation 2 2D yz  
+               if (GetOrientation()==2) 
+               {
+                       _trans->Identity();
+                       _trans->Translate(900,0,0);
+                       _trans->RotateWXYZ(-90,0,1,0);
+                       _actor->SetUserTransform(_trans);
+               }
+
+               // Orientation 3 2D xz  
+               if (GetOrientation()==3) 
+               {
+                       _trans->Identity();
+                       _trans->RotateWXYZ(90,1,0,0);
+                       _actor->SetUserTransform(_trans);
+               }
+
          _actor->SetMapper( _pdm );
          _actor->GetProperty()->SetOpacity( GetOpacity() );
     }// if _active
index 8fe751fb9604416d3c49fd5f04053ef976f69032..719cdc1dab38cde2307fe0bd78937313158d6792 100644 (file)
 
 #include "vtkArrowSource.h"
 #include "vtkLineSource.h"
+
 #include "vtkGlyph3D.h"
 
+#include "vtkGlyph2D.h"
+#include <vtkTransform.h>
+
 //---------------------------------------------
 // Class Name: vtkVectorsVisu
 // [classdescription]
@@ -68,7 +72,8 @@ protected:
 private:
        vtkArrowSource  *_vtkarrowsource;
        vtkLineSource   *_vtklinesource;
-       vtkGlyph3D      *_vtkglyph;
+       vtkGlyph3D              *_vtkglyph;
+       vtkTransform    *_trans; 
 };
 
 //-end of _vtkVectorsVISU_H_------------------------------------------------------