]> Creatis software - bbtk.git/commitdiff
#3157 BBTK Feature New Normal - InvertCropBox Active
authorEduardo DAVILA <davila@localhost.localdomain>
Wed, 20 Dec 2017 10:15:27 +0000 (11:15 +0100)
committerEduardo DAVILA <davila@localhost.localdomain>
Wed, 20 Dec 2017 10:15:27 +0000 (11:15 +0100)
packages/vtk/src/bbvtkInversCrop.cxx

index 5edc7653d10c8cf016210d913b0c8be303496e5c..df0e5db77a7fb89aca6abd724ed8710a079dd1cd 100644 (file)
@@ -49,6 +49,9 @@ void InversCrop::Process()
                        _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)
                {
@@ -56,46 +59,43 @@ void InversCrop::Process()
                }
 
 
-               // 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;
 
+//             bbGetInputImageMove()->Modified();
+//             bbGetInputImageMove()->Update();
                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 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
+               int spxM                = 0;  // start px MoveImage
+               int sizeXM              = 0;  // sizeX MoveImage
 
-               px=bbGetInputOrigin()[0];
-               spxM=0;
-               if (px<=0)
+               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 );
-                       }
+                               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