]> Creatis software - bbtk.git/blobdiff - packages/vtk/src/bbvtkInversCrop.cxx
#3013 BBTK Feature New Normal - package vtk box InvertCrop Type option
[bbtk.git] / packages / vtk / src / bbvtkInversCrop.cxx
index 7d0962f05e94adc731073c9da1a9b7a7eb4762e7..97963bca7327d6d4f3edc07a6ac10e4ba8019d7f 100644 (file)
@@ -28,7 +28,6 @@ void InversCrop::Process()
 
     if ((bbGetInputImageFix()!=NULL) && (bbGetInputImageMove()!=NULL) )
     {
-printf("EED InversCrop::Process ScalarType %d  %d \n", bbGetInputImageFix()->GetScalarType(), bbGetInputImageMove()->GetScalarType() );
      if ( bbGetInputImageFix()->GetScalarType()==bbGetInputImageMove()->GetScalarType() ) 
      {
         // Creating Image
@@ -39,13 +38,21 @@ printf("EED InversCrop::Process ScalarType %d  %d \n", bbGetInputImageFix()->Get
        dim[0]= ext[1]-ext[0]+1;
        dim[1]= ext[3]-ext[2]+1;
        dim[2]= ext[5]-ext[4]+1;
-               
-       _imageoutput = vtkImageData::New();
-       _imageoutput->Initialize();
-       _imageoutput->SetScalarType( bbGetInputImageFix()->GetScalarType() );
-       _imageoutput->SetSpacing( bbGetInputImageFix()->GetSpacing() );
-       _imageoutput->SetDimensions(  dim[0], dim[1], dim[2] );
-       _imageoutput->AllocateScalars();
+
+       if (bbGetInputType()==0)
+       {
+               _imageoutput = vtkImageData::New();
+               _imageoutput->Initialize();
+               _imageoutput->SetScalarType( bbGetInputImageFix()->GetScalarType() );
+               _imageoutput->SetSpacing( bbGetInputImageFix()->GetSpacing() );
+               _imageoutput->SetDimensions(  dim[0], dim[1], dim[2] );
+               _imageoutput->AllocateScalars();
+       }
+       if (bbGetInputType()==1)
+       {
+               _imageoutput=bbGetInputImageFix();
+       }
+
 
         // Duplicating Fix Image
        long sizeimage = dim[0]*dim[1]*dim[2]*bbGetInputImageFix()->GetScalarSize();    
@@ -110,6 +117,7 @@ void InversCrop::bbUserSetDefaultValues()
 
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
+   bbSetInputType(0);
    bbSetInputImageFix(NULL);
    bbSetInputImageMove(NULL);