From: Eduardo DAVILA Date: Mon, 21 Jun 2021 13:25:52 +0000 (+0200) Subject: #3467 Bug: InvertCrop Dimension of 2D or 3D X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b40eee63210158ba845590da9020f7094867f7e5;p=bbtk.git #3467 Bug: InvertCrop Dimension of 2D or 3D --- diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index 38b018b..4b000f0 100644 --- a/kernel/src/bbtkBlackBox.cxx +++ b/kernel/src/bbtkBlackBox.cxx @@ -748,9 +748,9 @@ namespace bbtk ( (bbBoxProcessModeIsManual()==true)&&(bbLetRecursiveExecuteManualMode==true) ) ) { -printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() ); +//printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() ); this->bbProcess(); -printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() ); +//printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() ); } // Manual analysis //EED ups if ((bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==false)) diff --git a/packages/vtk/src/bbvtkInversCrop.cxx b/packages/vtk/src/bbvtkInversCrop.cxx index 1c71fe0..9064a09 100644 --- a/packages/vtk/src/bbvtkInversCrop.cxx +++ b/packages/vtk/src/bbvtkInversCrop.cxx @@ -26,8 +26,6 @@ void InversCrop::Process() // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') -printf("\n\n EED InversCrop::Process Start \n" ); - if (bbGetInputActive()==true) { if ( (bbGetInputImageFix()!=NULL) && (bbGetInputImageMove()!=NULL) ) @@ -52,10 +50,6 @@ printf("\n\n EED InversCrop::Process Start \n" ); { dim[2] = ext[5]-ext[4]+1; } - -printf("EED InversCrop::Process 1 %d\n", bbGetInputImageFix()->GetDataDimension() ); -printf("EED InversCrop::Process 2 %d %d %d \n",dim[0],dim[1],dim[2] ); - if (bbGetInputType()==0) { _imageoutput = vtkImageData::New(); @@ -70,7 +64,7 @@ printf("EED InversCrop::Process 2 %d %d %d \n",dim[0],dim[1],dim[2] ); #if (VTK_MAJOR_VERSION >= 6) _imageoutput->AllocateScalars(bbGetInputImageFix()->GetScalarType() , 1); #endif - + // Duplicating Fix Image long sizeimage = dim[0]*dim[1]*dim[2]*bbGetInputImageFix()->GetScalarSize(); memcpy( _imageoutput->GetScalarPointer() , bbGetInputImageFix()->GetScalarPointer() , sizeimage); @@ -98,38 +92,27 @@ 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; - + 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 %f %f %f\n", org[0],org[1],org[2] ); - px = org[0]; spxM = 0; if (px<0) @@ -140,7 +123,6 @@ printf("EED InversCrop::Process 3.1 Origin %f %f %f\n", org[0],org[1],org[2] sizeXM = dimMoveX-spxM; if (px+sizeXM>=dim[0]) { sizeXM=dim[0]-px; } sizeXM = sizeXM * bbGetInputImageFix()->GetScalarSize(); -printf("4. \n"); for (k=0; k=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 7 %d %d %d \n",px,py,pz ); - _imageoutput->Modified(); } else { // If Image Fixe Move the same GetScalarType printf ("ERROR: InversCrop both ImageFixe and ImageMove need the same format.\n"); @@ -177,10 +152,7 @@ printf("EED InversCrop::Process 7 %d %d %d \n",px,py,pz ); printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n"); } bbSetOutputOut(_imageoutput); - } // if Active -printf("EED InversCrop::Process End \n" ); - } //=====