]> Creatis software - creaVtk.git/commitdiff
3223 creaVtk Feature New Normal - vtk8itk4wx3-mingw64 vtk9itk4wx3-macos
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 8 Aug 2018 13:54:11 +0000 (15:54 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 8 Aug 2018 13:54:11 +0000 (15:54 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkImageCutByAxis.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkMeshCutByAxis.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx
lib/creaVtk/vtkVectorsVisu.cpp

index 2860baa1f9433983f356027f2e79584da319154d..764464214a8062919c0a671c851340a76c4adc8d 100644 (file)
@@ -34,7 +34,14 @@ void ImageCutByAxis::Process()
        newData->DeepCopy( bbGetInputIn() );
 
        int ext[6];
+       
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        bbGetInputIn()->GetWholeExtent(ext);
+#else
+       bbGetInputIn()->GetExtent(ext);
+#endif
+
        double dimX=ext[1]-ext[0]+1;
        double dimY=ext[3]-ext[2]+1;
        double dimZ=ext[5]-ext[4]+1;
index 111efb526a8a5b24e53b26dea94f5363cc59ee82..70a8429bff556c75a14f0b52022c6f212f9e3876 100644 (file)
@@ -39,7 +39,12 @@ void MeshCutByAxis::Process()
                vtkPlane                *clipPlane      = vtkPlane::New();      
                vtkBox                  *clipBox        = vtkBox::New();        
                vtkClipPolyData *clipper        = vtkClipPolyData::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
            clipper             -> SetInput( bbGetInputIn() );
+#else
+           clipper             -> SetInputData( bbGetInputIn() );
+#endif
                clipper->SetInsideOut( bbGetInputInsideVol() );
 
                int a;  // correction border 
index 02ae564046763bcacde94b725ca679d459af1fdf..e9634ee8169fbe19093cf0279f4ee95048cb31c0 100644 (file)
@@ -45,8 +45,7 @@ vtkImageData* ReadMHDPlane::CreateDefaultImage()
        newImage->Initialize();
        newImage->SetSpacing( 1,1,1 );
        newImage->SetDimensions(  sizeX,sizeY,sizeZ );
-       newImage->SetExtent(0,  sizeX-1,0,sizeY-1,0,sizeZ-1 );
-
+       newImage->SetExtent(0,  sizeX-1,0,sizeY-1,0,sizeZ-1 );  
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        newImage->SetWholeExtent(0,  sizeX-1,0,sizeY-1,0,sizeZ-1 );
@@ -57,7 +56,6 @@ vtkImageData* ReadMHDPlane::CreateDefaultImage()
 #else
        newImage->AllocateScalars(VTK_UNSIGNED_CHAR,1);
 #endif
-
        memset ( (void*)newImage->GetScalarPointer(), 0, sizeX*sizeY*1 );
        for (i=0; i<sizeX; i++)
        {
@@ -73,7 +71,12 @@ vtkImageData* ReadMHDPlane::ChangeOrientation(vtkImageData* imgOrg)
        int     ext[6];
        int     sizeXOrg, sizeYOrg,sizeZOrg;
        int     sizeXDst, sizeYDst,sizeZDst;
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        imgOrg->GetWholeExtent(ext);
+#else
+       imgOrg->GetExtent(ext);
+#endif
        int     sizeLine;
        
        sizeXOrg        = ext[1]-ext[0]+1;
@@ -102,14 +105,20 @@ vtkImageData* ReadMHDPlane::ChangeOrientation(vtkImageData* imgOrg)
        } // ZX
        vtkImageData *imgDst  = vtkImageData::New();
        imgDst->Initialize();
-       imgDst->SetScalarType( imgOrg->GetScalarType() );
        imgDst->SetSpacing( imgOrg->GetSpacing() );
        imgDst->SetDimensions( sizeXDst,sizeYDst,sizeZDst );
-       imgDst->SetWholeExtent(0,sizeXDst-1,0,sizeYDst-1,0,sizeZDst-1 );
        imgDst->SetExtent(0,sizeXDst-1,0,sizeYDst-1,0,sizeZDst-1 );
+       
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+       imgDst->SetWholeExtent(0,sizeXDst-1,0,sizeYDst-1,0,sizeZDst-1 );
+       imgDst->SetScalarType( imgOrg->GetScalarType() );
        imgDst->SetNumberOfScalarComponents(1);
        imgDst->AllocateScalars();
        imgDst->Update();
+#else
+       imgDst->AllocateScalars(imgOrg->GetScalarType(),1);
+#endif
 
        char *ptrDst,*ptrOrg;
        int sizeBytes = imgOrg->GetScalarSize();                
@@ -177,6 +186,7 @@ vtkImageData* ReadMHDPlane::ChangeOrientation(vtkImageData* imgOrg)
 
 void ReadMHDPlane::Read64lseek(std::string fileNameIn, std::string plane)
 {
+       int             imageType;
        int             slice;
        int             width;
        width = bbGetInputWidth();
@@ -191,9 +201,6 @@ void ReadMHDPlane::Read64lseek(std::string fileNameIn, std::string plane)
        float           ox=-1,oy=-1,oz=-1;
        long int        headersize=0;
        vtkImageData *newImage=NULL;
-
-       int imageType;
-
        char mystring[250];
        char strTmp[30];
        char strTmp2[30];
@@ -206,36 +213,32 @@ void ReadMHDPlane::Read64lseek(std::string fileNameIn, std::string plane)
                {
            strcpy(mystring,"\n");
                        fgets(mystring,250,ffIn);
-               if (strncmp("NDims",mystring,5)==0)                     { sscanf(mystring,"%s %s %d"            ,strTmp, strTmp, &dim);                                                                 }
-               if (strncmp("DimSize",mystring,6)==0)                   { sscanf(mystring,"%s %s %d %d %d"      ,strTmp, strTmp, &dimX, &dimY,&dimZ);                                   } 
-                       if (strncmp("ElementType",mystring,11)==0)              { sscanf(mystring,"%s %s %s"            ,strTmp, strTmp, strTmp2); formattype=strTmp2;                  }
-                       if (strncmp("ElementSpacing",mystring,14)==0)   { sscanf(mystring,"%s %s %f %f %f"      ,strTmp, strTmp, &spcX,&spcY,&spcZ);                                    }
-                       if (strncmp("ElementSize",mystring,11)==0)              { sscanf(mystring,"%s %s %f %f %f"      ,strTmp, strTmp, &spcX,&spcY,&spcZ);                                    }
-               if (strncmp("Offset",mystring,6)==0)                    { sscanf(mystring,"%s %s %f %f %f"      ,strTmp, strTmp, &ox, &oy, &oz);                                                }
-               if (strncmp("HeaderSize",mystring,10)==0)               { sscanf(mystring,"%s %s %ld"           ,strTmp, strTmp, &headersize);                                                  }
-                       if (strncmp("ElementDataFile",mystring,15)==0)  { sscanf(mystring,"%s %s %s"            ,strTmp, strTmp, strTmp2); elementdatafile=strTmp2;             }
-
-                       
-
-                       if (strncmp("ElementType = MET_CHAR",mystring,22)==0)                   { imageType =VTK_CHAR;                   dataSize=sizeof(char);                  }
-                       if (strncmp("ElementType = VTK_CHAR",mystring,22)==0)                   { imageType =VTK_CHAR;                   dataSize=sizeof(char);                  }
-                       if (strncmp("ElementType = MET_UCHAR",mystring,23)==0)                  { imageType =VTK_UNSIGNED_CHAR;  dataSize=sizeof(unsigned char); }
-                       if (strncmp("ElementType = VTK_UNSIGNED_CHAR",mystring,31)==0)  { imageType =VTK_UNSIGNED_CHAR;  dataSize=sizeof(unsigned char); }
-                       if (strncmp("ElementType = MET_USHORT",mystring,24)==0)                 { imageType =VTK_UNSIGNED_SHORT; dataSize=sizeof(unsigned short);}
-                       if (strncmp("ElementType = VTK_UNSIGNED_SHORT",mystring,32)==0) { imageType =VTK_UNSIGNED_SHORT; dataSize=sizeof(unsigned short);}
-                       if (strncmp("ElementType = MET_SHORT",mystring,23)==0)                  { imageType =VTK_SHORT;                  dataSize=sizeof(short);                 }
-                       if (strncmp("ElementType = VTK_SHORT",mystring,23)==0)                  { imageType =VTK_SHORT;                  dataSize=sizeof(short);                 }
-                       if (strncmp("ElementType = MET_UINT",mystring,22)==0)                   { imageType =VTK_UNSIGNED_INT;   dataSize=sizeof(unsigned int);  }
-                       if (strncmp("ElementType = VTK_UNSIGNED_INT",mystring,30)==0)   { imageType =VTK_UNSIGNED_INT;   dataSize=sizeof(unsigned int);  }
-                       if (strncmp("ElementType = MET_INT",mystring,21)==0)                    { imageType =VTK_INT;                    dataSize=sizeof(int);                   }
-                       if (strncmp("ElementType = VTK_INT",mystring,21)==0)                    { imageType =VTK_INT;                    dataSize=sizeof(int);                   }
-                       if (strncmp("ElementType = MET_FLOAT",mystring,23)==0)                  { imageType =VTK_FLOAT;                  dataSize=sizeof(float);                 }
-                       if (strncmp("ElementType = VTK_FLOAT",mystring,23)==0)                  { imageType =VTK_FLOAT;                  dataSize=sizeof(float);                 }
-                       if (strncmp("ElementType = MET_LONG",mystring,22)==0)                   { imageType =VTK_LONG;                   dataSize=sizeof(long);                  }
-                       if (strncmp("ElementType = VTK_LONG",mystring,22)==0)                   { imageType =VTK_LONG;                   dataSize=sizeof(long);                  }
-                       if (strncmp("ElementType = MET_DOUBLE",mystring,24)==0)                 { imageType =VTK_DOUBLE;                 dataSize=sizeof(double);                }
-                       if (strncmp("ElementType = VTK_DOUBLE",mystring,24)==0)                 { imageType =VTK_DOUBLE;                 dataSize=sizeof(double);                }
-
+               if (strncmp("NDims",mystring,5)==0)                                                     { sscanf(mystring,"%s %s %d"            ,strTmp, strTmp, &dim);                                                                 }
+               if (strncmp("DimSize",mystring,6)==0)                                                   { sscanf(mystring,"%s %s %d %d %d"      ,strTmp, strTmp, &dimX, &dimY,&dimZ);                                   } 
+                       if (strncmp("ElementType",mystring,11)==0)                                              { sscanf(mystring,"%s %s %s"            ,strTmp, strTmp, strTmp2); formattype=strTmp2;                  }
+                       if (strncmp("ElementSpacing",mystring,14)==0)                                   { sscanf(mystring,"%s %s %f %f %f"      ,strTmp, strTmp, &spcX,&spcY,&spcZ);                                    }
+                       if (strncmp("ElementSize",mystring,11)==0)                                              { sscanf(mystring,"%s %s %f %f %f"      ,strTmp, strTmp, &spcX,&spcY,&spcZ);                                    }
+               if (strncmp("Offset",mystring,6)==0)                                                    { sscanf(mystring,"%s %s %f %f %f"      ,strTmp, strTmp, &ox, &oy, &oz);                                                }
+               if (strncmp("HeaderSize",mystring,10)==0)                                               { sscanf(mystring,"%s %s %ld"           ,strTmp, strTmp, &headersize);                                                  }
+                       if (strncmp("ElementDataFile",mystring,15)==0)                                  { sscanf(mystring,"%s %s %s"            ,strTmp, strTmp, strTmp2); elementdatafile=strTmp2;             }
+               if (strncmp("ElementType = MET_CHAR",mystring,22)==0)                   { imageType=VTK_CHAR;                   dataSize=sizeof(char);                  }
+               if (strncmp("ElementType = VTK_CHAR",mystring,22)==0)                   { imageType=VTK_CHAR;                   dataSize=sizeof(char);                  }
+               if (strncmp("ElementType = MET_UCHAR",mystring,23)==0)                  { imageType=VTK_UNSIGNED_CHAR;  dataSize=sizeof(unsigned char); }
+               if (strncmp("ElementType = VTK_UNSIGNED_CHAR",mystring,31)==0)  { imageType=VTK_UNSIGNED_CHAR;  dataSize=sizeof(unsigned char); }
+               if (strncmp("ElementType = MET_USHORT",mystring,24)==0)                 { imageType=VTK_UNSIGNED_SHORT; dataSize=sizeof(unsigned short);}
+               if (strncmp("ElementType = VTK_UNSIGNED_SHORT",mystring,32)==0) { imageType=VTK_UNSIGNED_SHORT; dataSize=sizeof(unsigned short);}
+               if (strncmp("ElementType = MET_SHORT",mystring,23)==0)                  { imageType=VTK_SHORT;                  dataSize=sizeof(short);                 }
+               if (strncmp("ElementType = VTK_SHORT",mystring,23)==0)                  { imageType=VTK_SHORT;                  dataSize=sizeof(short);                 }
+               if (strncmp("ElementType = MET_UINT",mystring,22)==0)                   { imageType=VTK_UNSIGNED_INT;   dataSize=sizeof(unsigned int);  }
+               if (strncmp("ElementType = VTK_UNSIGNED_INT",mystring,30)==0)   { imageType=VTK_UNSIGNED_INT;   dataSize=sizeof(unsigned int);  }
+               if (strncmp("ElementType = MET_INT",mystring,21)==0)                    { imageType=VTK_INT;                    dataSize=sizeof(int);                   }
+               if (strncmp("ElementType = VTK_INT",mystring,21)==0)                    { imageType=VTK_INT;                    dataSize=sizeof(int);                   }
+               if (strncmp("ElementType = MET_FLOAT",mystring,23)==0)                  { imageType=VTK_FLOAT;                  dataSize=sizeof(float);                 }
+               if (strncmp("ElementType = VTK_FLOAT",mystring,23)==0)                  { imageType=VTK_FLOAT;                  dataSize=sizeof(float);                 }
+               if (strncmp("ElementType = MET_LONG",mystring,22)==0)                   { imageType=VTK_LONG;                   dataSize=sizeof(long);                  }
+               if (strncmp("ElementType = VTK_LONG",mystring,22)==0)                   { imageType=VTK_LONG;                   dataSize=sizeof(long);                  }
+               if (strncmp("ElementType = MET_DOUBLE",mystring,24)==0)                 { imageType=VTK_DOUBLE;                 dataSize=sizeof(double);                }
+               if (strncmp("ElementType = VTK_DOUBLE",mystring,24)==0)                 { imageType=VTK_DOUBLE;                 dataSize=sizeof(double);                }
        } // while
                fclose(ffIn);
                newImage->Initialize();
@@ -265,18 +268,19 @@ void ReadMHDPlane::Read64lseek(std::string fileNameIn, std::string plane)
                        newImage->SetDimensions(  dimX,dimY,width );
                        newImage->SetExtent(0,  dimX-1,0,dimY-1,0,width-1 );
 
+
+
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
+                       newImage->SetScalarType( imageType );
                        newImage->SetWholeExtent(0,  dimX-1,0,dimY-1,0,width-1 );
                        newImage->SetNumberOfScalarComponents(1);
-                       newImage->SetScalarType(imageType);
                        newImage->AllocateScalars();
                        newImage->Update();
 #else
-                       newImage->AllocateScalars( imageType,1 );
-#endif
-
-
+               newImage->AllocateScalars(imageType,1);
+#endif 
+                       
                        pos = dimX*dimY*(long long)slice*dataSize;
 #if defined(_WIN32)
                        if (_lseeki64( fd, pos, SEEK_SET ) < 0)
@@ -299,16 +303,18 @@ void ReadMHDPlane::Read64lseek(std::string fileNameIn, std::string plane)
                        newImage->SetSpacing( spcX,spcZ,spcY );
                        newImage->SetDimensions(  dimX,dimZ,width );
                        newImage->SetExtent(0,  dimX-1,0,dimZ-1,0,width-1 );
+                       
+
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
+                       newImage->SetScalarType( imageType );
                        newImage->SetWholeExtent(0,  dimX-1,0,dimZ-1,0,width-1 );
                        newImage->SetNumberOfScalarComponents(1);
-                       newImage->SetScalarType(imageType);
                        newImage->AllocateScalars();
                        newImage->Update();
 #else
-                       newImage->AllocateScalars( imageType, 1);
-#endif
+                       newImage->AllocateScalars(imageType,1);
+#endif 
 
                        int iWidth;
                        for (iWidth=0;iWidth<width;iWidth++)
@@ -321,17 +327,18 @@ void ReadMHDPlane::Read64lseek(std::string fileNameIn, std::string plane)
                        newImage->SetSpacing( spcY,spcZ,spcX );
                        newImage->SetDimensions(  dimY,dimZ,width );
                        newImage->SetExtent(0,  dimY-1,0,dimZ-1,0,width-1 );
+                       
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
+                       newImage->SetScalarType( imageType );
                        newImage->SetWholeExtent(0,  dimY-1,0,dimZ-1,0,width-1 );
                        newImage->SetNumberOfScalarComponents(1);
-                       newImage->SetScalarType(imageType);
                        newImage->AllocateScalars();
                        newImage->Update();
 #else
-                       newImage->AllocateScalars( imageType ,1 );
-#endif
-
+                       newImage->AllocateScalars(imageType,1);
+#endif 
+                       
                        int iWidth;
                        for (iWidth=0;iWidth<width;iWidth++)
                        {
index eee31ee946f37e4b0db21185288911eaaf46fc01..376d4036211699121b49e0d31a4b75de98b1f118 100644 (file)
@@ -38,10 +38,6 @@ vtkVectorsVisu::vtkVectorsVisu()
   :vtkVectorsTensorsVisuBase()
 {
        _vtkarrowsource         = vtkArrowSource::New();
-<<<<<<< HEAD
-       _vtklinesource          = vtkLineSource::New();
-=======
->>>>>>> master
        _vtkglyph                       = vtkGlyph3D::New();
        _vtklinesource          = vtkLineSource::New();
 
@@ -66,21 +62,13 @@ vtkVectorsVisu::~vtkVectorsVisu()
 //------------------------------------------------------------------------------
 void vtkVectorsVisu::Process()
 {
-<<<<<<< HEAD
-
-=======
->>>>>>> master
      if(_active==true)
      {
 #if VTK_MAJOR_VERSION <= 5
          _vtkglyph->SetInput( GetDataObject() );  
-<<<<<<< HEAD
 #else
          _vtkglyph->SetInputData( GetDataObject() );  
 #endif
-
-=======
->>>>>>> master
                        if(GetTypeForm()==1)                                                            // source Arrow
                        {
 #if VTK_MAJOR_VERSION <= 5
@@ -100,8 +88,6 @@ void vtkVectorsVisu::Process()
          _vtkglyph->SetScaleModeToScaleByVector();
          _vtkglyph->SetColorModeToColorByVector();
          _vtkglyph->SetScaleFactor( GetScaleFactor() );
-<<<<<<< HEAD
-
                _vtkglyph->Update();
 
 #if VTK_MAJOR_VERSION <= 5
@@ -110,10 +96,6 @@ void vtkVectorsVisu::Process()
          _pdm->SetInputData( _vtkglyph->GetOutput());
 #endif
 
-=======
-         _vtkglyph->Update();
-         _pdm->SetInput( _vtkglyph->GetOutput());
->>>>>>> master
 vtkPointData   *data   = _vtkglyph->GetOutput()->GetPointData();
 //printf("EED -------------------------------------------\n");
 //_vtkglyph->GetOutput()->Print(std::cout);
@@ -122,27 +104,9 @@ vtkPointData       *data   = _vtkglyph->GetOutput()->GetPointData();
 int i,sizeDa = data->GetNumberOfArrays();
 for (i=0;i<sizeDa;i++)
 {
-<<<<<<< HEAD
-       printf("EED vtkVectorsVisu::Process-name %d, %s \n", i, data->GetArrayName(i) );
-}
-
-//EED         _pdm->SetScalarRange( range );
-//EED         vtkPolyData      *pd                     = vGlyphFlowPlane->GetOutput();
-//EED         vtkPointData     *pointdata              = pd->GetPointData();
-//EED         vtkDataArray     *da                     = pointdata->GetVectors();
-//EED         vtkDataArray *nda = vtkFloatArray::New();
-//EED         nda->DeepCopy(da);
-//       pointdata->RemoveArray( "GlyphVector" );
-//       bbGetInputIn()->GetPointData()->RemoveArray( "GlyphVector" );
-//EED         pointdata->AddArray( nda );
-//EED         bbGetInputIn()->GetPointData()->AddArray( nda );
-//EED2         _pdm->ScalarVisibilityOn();
-
-=======
        data->GetArray(i)->Print(std::cout);
 }
 
->>>>>>> master
        _pdm->ScalarVisibilityOn();
        _pdm->SetColorModeToMapScalars();
        //_pdm->SetColorModeToDefault();