From 2afbd2b3d643e0bc34d695805d0ea09e6e98a5ce Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 20 Dec 2017 11:15:27 +0100 Subject: [PATCH] #3157 BBTK Feature New Normal - InvertCropBox Active --- packages/vtk/src/bbvtkInversCrop.cxx | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/vtk/src/bbvtkInversCrop.cxx b/packages/vtk/src/bbvtkInversCrop.cxx index 5edc765..df0e5db 100644 --- a/packages/vtk/src/bbvtkInversCrop.cxx +++ b/packages/vtk/src/bbvtkInversCrop.cxx @@ -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=0) && (pz>=0) && - (sizeXM>0) ) - { - memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM ); - } + pz=k+bbGetInputOrigin()[2]; + if ( (py=0) && (pz>=0) && + (sizeXM>0) ) + { + memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM ); + } } // for j } // for k -- 2.47.1