]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx
#3491 vtk9itk5wx3-macos
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkPolyDataToImageData.cxx
index b5a495f11662c44b6352a6e2548db97ef8bfffbf..66543b2179dfddb744d9cf802ddca067da97b7cc 100644 (file)
@@ -33,26 +33,13 @@ void PolyDataToImageData::Process()
 
        if ((bbGetInputInPolyData()!=NULL) && (bbGetInputInImage()!=NULL) )
        {
-
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
 printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-
                int ext[6];
                bbGetInputInImage()->GetExtent( ext );
+        double spc[3];
+        bbGetInputInImage()->GetSpacing( spc );
+        double org[3];
+        bbGetInputInImage()->GetOrigin( org );
 
 //             vtkCleanPolyData *clean1 = vtkCleanPolyData::New();             
                if (clean1!=NULL) clean1->Delete();
@@ -62,14 +49,14 @@ printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .........
                vtkTriangleFilter *triangle1 = vtkTriangleFilter::New();
                triangle1->SetInputData( clean1->GetOutput() );
                triangle1->Update();
-
 //             vtkPolyDataToImageStencil *dataToStencil = vtkPolyDataToImageStencil::New();
                if (dataToStencil!=NULL) dataToStencil->Delete();
                dataToStencil = vtkPolyDataToImageStencil::New();
                dataToStencil->SetInputData( triangle1->GetOutput() );
+        dataToStencil->SetOutputOrigin( org );
+        dataToStencil->SetOutputSpacing( spc );
                dataToStencil->SetOutputWholeExtent( ext );
                dataToStencil->Update();
-
 //             vtkExtractVOI *extract = vtkExtractVOI::New();
                if (extract!=NULL) extract->Delete();
                extract = vtkExtractVOI::New();
@@ -78,7 +65,6 @@ printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .........
                extract->SetInputData( bbGetInputInImage() );
                extract->ReleaseDataFlagOff();
                extract->Update();      
-
 //             vtkImageStencil *stencil = vtkImageStencil::New();
                if (stencil!=NULL) stencil->Delete();
                stencil = vtkImageStencil::New();
@@ -88,32 +74,28 @@ printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .........
                stencil->ReverseStencilOn();
                stencil->SetBackgroundValue( bbGetInputBackgroundValue() );
                stencil->Update();
-
                bbSetOutputOut( stencil->GetOutput() );
        } else {
                printf("EED Warnning!  PolyDataToImageData::Process  > Missing Image or PolyData inputs\n");
+               bbSetOutputOut( NULL);
        }// if In NULL
-  
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void PolyDataToImageData::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
        bbSetInputInPolyData(NULL);
        bbSetInputInImage(NULL);
        bbSetInputBackgroundValue(255);
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void PolyDataToImageData::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
@@ -122,7 +104,6 @@ void PolyDataToImageData::bbUserInitializeProcessing()
        dataToStencil   = NULL;
        extract                 = NULL;
        stencil                 = NULL;
-
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)