From: Eduardo DAVILA Date: Wed, 8 Aug 2018 13:54:11 +0000 (+0200) Subject: 3223 creaVtk Feature New Normal - vtk8itk4wx3-mingw64 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=dbe9fa3941c9e891ca5fbb5e0070ac08d53d4e7a;p=creaVtk.git 3223 creaVtk Feature New Normal - vtk8itk4wx3-mingw64 --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageCutByAxis.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageCutByAxis.cxx index 2860baa..7644642 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageCutByAxis.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageCutByAxis.cxx @@ -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; diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshCutByAxis.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshCutByAxis.cxx index 111efb5..70a8429 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshCutByAxis.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshCutByAxis.cxx @@ -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 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx index 02ae564..e9634ee 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx @@ -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; iGetWholeExtent(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;iWidthSetSpacing( 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>>>>>> 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;iGetArrayName(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();