]> Creatis software - creaVtk.git/commitdiff
#3266 creaMaracasVisu Feature New Normal - ManualContour_Box by segments
authorEduardo DAVILA <davila@localhost.localdomain>
Thu, 4 Jul 2019 07:31:51 +0000 (09:31 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Thu, 4 Jul 2019 07:31:51 +0000 (09:31 +0200)
lib/creaVtk/vtkImageDataStrucPoints.cpp
lib/creaVtk/vtkVectorsTensorsVisuBase.cpp
lib/creaVtk/vtkVectorsVisu.cpp

index 426d760118b1c0dce4f931d764d51bd9ff3c2292..0649c5e85e1e2b64d24e223f712c67c4f8324b48 100644 (file)
@@ -43,114 +43,121 @@ void vtkImageDataStrucPoints::joinComponents(vtkImageData* imageX,  vtkImageData
 {
 printf("EED vtkImageDataStrucPoints::joinComponents Start \n");
 
-       int ext[6];
-       imageY->Modified();
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
-       imageY->Update();
-       imageY->GetWholeExtent(ext);
-#else
-       imageY->GetExtent(ext);
-#endif
-       int dim[3];
-       double spc[3];
-       dim[0]=ext[1]-ext[0]+1;
-       dim[1]=ext[3]-ext[2]+1;
-       dim[2]=ext[5]-ext[4]+1; 
-       imageY->GetSpacing(spc);
-       double *ptrX=NULL,  *ptrY=NULL,  *ptrZ=NULL;
-       double *ptrD1=NULL, *ptrD2=NULL, *ptrD3=NULL, *ptrD4=NULL, *ptrD5=NULL, *ptrD6=NULL;
-       
-       if (imageX!=NULL)  ptrX  = (double *)imageX->GetScalarPointer();
-       if (imageY!=NULL)  ptrY  = (double *)imageY->GetScalarPointer();
-       if (imageZ!=NULL)  ptrZ  = (double *)imageZ->GetScalarPointer();
-       if (Data1 !=NULL)  ptrD1 = (double *)Data1->GetScalarPointer();
-       if (Data2 !=NULL)  ptrD2 = (double *)Data2->GetScalarPointer();
-       if (Data3 !=NULL)  ptrD3 = (double *)Data3->GetScalarPointer();
-       if (Data4 !=NULL)  ptrD4 = (double *)Data4->GetScalarPointer();
-       if (Data5 !=NULL)  ptrD5 = (double *)Data5->GetScalarPointer();
-       if (Data6 !=NULL)  ptrD6 = (double *)Data6->GetScalarPointer();
-
-       long int sizeimage = dim[0]*dim[1]*dim[2];
-       int components=3;
-//     if ((Data1!=NULL) && (Data2==NULL) && (Data3==NULL) && (Data4==NULL) && (Data5==NULL) && (Data6==NULL) )  { components=4; }
-//     if ((Data1!=NULL) && (Data2!=NULL) && (Data3!=NULL) && (Data4==NULL) && (Data5==NULL) && (Data6==NULL) )  { components=6; }
-//     if ((Data1!=NULL) && (Data2!=NULL) && (Data3!=NULL) && (Data4!=NULL) && (Data5!=NULL) && (Data6!=NULL) )  { components=9; }
-       vtkDoubleArray *array =  vtkDoubleArray::New();
-       array->SetNumberOfTuples(sizeimage);
-       array->SetNumberOfComponents(components);
-       array->Allocate(sizeimage*components, 100 ); // ???
-       array->SetName("velocity");
-
-       vtkDoubleArray *array2 =  vtkDoubleArray::New();
-       array2->SetNumberOfTuples(sizeimage);
-       array2->SetNumberOfComponents(1);
-       array2->Allocate(sizeimage*1, 100 ); // ???
-       array2->SetName("angle");
-
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
-
-       double vx,vy,vz,d1=0,d2=0,d3=0,d4=0,d5=0,d6=0;
-       int i;
-       for( i = 0 ; i < sizeimage ; i++ )
-       {
-               if (ptrX !=NULL)        { vx = *ptrX;   ptrX++; }       else { vx=0; }
-               if (ptrY !=NULL)        { vy = *ptrY;   ptrY++; }       else { vy=0; }
-               if (ptrZ !=NULL)        { vz = *ptrZ;   ptrZ++; }       else { vz=0; }
-               if (ptrD1!=NULL)        { d1 = *ptrD1;  ptrD1++;} 
-               if (ptrD2!=NULL)        { d2 = *ptrD2;  ptrD2++;} 
-               if (ptrD3!=NULL)        { d3 = *ptrD3;  ptrD3++;} 
-               if (ptrD4!=NULL)        { d4 = *ptrD4;  ptrD4++;} 
-
-       if (components==3)      { array->SetTuple3(i,vx,vy,vz);                         }
-       if (components==3)      { array2->SetTuple1(i,d1);                      }
-//     if (components==4)      { array->SetTuple4(i,vx,vy,vz,d1);                      }
-//     if (components==6)      { array->SetTuple6(i,vx,vy,vz,d1,d2,d3);        }
-//     if (components==9)      { array->SetTuple9(i,vx,vy,vz,d1,d2,d3,d4,d5,d6); }
-       } // for i
-
-       _structuredPoints = vtkStructuredPoints::New();
-       _structuredPoints->SetDimensions(dim[0], dim[1], dim[2]);
-       _structuredPoints->SetSpacing(spc);
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
-       _structuredPoints->SetScalarTypeToDouble();
-       _structuredPoints->SetNumberOfScalarComponents(3);
-#else
-       vtkInformation* info=_structuredPoints->GetInformation();
-       vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_DOUBLE, 3);
-
-#endif
-
-       _structuredPoints->GetPointData()->SetVectors(array);
-       _structuredPoints->GetPointData()->AddArray(array2);
-       _structuredPoints->GetPointData()->SetNumberOfTuples(sizeimage);
-       _structuredPoints->Modified();
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
-       _structuredPoints->Update();
-#else
-  //...
-#endif
+       if ((imageX!=NULL) && (imageY!=NULL) && (imageZ!=NULL) )
+       { 
+                       int ext[6];
+                       imageY->Modified();
+               //EED 2017-01-01 Migration VTK7
+               #if VTK_MAJOR_VERSION <= 5
+                       imageY->Update();
+                       imageY->GetWholeExtent(ext);
+               #else
+                       imageY->GetExtent(ext);
+               #endif
+                       int dim[3];
+                       double spc[3];
+                       dim[0]=ext[1]-ext[0]+1;
+                       dim[1]=ext[3]-ext[2]+1;
+                       dim[2]=ext[5]-ext[4]+1; 
+                       imageY->GetSpacing(spc);
+                       double *ptrX=NULL,  *ptrY=NULL,  *ptrZ=NULL;
+                       double *ptrD1=NULL, *ptrD2=NULL, *ptrD3=NULL, *ptrD4=NULL, *ptrD5=NULL, *ptrD6=NULL;
+                       
+                       if (imageX!=NULL)  ptrX  = (double *)imageX->GetScalarPointer();
+                       if (imageY!=NULL)  ptrY  = (double *)imageY->GetScalarPointer();
+                       if (imageZ!=NULL)  ptrZ  = (double *)imageZ->GetScalarPointer();
+                       if (Data1 !=NULL)  ptrD1 = (double *)Data1->GetScalarPointer();
+                       if (Data2 !=NULL)  ptrD2 = (double *)Data2->GetScalarPointer();
+                       if (Data3 !=NULL)  ptrD3 = (double *)Data3->GetScalarPointer();
+                       if (Data4 !=NULL)  ptrD4 = (double *)Data4->GetScalarPointer();
+                       if (Data5 !=NULL)  ptrD5 = (double *)Data5->GetScalarPointer();
+                       if (Data6 !=NULL)  ptrD6 = (double *)Data6->GetScalarPointer();
+
+                       long int sizeimage = dim[0]*dim[1]*dim[2];
+                       int components=3;
+               //      if ((Data1!=NULL) && (Data2==NULL) && (Data3==NULL) && (Data4==NULL) && (Data5==NULL) && (Data6==NULL) )  { components=4; }
+               //      if ((Data1!=NULL) && (Data2!=NULL) && (Data3!=NULL) && (Data4==NULL) && (Data5==NULL) && (Data6==NULL) )  { components=6; }
+               //      if ((Data1!=NULL) && (Data2!=NULL) && (Data3!=NULL) && (Data4!=NULL) && (Data5!=NULL) && (Data6!=NULL) )  { components=9; }
+                       vtkDoubleArray *array =  vtkDoubleArray::New();
+                       array->SetNumberOfTuples(sizeimage);
+                       array->SetNumberOfComponents(components);
+                       array->Allocate(sizeimage*components, 100 ); // ???
+                       array->SetName("velocity");
+
+                       vtkDoubleArray *array2 =  vtkDoubleArray::New();
+                       array2->SetNumberOfTuples(sizeimage);
+                       array2->SetNumberOfComponents(1);
+                       array2->Allocate(sizeimage*1, 100 ); // ???
+                       array2->SetName("angle");
+
+               printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
+               printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
+               printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
+               printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
+               printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
+               printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents  Limpiar este codigo ........ \n");
+
+                       double vx,vy,vz,d1=0,d2=0,d3=0,d4=0,d5=0,d6=0;
+                       int i;
+                       for( i = 0 ; i < sizeimage ; i++ )
+                       {
+                               if (ptrX !=NULL)        { vx = *ptrX;   ptrX++; }       else { vx=0; }
+                               if (ptrY !=NULL)        { vy = *ptrY;   ptrY++; }       else { vy=0; }
+                               if (ptrZ !=NULL)        { vz = *ptrZ;   ptrZ++; }       else { vz=0; }
+                               if (ptrD1!=NULL)        { d1 = *ptrD1;  ptrD1++;} 
+                               if (ptrD2!=NULL)        { d2 = *ptrD2;  ptrD2++;} 
+                               if (ptrD3!=NULL)        { d3 = *ptrD3;  ptrD3++;} 
+                               if (ptrD4!=NULL)        { d4 = *ptrD4;  ptrD4++;} 
+
+                               if (components==3)      { array->SetTuple3(i,vx,vy,vz);                         }
+                               if (components==3)      { array2->SetTuple1(i,d1);                      }
+               //      if (components==4)      { array->SetTuple4(i,vx,vy,vz,d1);                      }
+               //      if (components==6)      { array->SetTuple6(i,vx,vy,vz,d1,d2,d3);        }
+               //      if (components==9)      { array->SetTuple9(i,vx,vy,vz,d1,d2,d3,d4,d5,d6); }
+                       } // for i
+
+                       _structuredPoints = vtkStructuredPoints::New();
+                       _structuredPoints->SetDimensions(dim[0], dim[1], dim[2]);
+                       _structuredPoints->SetSpacing(spc);
+
+               //EED 2017-01-01 Migration VTK7
+               #if VTK_MAJOR_VERSION <= 5
+                       _structuredPoints->SetScalarTypeToDouble();
+                       _structuredPoints->SetNumberOfScalarComponents(3);
+               #else
+                       vtkInformation* info=_structuredPoints->GetInformation();
+                       vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_DOUBLE, 3);
+
+               #endif
+
+                       _structuredPoints->GetPointData()->SetVectors(array);
+                       _structuredPoints->GetPointData()->AddArray(array2);
+                       _structuredPoints->GetPointData()->SetNumberOfTuples(sizeimage);
+                       _structuredPoints->Modified();
+               //EED 2017-01-01 Migration VTK7
+               #if VTK_MAJOR_VERSION <= 5
+                       _structuredPoints->Update();
+               #else
+                 //...
+               #endif
+
+               /*
+                       _structuredPoints->Print(cout);
+                  vtkStructuredPointsWriter *writer2 = vtkStructuredPointsWriter::New();
+                       writer2->SetFileName("/home/davila/tmp/VectorfromCal_EED_ups.vtk");
+                       //writer->SetFileTypeToBinary();
+                       writer2->SetFileTypeToASCII();
+                       writer2->SetTensorsName("VectorfromCal");
+                       writer2->SetFieldDataName("GlyphVector");
+                       writer2->SetScalarsName("Scalar");
+                       writer2->SetInput(_structuredPoints);  
+                       writer2->Write();  
+               */
+
+       } else { 
+               printf("EED Warnning!  vtkImageDataStrucPoints::joinComponents  imageX or image Y or image Z is EMPTY\n");
+       } // imageX imageY imageZ
 
-/*
-       _structuredPoints->Print(cout);
-   vtkStructuredPointsWriter *writer2 = vtkStructuredPointsWriter::New();
-       writer2->SetFileName("/home/davila/tmp/VectorfromCal_EED_ups.vtk");
-       //writer->SetFileTypeToBinary();
-       writer2->SetFileTypeToASCII();
-       writer2->SetTensorsName("VectorfromCal");
-       writer2->SetFieldDataName("GlyphVector");
-       writer2->SetScalarsName("Scalar");
-       writer2->SetInput(_structuredPoints);  
-       writer2->Write();  
-*/
 
 
 printf("EED vtkImageDataStrucPoints::joinComponents End\n");
index 3c1addcac10148cd08e6da020b6edbf1186a8922..c591a5f9beceaf7413a0cab2d0f1242756f1865d 100644 (file)
@@ -105,43 +105,16 @@ void vtkLookupTableMapDirVectorEED(vtkLookupTableDirectionVector *self, T *input
                           int inIncr, int outFormat)
 {
        double tmp,sum;
-//     double *mag;
        int i, j;
        double dirx,diry,dirz;
        double angle;
-
-       printf("EED vtkLookupTableMapDirVectorEED inIncr=%d  \n", inIncr);
-
-
-//     mag = new double[length];
        for (i = 0; i < length; ++i)
     {
-
-
-       if (1==1){
                        dirx    = static_cast<T>(input[0]);
                        diry    = static_cast<T>(input[1]);
                        dirz    = static_cast<T>(input[2]);
                        input   = input+inIncr;
                        sum             = sqrt( dirx*dirx + diry*diry + dirz*dirz );
-
-       /*
-                       dirx    = 0;
-                       diry    = 0;
-                       dirz    = 0;
-                       sum             = 0;
-                       for (j = 0; j < inIncr; ++j)
-                       {
-                               if (j==0) dirx= static_cast<T>(*input);  
-                               if (j==1) diry= static_cast<T>(*input);  
-                               if (j==2) dirz= static_cast<T>(*input);  
-                               tmp = static_cast<T>(*input);  
-                               sum += (tmp * tmp);
-                               ++input;
-                       }
-                       sum=sqrt(sum);
-       */
-
                        *output++ = (unsigned char) abs( (255*dirx/sum) );
                        *output++ = (unsigned char) abs( (255*diry/sum) );
                        *output++ = (unsigned char) abs( (255*dirz/sum) );
@@ -149,30 +122,7 @@ void vtkLookupTableMapDirVectorEED(vtkLookupTableDirectionVector *self, T *input
        //              printf("%d %d %d   ",(int)(255*dirx/sum),(int)(255*diry/sum),(int)(255*dirz/sum));
        //              printf(" C     %d        %f %f %f   \n",inIncr,dirx,diry,dirz);
 
-               } // type 1 color vector by direction
-
-
-               if (2==0){
-                               angle   = static_cast<T>(input[0]);
-                               input   = input+inIncr;
-
-                               *output++ = (unsigned char) abs( 255*angle/90 );
-                               *output++ = (unsigned char) abs( 0 );
-                               *output++ = (unsigned char) abs( 0 );
-                               *output++ = 255;
-               //              printf("%d %d %d   ",(int)(255*dirx/sum),(int)(255*diry/sum),(int)(255*dirz/sum));
-               //              printf(" C     %d        %f %f %f   \n",inIncr,dirx,diry,dirz);
-
-               }// type 2 color vector by scalar
-       
-
        } // for
-
-//     vtkLookupTableMapData(self, mag, output, length, 1, outFormat);
-       
-//     delete [] mag;
-
-
 }
 
 
@@ -184,7 +134,6 @@ void vtkLookupTableDirectionVector::MapScalarsThroughTable2(void *input,
                                              int inputIncrement,
                                              int outputFormat)
 {
-  printf("vtkLookupTableEED::MapScalarsThroughTable2 \n");
 // if (this->UseMagnitude && inputIncrement > 1)
 // {
      switch (inputDataType)
@@ -388,8 +337,6 @@ int vtkVectorsTensorsVisuBase::GetOrientation()
 //------------------------------------------------------------------------------
 void vtkVectorsTensorsVisuBase::SetExternalLut(vtkScalarsToColors* lut)
 {
-printf("EED vtkVectorsTensorsVisuBase::SetExternalLut C ptrlut %p  this:%p\n",lut, this);
        _externalLut=lut;
-printf("EED vtkVectorsTensorsVisuBase::SetExternalLut D ptrlut %p \n",_externalLut);
 }
 
index 88eb4d2fb72c4f2afbed117ce00f06b0cb363705..c29dace97f7f3ddbccc12d64f61bc51ba4331aa1 100644 (file)
@@ -135,7 +135,6 @@ vtkPointData        *data   = _vtkglyph->GetOutput()->GetPointData();
 
                if (_externalLut==NULL)
                {
-printf("EED vtkVectorsVisu::Process   LutEED  \n");
                        _pdm->ScalarVisibilityOn();
                        _pdm->SetColorModeToMapScalars();
                //      _pdm->SetColorModeToDefault();
@@ -149,12 +148,8 @@ printf("EED vtkVectorsVisu::Process   LutEED  \n");
          _pdm->SetLookupTable( _LutEED );
          _pdm->SelectColorArray( "GlyphVector" );
                } else {
-printf("EED vtkVectorsVisu::Process   ExternalLut  \n");
                        data->SetActiveScalars("angle");
 
-
-
-
                        _pdm->ScalarVisibilityOn(); 
                        double scalarRange[2];
                        scalarRange[0]=0;
@@ -174,14 +169,13 @@ printf("EED warnnning  .....  vtkVectorsVisu::Process   clean scalar Range .....
                 _pdm->SelectColorArray( "angle" );
                }  // if _externalLut
 
-
-
 printf("EED warnnning  .....  vtkVectorsVisu::Process   Clean angle ......\n");
 printf("EED warnnning  .....  vtkVectorsVisu::Process   Clean angle ......\n");
 printf("EED warnnning  .....  vtkVectorsVisu::Process   Clean angle ......\n");
 printf("EED warnnning  .....  vtkVectorsVisu::Process   Clean angle ......\n");
 printf("EED warnnning  .....  vtkVectorsVisu::Process   Clean angle ......\n");
 
+/*
 _vtkglyph->Update();
 vtkPointData *pointdata=_vtkglyph->GetOutput()->GetPointData();
 int i,size=pointdata->GetNumberOfArrays();
@@ -190,7 +184,7 @@ for (i=0;i<size;i++)
        vtkDataArray *array=pointdata->GetArray(i);
        printf(" vtkVectorsVisu::Process array name %d:<%s>  size:%d\n", i, array->GetName(), array->GetSize() );
 }
-
+*/
 
 
 //       vSliceMapperVec->SetLookupTable( vGreenToRedLut );