]> Creatis software - creaVtk.git/blobdiff - lib/creaVtk/vtkTensorsVisu.cpp
#3110 creaVtk Bug New Normal - branch vtk7itk4 compilation with vtk7
[creaVtk.git] / lib / creaVtk / vtkTensorsVisu.cpp
index f1a73ec92eb835c40dd4697fd3f583a5ce349131..81bcef7f573aeb36caf95b38eed7f3bd24439963 100644 (file)
 vtkTensorsVisu::vtkTensorsVisu() : vtkVectorsTensorsVisuBase()
 {
        ss                                      = vtkSphereSource::New();
-       superquadratic  = vtkSuperquadricSource::New();
+       superquadratic          = vtkSuperquadricSource::New();
        cs                                      = vtkCubeSource::New(); 
        tg                                      = vtkTensorGlyph::New();
-       pdn                                     = vtkPolyDataNormals::New();
+       pdn                             = vtkPolyDataNormals::New();
        pd                                      = vtkPolyData::New();
-       pod                                     = vtkPointData::New();
+       pod                             = vtkPointData::New();
 }
 
 //------------------------------------------------------------------------
@@ -52,6 +52,7 @@ vtkTensorsVisu::~vtkTensorsVisu()
 //------------------------------------------------------------------------
 void vtkTensorsVisu::Process()
 {
+printf("EED vtkTensorsVisu::Process() start\n");
   if (_active==true)
   {
        if(GetTypeForm()==2)                                                            // source superquadratic
@@ -86,6 +87,9 @@ void vtkTensorsVisu::Process()
        //              tg->SetScaling(25);
        tg->SetScaleFactor( GetScaleFactor() );
 
+printf("EED vtkTensorsVisu::Process() 1\n");
+
+
        //The normals are needed to generate the right colors and if
        // not used some of the glyphs are black.
 //EED 2017-01-01 Migration VTK7
@@ -93,16 +97,30 @@ void vtkTensorsVisu::Process()
        pdn->SetInput(tg->GetOutput());
        _pdm->SetInput( pdn->GetOutput() );
 #else
+printf("EED vtkTensorsVisu::Process() 1.1\n");
        pdn->SetInputData(tg->GetOutput());
+printf("EED vtkTensorsVisu::Process() 1.2\n");
        _pdm->SetInputData( pdn->GetOutput() );
+       _pdm->Update();
 #endif
+printf("EED vtkTensorsVisu::Process() 1.3\n");
        _actor->SetMapper( _pdm );
+printf("EED vtkTensorsVisu::Process() 1.4\n");
    _actor->GetProperty()->SetOpacity( GetOpacity() );
 
+
+
+
+printf("EED vtkTensorsVisu::Process() 1.5\n");
    tg->SetColorModeToEigenvalues();
 //   tg->SetColorModeToScalars();
+printf("EED vtkTensorsVisu::Process() 1.6\n");
    tg->Update();
 
+printf("EED vtkTensorsVisu::Process() 1.7\n");
+
+
+
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        pd = tg->GetOutput();
@@ -113,7 +131,9 @@ void vtkTensorsVisu::Process()
 #endif
 
        pod = pd->GetPointData();
+printf("EED vtkTensorsVisu::Process() 1.8\n");
        pod->Update();
+printf("EED vtkTensorsVisu::Process() 1.9\n");
 
        tg->Update();
        vtkPolyData             *pd_pdn                         = pdn->GetOutput();
@@ -122,6 +142,7 @@ void vtkTensorsVisu::Process()
        vtkPolyData             *pd_tg                          = tg->GetOutput();
        vtkPointData    *pointdata_tg           = pd_tg->GetPointData();
 
+printf("EED vtkTensorsVisu::Process() 1.20\n");
        vtkPolyData             *pd_do                          = (vtkPolyData*)GetDataObject();
        vtkPointData    *pointdata_do           = pd_do->GetPointData();
 
@@ -130,17 +151,25 @@ void vtkTensorsVisu::Process()
        vtkIdType numSourcePts;
 //     vtkIdType numSourceCells;
 
-       vtkPoints *sourcePts = tg->GetSource()->GetPoints();
-       numSourcePts = sourcePts->GetNumberOfPoints();
+printf("EED vtkTensorsVisu::Process() 1.22\n");
+       vtkPoints *sourcePts    = tg->GetSource()->GetPoints();
+printf("EED vtkTensorsVisu::Process() 1.23\n"); 
+
+
+       numSourcePts                    = sourcePts->GetNumberOfPoints();
 //     numSourceCells = tg->GetSource()->GetNumberOfCells();
 
+
+printf("EED vtkTensorsVisu::Process() 2\n");
+
+
        vtkDataArray *tensorsArray = pointdata_do->GetArray("tensors");
        if (tensorsArray)
    {
                vtkDoubleArray  *newScalarArray                         = vtkDoubleArray::New();
                newScalarArray->SetName( "NormalsEED" );
                newScalarArray->SetNumberOfComponents(3); 
-               int             iNumPts,iNumSourcePts;
+               int     iNumPts,iNumSourcePts;
                int             iNormalsEED=0;
                double  *normalValue;
                double   sumEigenvalue,sumEigenvalue1,sumEigenvalue2,sumEigenvalue3;
@@ -149,9 +178,9 @@ void vtkTensorsVisu::Process()
                for (iNumPts=0;iNumPts<numPnts;iNumPts++)
                {
                        normalValue = tensorsArray->GetTuple9(iNumPts);
-         sumEigenvalue1 = sqrt (normalValue[0]*normalValue[0] + normalValue[1]*normalValue[1] + normalValue[2]*normalValue[2]);
-         sumEigenvalue2 = sqrt (normalValue[3]*normalValue[3] + normalValue[4]*normalValue[4] + normalValue[5]*normalValue[5]);
-         sumEigenvalue3 = sqrt (normalValue[6]*normalValue[6] + normalValue[7]*normalValue[7] + normalValue[8]*normalValue[8]);
+               sumEigenvalue1 = sqrt (normalValue[0]*normalValue[0] + normalValue[1]*normalValue[1] + normalValue[2]*normalValue[2]);
+               sumEigenvalue2 = sqrt (normalValue[3]*normalValue[3] + normalValue[4]*normalValue[4] + normalValue[5]*normalValue[5]);
+               sumEigenvalue3 = sqrt (normalValue[6]*normalValue[6] + normalValue[7]*normalValue[7] + normalValue[8]*normalValue[8]);
 
                        if ((sumEigenvalue1>=sumEigenvalue2) && (sumEigenvalue1>=sumEigenvalue3))
                        {
@@ -181,6 +210,8 @@ void vtkTensorsVisu::Process()
                        } // for iNumSourcePts
 
                } // for iNumPts
+
+
                pointdata_tg->RemoveArray( "NormalsEED" );
                pointdata_tg->AddArray( newScalarArray );
 //             pointdata_pdn->Update();
@@ -189,6 +220,10 @@ void vtkTensorsVisu::Process()
 
 
 
+
+
+printf("EED vtkTensorsVisu::Process() 3\n");
+
        _pdm->ScalarVisibilityOn();
        _pdm->SetColorModeToMapScalars();
        //_pdm->SetColorModeToDefault();
@@ -202,6 +237,12 @@ void vtkTensorsVisu::Process()
        _pdm->SetLookupTable( _LutEED );
        _pdm->SelectColorArray( "NormalsEED" );
 
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+  //...
+#else
+       _pdm->Update();
+#endif
 
 /*
                        int i,sizeDa = pointdata_tg->GetNumberOfArrays();
@@ -217,8 +258,12 @@ void vtkTensorsVisu::Process()
 
 
   } // _active
+printf("EED vtkTensorsVisu::Process() 4\n");
 
     VisibilityActor(); 
 
+printf("EED vtkTensorsVisu::Process() END\n");
+
+
 }