// * 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) )
{
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();
#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);
{
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)
sizeXM = dimMoveX-spxM;
if (px+sizeXM>=dim[0]) { sizeXM=dim[0]-px; }
sizeXM = sizeXM * bbGetInputImageFix()->GetScalarSize();
-printf("4. \n");
for (k=0; k<dimMoveZ; k++)
{
for (j=0; j<dimMoveY; j++)
(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 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");
printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n");
}
bbSetOutputOut(_imageoutput);
-
} // if Active
-printf("EED InversCrop::Process End \n" );
-
}
//=====