- } // for j
- } // for k
- _imageoutput->Modified();
- } // If Image Fixe Move the same GetScalarType
- else {
- printf ("ERROR: InversCrop both ImageFixe and ImageMove need the same format.\n");
- }
- } // If Image Fixe Move != NULL
- else {
- printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n");
- }
- bbSetOutputOut(_imageoutput);
+ // Copy the Move Image
+ int j,k;
+ int px,py,pz;
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5)
+ bbGetInputImageMove()->GetWholeExtent(ext);
+#endif
+#if (VTK_MAJOR_VERSION >= 6)
+ bbGetInputImageMove()->GetExtent(ext);
+#endif
+ int dimMoveX = ext[1]-ext[0]+1;
+ int dimMoveY = ext[3]-ext[2]+1;
+ int dimMoveZ = 1;
+ if (bbGetInputImageMove()->GetDataDimension()==3)
+ {
+ dimMoveZ = ext[5]-ext[4]+1;
+ }
+
+
+ printf("EED InversCrop::Process 3 %d %d %d \n",dimMoveX,dimMoveY,dimMoveZ );
+
+
+
+ int spxM = 0; // start px MoveImage
+ int sizeXM = 0; // sizeX MoveImage
+ 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 );
+ }
+
+ } // for j
+ } // for k
+ _imageoutput->Modified();
+ } else { // If Image Fixe Move the same GetScalarType
+ printf ("ERROR: InversCrop both ImageFixe and ImageMove need the same format.\n");
+ printf (" type ImageFix:%d type ImageMove:%d\n", bbGetInputImageFix()->GetScalarType(), bbGetInputImageMove()->GetScalarType() );
+
+ }
+ } else { // If Image Fixe Move != NULL
+ printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n");
+ }
+ bbSetOutputOut(_imageoutput);
+
+ } // if Active
+printf("EED InversCrop::Process End \n" );
+