]> Creatis software - bbtk.git/blobdiff - packages/vtk/src/bbvtkSurfaceTexture.cxx
#3203 BBTK Feature New Normal vtk7itk4wx3-mingw64
[bbtk.git] / packages / vtk / src / bbvtkSurfaceTexture.cxx
index d59b7a866d2afd13f222ed180b9447bbf3fc74e9..119e612c470e8630de8e844c686f7280e5308094 100644 (file)
@@ -33,7 +33,6 @@ void SurfaceTexture::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
-printf("EED SurfaceTexture::Process Start\n");
 
        int i;
        double spc[3];
@@ -41,7 +40,15 @@ printf("EED SurfaceTexture::Process Start\n");
        int ext[6];
        bbGetInputImage()->GetSpacing(spc);
        bbGetInputImage()->GetScalarRange(range);
+
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        bbGetInputImage()->GetWholeExtent(ext);
+#else
+       bbGetInputImage()->GetExtent(ext);
+#endif
+
        int maxX = ext[1]-ext[0]+1;
        int maxY = ext[3]-ext[2]+1;
        int maxZ = ext[5]-ext[4]+1;
@@ -57,14 +64,27 @@ printf("EED SurfaceTexture::Process Start\n");
                // Create the color map
                if (bbGetInputColorType()==1)
                {
-                       colorLookupTableWL = vtkWindowLevelLookupTable::New();
-                       colorLookupTable=colorLookupTableWL;
+                       colorLookupTableWL      = vtkWindowLevelLookupTable::New();
+                       colorLookupTableWL->InverseVideoOn();
+                       colorLookupTable        = colorLookupTableWL;
                } else {
                        colorLookupTable = vtkLookupTable::New();
                }
+               colorLookupTable->SetTableRange(range[0],range[1]);
+               colorLookupTable->Build();
+               double rgba1[4];
+               double rgba2[4];
+               for (int iLookTable = 0; iLookTable<128; iLookTable++)
+               {
+                 colorLookupTable->GetTableValue(      iLookTable, rgba1);
+                 colorLookupTable->GetTableValue(256-1-iLookTable, rgba2);
+
+                 colorLookupTable->SetTableValue(256-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
+                 colorLookupTable->SetTableValue(      iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
+               } // for iLookTable
+
        }
-       colorLookupTable->SetTableRange(range[0],range[1]);
-       colorLookupTable->Build();
+
        bbGetInputMesh()->GetPointData()->SetScalars(colors);
 
        if (bbGetInputColorType()==1)
@@ -84,7 +104,7 @@ printf("EED SurfaceTexture::Process Start\n");
                bbGetInputTransform()->Update();
        }
        
-       unsigned short gl; 
+       double gl; 
        double p1[3];
        double p2[3];
        double dcolor[3];
@@ -128,9 +148,9 @@ void SurfaceTexture::bbUserSetDefaultValues()
        bbSetInputColorWindow(500);
        bbSetInputTransform(NULL);
   
-       firsttime               = true;
-       colors                  = NULL;
-       colorLookupTable        = NULL;
+       firsttime                               = true;
+       colors                                  = NULL;
+       colorLookupTable                = NULL;
        colorLookupTableWL      = NULL;
 }
 //=====