From 72100b5cd3240189ea096777f4088e49c2120ca8 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 21 Jun 2021 13:41:04 +0200 Subject: [PATCH] #3467 Bug: InvertCrop Dimension of 2D or 3D --- packages/vtk/src/bbvtkInversCrop.cxx | 40 +++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/packages/vtk/src/bbvtkInversCrop.cxx b/packages/vtk/src/bbvtkInversCrop.cxx index 03673e6..1c71fe0 100644 --- a/packages/vtk/src/bbvtkInversCrop.cxx +++ b/packages/vtk/src/bbvtkInversCrop.cxx @@ -98,18 +98,39 @@ printf("EED InversCrop::Process 2 %d %d %d \n",dim[0],dim[1],dim[2] ); { dimMoveZ = ext[5]-ext[4]+1; } - - printf("EED InversCrop::Process 3 %d %d %d \n",dimMoveX,dimMoveY,dimMoveZ ); + + double org[3]; + org[0]=0; + org[1]=0; + org[2]=0; + if (bbGetInputOrigin().size()==3) + { + org[0]=bbGetInputOrigin()[0]; + org[1]=bbGetInputOrigin()[1]; + org[2]=bbGetInputOrigin()[2]; + } + + if (bbGetInputOrigin().size()==2) + { + org[0]=bbGetInputOrigin()[0]; + org[1]=bbGetInputOrigin()[1]; + } + + if (bbGetInputOrigin().size()==1) + { + org[0]=bbGetInputOrigin()[0]; + } + int spxM = 0; // start px MoveImage int sizeXM = 0; // sizeX MoveImage printf("EED InversCrop::Process 3.1 sizeOrigin %d \n", bbGetInputOrigin().size() ); -printf("EED InversCrop::Process 3.1 Origin %d %d %d\n", bbGetInputOrigin()[0],bbGetInputOrigin()[1],bbGetInputOrigin()[2] ); +printf("EED InversCrop::Process 3.1 Origin %f %f %f\n", org[0],org[1],org[2] ); - px = bbGetInputOrigin()[0]; + px = org[0]; spxM = 0; if (px<0) { @@ -119,14 +140,15 @@ printf("EED InversCrop::Process 3.1 Origin %d %d %d\n", bbGetInputOrigin()[0] sizeXM = dimMoveX-spxM; if (px+sizeXM>=dim[0]) { sizeXM=dim[0]-px; } sizeXM = sizeXM * bbGetInputImageFix()->GetScalarSize(); +printf("4. \n"); for (k=0; kGetDataDimension()==3) { - pz = k+bbGetInputOrigin()[2]; + pz = k+org[2]; } else { pz = k; }// Dimension 3 @@ -134,12 +156,16 @@ printf("EED InversCrop::Process 3.1 Origin %d %d %d\n", bbGetInputOrigin()[0] (py>=0) && (pz>=0) && (sizeXM>0) ) { +printf("5. \n"); + memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM ); +printf("6. \n"); + } } // for j } // for k -printf("EED InversCrop::Process 4 %d %d %d \n",px,py,pz ); +printf("EED InversCrop::Process 7 %d %d %d \n",px,py,pz ); _imageoutput->Modified(); } else { // If Image Fixe Move the same GetScalarType -- 2.47.1