]> Creatis software - bbtk.git/commitdiff
#3467 Bug: InvertCrop Dimension of 2D or 3D
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 18 Jun 2021 05:45:20 +0000 (07:45 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 18 Jun 2021 05:45:20 +0000 (07:45 +0200)
packages/vtk/src/bbvtkInversCrop.cxx
packages/wx/src/bbwxComboBox.cxx

index 68b2b1c4797895febcef1449f6f40a6a74030f32..8a4bb337ccdb73000ddea1a68143c6d06c1fb42b 100644 (file)
@@ -113,15 +113,20 @@ printf("EED InversCrop::Process 2   %d %d  %d \n",dim[0],dim[1],dim[2]  );
                   spxM = px*(-1);
                   px   = 0;
                }
-               sizeXM = dimMoveX-spxM;
-               if (px+sizeXM>=dim[0]) sizeXM=dim[0]-px;
-               sizeXM = sizeXM * bbGetInputImageFix()->GetScalarSize();
+               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 (bbGetInputImageMove()->GetDataDimension()==3) 
+                               {
+                                       pz = k+bbGetInputOrigin()[2];
+                               } else {
+                                       pz = k;
+                               }// Dimension 3
                                if ( (py<dim[1]) && (pz<dim[2]) &&
                                 (py>=0)    && (pz>=0)  &&
                                         (sizeXM>0) ) 
@@ -131,6 +136,8 @@ printf("EED InversCrop::Process 2   %d %d  %d \n",dim[0],dim[1],dim[2]  );
 
                   } // for j
                } // for k
+printf("EED InversCrop::Process 4   %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");
index e1883ace8c15fd3d0402590d9c5002b1e1430604..0a1a99e909831c5397b8f1ee73266c6532182cbe 100644 (file)
@@ -183,7 +183,7 @@ void ComboBoxWidget::OnSpinCtrlClick(wxCommandEvent& event)
 //--------------------------------------------------------------------------
 void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn )
 {
-       int i,size=lstIn.size();
+       int i,size = lstIn.size();
 
 
 #if defined(_WIN32)
@@ -240,8 +240,9 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WxBlackBox);
 void ComboBox::Process()
 {
        int iSelection = bbGetInputSelection();
-       if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=bbGetInputIn().size()-1; }
-//     if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=0; }
+ printf("ComboBox::Process A iSelection=%d\n", iSelection);   
+//     if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=bbGetInputIn().size()-1; }
+       if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=0; }
        ComboBoxWidget *w = (ComboBoxWidget*)bbGetOutputWidget();
        w->FillItems( iSelection, bbGetInputIn() );
     bbSetInputSelection( iSelection );
@@ -251,6 +252,7 @@ void ComboBox::Process()
     { 
        bbSetOutputOutString( bbGetInputIn()[ iSelection ] );
     } // if iSelection
+ printf("ComboBox::Process B iSelection=%d\n", iSelection);   
        w->VerifyDeselect(iSelection);
 }
 //=====