]> Creatis software - bbtk.git/commitdiff
#3212 BBTK Feature New Normal - vtk8itk4wx3-mingw64
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Tue, 7 Aug 2018 13:28:32 +0000 (15:28 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Tue, 7 Aug 2018 13:28:32 +0000 (15:28 +0200)
1  2 
packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx
packages/vtk/src/bbvtkCreateImage.cxx
packages/vtk/src/bbvtkImageBoundaries.cxx
packages/vtk/src/bbvtkImagePlanes.cxx
packages/vtk/src/bbvtkImageVtkProperties.cxx
packages/vtk/src/bbvtkInversCrop.cxx
packages/vtk/src/bbvtkPolyDataToActor.cxx
packages/vtk/src/bbvtkSliceImage.cxx
packages/vtk/src/bbvtkSurfaceTexture.cxx

index c1d16ba58fb15afc84ccce9badb0f3705362fa51,faabc03cf6eca63b458e6c3cfe119ddf5864f823..39ff153e69dc68fc743921f10c94b4f4f0f2ba66
@@@ -146,11 -139,9 +146,9 @@@ void GetXCoherentInfoGdcmReader::Proces
     // Should only contain one!
     l = sh->GetFirstSingleSerieUIDFileSet();
  
-    int nbFiles;
-    double zspacing    = 0.;
-    nbFiles                    = l->size() ;
+    double zspacing = 0.;
     sh->OrderFileList(l); // this one should compute the *actual* Z Spacing!
 -   zspacing = sh->GetZSpacing();
 +   zspacing           = sh->GetZSpacing();
     std::vector<double> v_pixelspacing;
     v_pixelspacing.push_back( f->GetXSpacing() );
     v_pixelspacing.push_back( f->GetYSpacing() );
     //reader->SetFileName( bbGetInputIn().c_str() );
     reader->SetCoherentFileList(l);
     reader->Update();
- printf("EED GetXCoherentInfoGdcmReader::Process \n");
 +   reader->GetOutput();
 +
     bbSetOutputOut( reader->GetOutput() );
  }
  #endif
index cb9d77bf0d920e156f4de703db005274e643e7f3,c5f71b5fa96406085fd4901905d020c7d9025e90..007c34718cc779e17897a44f3ddd81ec35f4dddc
@@@ -53,10 -53,9 +53,10 @@@ void CreateImage::Process(
  //    * TYPE is the C++ type of the input/output
  //      (the one provided in the attribute 'type' of the tag 'input')
  
-       double  spc[6];
+       double  spc[3];
        int             dim[3]; 
        int             outputformat = VTK_UNSIGNED_SHORT;
 +      
        if (bbGetInputOutputFormat()=="VTK_BIT")                                        outputformat = VTK_BIT;                 // 1
        else if (bbGetInputOutputFormat()=="VTK_CHAR")                          outputformat = VTK_CHAR;                                // 2
        else if (bbGetInputOutputFormat()=="MET_CHAR")                          outputformat = VTK_CHAR;                                // 2
        else if (bbGetInputOutputFormat()=="MET_FLOAT")                         outputformat = VTK_FLOAT;               // 10
        else if (bbGetInputOutputFormat()=="VTK_DOUBLE")                        outputformat = VTK_DOUBLE;              // 11           
        else if (bbGetInputOutputFormat()=="MET_DOUBLE")                        outputformat = VTK_DOUBLE;              // 11  
 +
        spc[0] = bbGetInputSpacing()[0];
        spc[1] = bbGetInputSpacing()[1];
        spc[2] = bbGetInputSpacing()[2];
        dim[0] =  bbGetInputDimensions()[0];
        dim[1] =  bbGetInputDimensions()[1];
        dim[2] =  bbGetInputDimensions()[2];
-       
+       if ((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0))
+       {
+               dim[0]=1;
+               dim[1]=1;
+               dim[2]=1;
+       }
+       if ((spc[0]<=0)||(spc[1]<=0)||(spc[2]<=0))
+       {
+               spc[0]=1;
+               spc[1]=1;
+               spc[2]=1;
+       }
+ //EED 2017-12-7
+       if (imageoutput!=NULL) 
+       {
+               imageoutput->Delete();
+       }       
+       imageoutput = vtkImageData::New();
        imageoutput->Initialize();
 -      imageoutput->SetScalarType( outputformat );     
        imageoutput->SetSpacing( spc );
        imageoutput->SetDimensions(  dim[0], dim[1], dim[2] );
 +
 +//EED 2017-01-01 Migration VTK7
 +#if (VTK_MAJOR_VERSION <= 5) 
 +      imageoutput->SetScalarType( outputformat );     
        imageoutput->AllocateScalars();
 +#endif
 +#if (VTK_MAJOR_VERSION >= 6) 
 +      imageoutput->AllocateScalars( outputformat,1 );
 +#endif
 +      
        int i,j,k;
        long sizeBlock; 
 +
        for (i=0; i<dim[0]; i++)
        {
                imageoutput->SetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() );
        {
                memcpy(  imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer()  , sizeBlock );
        } // for k
++      
 +
 +//EED 2017-01-01 Migration VTK7
 +#if (VTK_MAJOR_VERSION <= 5) 
        imageoutput->Update();
 +#endif
 +#if (VTK_MAJOR_VERSION >= 6) 
 +      // ..
 +#endif
 +
        imageoutput->Modified();
        bbSetOutputOut(imageoutput);
  }     
index 6f2808219c3faf75f60d7a828e03adbe58aedaca,d3cd9d4040fca938bd84fa6ed9446927fb706c20..9f6bc7d20c36e4fce83d2c320fcfe4eaca8c1fdb
@@@ -474,33 -402,17 +476,34 @@@ namespace bbvt
                        plane3pts->SetPoint2((origin[0]+vect2[0]*factor)*xSpacing,
                                                                        (origin[1]+vect2[1]*factor)*ySpacing,
                                                                        (origin[2]+vect2[2]*factor)*zSpacing);
 +
 +//EED 2017-01-01 Migration VTK7
 +#if (VTK_MAJOR_VERSION <= 5) 
                        plane3pts->GetResliceOutput()->Update();
 +#endif
 +#if (VTK_MAJOR_VERSION >= 6) 
 +                      // ..
 +#endif
 +
  //To get the slice of image out of the selected volume
-                       if (_imageReslicer==NULL){
+                       if (_imageReslicer==NULL)
+                       {
                                _imageReslicer = vtkImageReslice::New();                                        
                                _imageReslicer->SetOutputDimensionality(2);
                                _transform = vtkTransform::New();
                                _matrix = vtkMatrix4x4::New();  
-                       }
+                       } // if
                        _imageReslicer->SetInterpolationMode( bbGetInputInterpolation() );
 +
 +//EED 2017-01-01 Migration VTK7
 +#if (VTK_MAJOR_VERSION <= 5) 
                        _imageReslicer->SetInput( bbGetInputIn() );
 +#endif
 +#if (VTK_MAJOR_VERSION >= 6) 
 +                      _imageReslicer->SetInputData( bbGetInputIn() );
 +#endif
 +
 +
                        _imageReslicer->SetInformationInput(bbGetInputIn());    
                        //fill out the information with the created vectors and using the spacing of the image
                        _imageReslicer->SetResliceAxesDirectionCosines(newx[0]*xSpacing,newx[1]*xSpacing,newx[2]*xSpacing,
index 50506435bc6026d0c686b66b98c97fd684551874,2057727a9a88ada2d54699fd003f226efafa8840..a065023d1f2d8d09bd310d200bea42574d90890f
@@@ -53,16 -55,8 +55,15 @@@ void ImageVtkProperties::Process(
        if ( bbGetInputIn() )
        {
                bbGetInputIn()->Modified();
-               
 +//EED 2017-01-01 Migration VTK7
 +#if (VTK_MAJOR_VERSION <= 5) 
                bbGetInputIn()->Update();
                bbGetInputIn()->GetWholeExtent(ext);
 +#endif
 +#if (VTK_MAJOR_VERSION >= 6) 
 +              bbGetInputIn()->GetExtent(ext);
 +#endif
 +
                vsize.push_back(ext[1]-ext[0]+1);
                vsize.push_back(ext[3]-ext[2]+1);
                vsize.push_back(ext[5]-ext[4]+1);
index 8581943820eb2e983ad2861975efcda79f2223cb,75d4e53e57574644639ce0b071309679adda11a4..29be94cabe1ed7bd18a5b9e3f2b6b89130773987
@@@ -26,106 -26,92 +26,162 @@@ void InversCrop::Process(
  //    * TYPE is the C++ type of the input/output
  //      (the one provided in the attribute 'type' of the tag 'input')
  
-     if ((bbGetInputImageFix()!=NULL) && (bbGetInputImageMove()!=NULL) )
-     {
-      if ( bbGetInputImageFix()->GetScalarType()==bbGetInputImageMove()->GetScalarType() ) 
-      {
-         // Creating Image
-       int dim[3];
-       int ext[6];
+       if (bbGetInputActive()==true)
+       {
+           if ( (bbGetInputImageFix()!=NULL) && (bbGetInputImageMove()!=NULL) )
+           {
+            if ( bbGetInputImageFix()->GetScalarType()==bbGetInputImageMove()->GetScalarType() ) 
+            {
+               // Creating Image
+               int dim[3];
+               int ext[6];
        
 -              bbGetInputImageFix()->GetWholeExtent(ext);
 -              dim[0]= ext[1]-ext[0]+1;
 -              dim[1]= ext[3]-ext[2]+1;
 -              dim[2]= ext[5]-ext[4]+1;
 +//EED 2017-01-01 Migration VTK7
 +#if (VTK_MAJOR_VERSION <= 5) 
 +      bbGetInputImageFix()->GetWholeExtent(ext);
 +#endif
 +#if (VTK_MAJOR_VERSION >= 6) 
 +      bbGetInputImageFix()->GetExtent(ext);
 +#endif
 +      dim[0]= ext[1]-ext[0]+1;
 +      dim[1]= ext[3]-ext[2]+1;
 +      dim[2]= ext[5]-ext[4]+1;
  
 -              if (bbGetInputType()==0)
 +      if (bbGetInputType()==0)
 +      {
 +              _imageoutput = vtkImageData::New();
 +              _imageoutput->Initialize();
 +              _imageoutput->SetSpacing( bbGetInputImageFix()->GetSpacing() );
 +              _imageoutput->SetDimensions(  dim[0], dim[1], dim[2] );
 +//EED 2017-01-01 Migration VTK7
 +#if (VTK_MAJOR_VERSION <= 5) 
 +              _imageoutput->SetScalarType( bbGetInputImageFix()->GetScalarType() );
 +              _imageoutput->AllocateScalars();
 +#endif
 +#if (VTK_MAJOR_VERSION >= 6) 
 +              _imageoutput->AllocateScalars(bbGetInputImageFix()->GetScalarType() , 1);
 +#endif
 +      }
 +      if (bbGetInputType()==1)
 +      {
 +              _imageoutput=bbGetInputImageFix();
 +      }
 +
 +
 +        // Duplicating Fix Image
 +      long sizeimage = dim[0]*dim[1]*dim[2]*bbGetInputImageFix()->GetScalarSize();    
 +      memcpy( _imageoutput->GetScalarPointer() , bbGetInputImageFix()->GetScalarPointer() , sizeimage);
 +
 +      // Copy the Move Image
 +      int j,k; 
 +      int px,py,pz;
 +
 +//EED 2017-01-01 Migration VTK7
 +#if (VTK_MAJOR_VERSION <= 5) 
 +      bbGetInputImageMove()->GetWholeExtent(ext);
 +#endif
 +#if (VTK_MAJOR_VERSION >= 6) 
 +      bbGetInputImageMove()->GetExtent(ext);
 +#endif
 +
 +      int dimMoveX = ext[1]-ext[0]+1;
 +      int dimMoveY = ext[3]-ext[2]+1;
 +      int dimMoveZ = ext[5]-ext[4]+1;
 +
 +        int spxM=0;  // start px MoveImage
 +        int sizeXM=0;  // sizeX MoveImage
 +
 +      px=bbGetInputOrigin()[0];
 +        spxM=0;
 +        if (px<=0)
 +      { 
 +         spxM=px*(-1);
 +         px=0;
 +      }
 +      sizeXM = dimMoveX-spxM;
 +      if (px+sizeXM>=dim[0]) sizeXM=dim[0]-px;
 +
 +      sizeXM=sizeXM*bbGetInputImageFix()->GetScalarSize();
 +      for (k=0; k<dimMoveZ; k++)
 +      {
 +         for (j=0; j<dimMoveY; j++)
 +         {
 +                py=j+bbGetInputOrigin()[1];
 +              pz=k+bbGetInputOrigin()[2];
 +              
 +              if ( (py<dim[1]) && (pz<dim[2]) &&
 +                   (py>=0)    && (pz>=0)      &&
 +                   (sizeXM>0) ) 
                {
-                       memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM );
+                       _imageoutput = vtkImageData::New();
+                       _imageoutput->Initialize();
+                       _imageoutput->SetScalarType( bbGetInputImageFix()->GetScalarType() );
+                       _imageoutput->SetSpacing( bbGetInputImageFix()->GetSpacing() );
+                       _imageoutput->SetDimensions(  dim[0], dim[1], dim[2] );
+                       _imageoutput->AllocateScalars();
+                       // Duplicating Fix Image
+                       long sizeimage = dim[0]*dim[1]*dim[2]*bbGetInputImageFix()->GetScalarSize();    
+                       memcpy( _imageoutput->GetScalarPointer() , bbGetInputImageFix()->GetScalarPointer() , sizeimage);
+               }
+               if (bbGetInputType()==1)
+               {
+                       _imageoutput=bbGetInputImageFix();
                }
  
-          } // for j
-       } // for k
-         _imageoutput->Modified();
-       } // If Image Fixe Move the same GetScalarType
-         else {
-            printf ("ERROR: InversCrop  both ImageFixe and ImageMove need the same format.\n");
-       }  
-     } // If Image Fixe Move != NULL
-      else {
-         printf ("ERROR: InversCrop  need ImageFixe and ImageMove to run.\n");
-     } 
-     bbSetOutputOut(_imageoutput);
+               // Copy the Move Image
+               int j,k; 
+               int px,py,pz;
+               bbGetInputImageMove()->GetWholeExtent(ext);
+               int dimMoveX    = ext[1]-ext[0]+1;
+               int dimMoveY    = ext[3]-ext[2]+1;
+               int dimMoveZ    = ext[5]-ext[4]+1;
+               int spxM                = 0;  // start px MoveImage
+               int sizeXM              = 0;  // sizeX MoveImage
+               px                              = bbGetInputOrigin()[0];
+               spxM                    = 0;
+               if (px<0)
+               { 
+                  spxM=px*(-1);
+                  px=0;
+               }
+               sizeXM = dimMoveX-spxM;
+               if (px+sizeXM>=dim[0]) sizeXM=dim[0]-px;
+               sizeXM=sizeXM*bbGetInputImageFix()->GetScalarSize();
+               for (k=0; k<dimMoveZ; k++)
+               {
+                  for (j=0; j<dimMoveY; j++)
+                  {
+                       py=j+bbGetInputOrigin()[1];
+                               pz=k+bbGetInputOrigin()[2];
+                               if ( (py<dim[1]) && (pz<dim[2]) &&
+                                (py>=0)    && (pz>=0)  &&
+                                        (sizeXM>0) ) 
+                               {
+                                       memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM );
+                               }
+                  } // for j
+               } // for k
+               _imageoutput->Modified();
+             } // If Image Fixe Move the same GetScalarType
+               else {
+                  printf ("ERROR: InversCrop  both ImageFixe and ImageMove need the same format.\n");
+                  printf ("       type ImageFix:%d   type ImageMove:%d\n", bbGetInputImageFix()->GetScalarType(), bbGetInputImageMove()->GetScalarType() );
+             }  
+           } // If Image Fixe Move != NULL   
+            else {
+               printf ("ERROR: InversCrop  need ImageFixe and ImageMove to run.\n");
+           } 
+           bbSetOutputOut(_imageoutput);
+       } // if Active
  }
  
  //===== 
index 0a2fdfdb24074331ed862707a18e2c28901bfb3b,d56af36bab4d4e0a0d3366ca2b0a214c9b4dd952..ed7966c13c7f48e50ba0572d2d847cdbdb9762b7
@@@ -110,14 -109,18 +109,24 @@@ namespace bbvt
  
                if (bbGetInputActive()==true)
                {
 -                      polydatamapper->SetInput( bbGetInputIn() );
 -                      vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
 +//EED 2017-01-01 Migration VTK7
 +#if VTK_MAJOR_VERSION <= 5
 +                       polydatamapper->SetInput( bbGetInputIn() );
 +#else
 +                       polydatamapper->SetInputData( bbGetInputIn() );
 +#endif
 +
 +                       vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
++
+                       if (bbGetInputRepresentation()==1)
+                       {
+                                vtkactor->GetProperty()->SetAmbient(1);
+                                vtkactor->GetProperty()->SetDiffuse(1);
+                                vtkactor->GetProperty()->SetSpecular(0);
+                       } else {
+ printf("EED WARNNING!  PolyDataToActor::DoProcess  which is the default values of Ambient, Diffuse, Specular ? \n");
+                       }
 -
                         vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
                           
                         vtkactor->GetProperty()->SetColor( bbGetInputColour()[0],  
Simple merge