]> Creatis software - creaVtk.git/commitdiff
#3538 new input VtkPolyDataToImageData - Type vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 21 Apr 2026 08:37:09 +0000 (10:37 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 21 Apr 2026 08:37:09 +0000 (10:37 +0200)
bbtk_creaVtk_PKG/.DS_Store
bbtk_creaVtk_PKG/bbs/boxes/README.txt
bbtk_creaVtk_PKG/bbs/boxes/VoiMPR-Interface.bbg
bbtk_creaVtk_PKG/bbs/boxes/VoiMPR-Interface.bbs
bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.h
bbtk_creaVtk_PKG/src/bbcreaVtkTurnImage.cxx

index 8fd3482ce295b13412c4a47a718c628794e1ca1a..9e9655d8fd9a5157af96d9e6d516da62ad3f1647 100644 (file)
Binary files a/bbtk_creaVtk_PKG/.DS_Store and b/bbtk_creaVtk_PKG/.DS_Store differ
index 0c1ff24d01c098f2b735c7661a1d912aad4f2db9..cca527e7462032db606af0ddb719a906e459228c 100644 (file)
@@ -24,3 +24,4 @@
 # ------------------------------------------------------------------------ */
 
 bbs files ...
+
index 864ac8626e1bca58227b05d2dd24809d48012d7f..bfc22f77bf74debf155ff31db04ee2fead6dbf7a 100644 (file)
@@ -54,7 +54,7 @@ BOX
 creaMaracasVisu:SliderMinMax:Box03
 ISEXEC:FALSE
 -127.659482:43.170047:-900.000000
--96.099482:40.670047:-900.000000
+-94.339482:40.670047:-900.000000
 PORT
 InMax:"500"
 PORT
@@ -68,7 +68,7 @@ BOX
 creaMaracasVisu:SliderMinMax:Box04
 ISEXEC:FALSE
 -76.763039:37.919872:-900.000000
--45.203039:35.419872:-900.000000
+-43.443039:35.419872:-900.000000
 PORT
 InMax:"500"
 PORT
@@ -80,7 +80,7 @@ BOX
 creaMaracasVisu:SliderMinMax:Box05
 ISEXEC:FALSE
 -19.597915:37.011770:-900.000000
-11.962085:34.511770:-900.000000
+13.722085:34.511770:-900.000000
 PORT
 InMax:"500"
 PORT
@@ -130,7 +130,7 @@ BOX
 wx:LayoutLine:Box11
 ISEXEC:FALSE
 -231.732698:-39.698284:-900.000000
--198.412698:-42.198284:-900.000000
+-196.652698:-42.198284:-900.000000
 FIN_BOX
 BOX
 vtk:ImageVtkProperties:Box30
@@ -178,7 +178,7 @@ BOX
 wx:CheckBox:Box42
 ISEXEC:FALSE
 -281.027317:40.554596:-900.000000
--259.397317:38.054596:-900.000000
+-258.267317:38.054596:-900.000000
 PORT
 In:"true"
 PORT
@@ -190,43 +190,43 @@ BOX
 wx:LayoutTab:Box21
 ISEXEC:FALSE
 -237.668836:15.208511:-900.000000
--204.348836:12.708511:-900.000000
+-202.588836:12.708511:-900.000000
 FIN_BOX
 BOX
 wx:LayoutLine:Box22
 ISEXEC:FALSE
 -236.532533:23.000297:-900.000000
--203.212533:20.500297:-900.000000
+-201.452533:20.500297:-900.000000
 PORT
-WinTitle:"X"
+WinTitle:"Sagittal"
 FIN_BOX
 BOX
 wx:LayoutTab:Box23
 ISEXEC:FALSE
 -189.579771:15.718843:-900.000000
--156.259771:13.218843:-900.000000
+-154.499771:13.218843:-900.000000
 FIN_BOX
 BOX
 wx:LayoutLine:Box24
 ISEXEC:FALSE
 -188.443468:23.510629:-900.000000
--155.123468:21.010629:-900.000000
+-153.363468:21.010629:-900.000000
 PORT
-WinTitle:"Y"
+WinTitle:"Coronal"
 FIN_BOX
 BOX
 wx:LayoutTab:Box25
 ISEXEC:FALSE
 -147.275517:16.140633:-900.000000
--113.955517:13.640633:-900.000000
+-112.195517:13.640633:-900.000000
 FIN_BOX
 BOX
 wx:LayoutLine:Box26
 ISEXEC:FALSE
 -146.139215:23.932419:-900.000000
--112.819215:21.432419:-900.000000
+-111.059215:21.432419:-900.000000
 PORT
-WinTitle:"Z"
+WinTitle:"Axial"
 FIN_BOX
 BOX
 std:MagicBox:Box28
@@ -314,7 +314,7 @@ ISEXEC:FALSE
 -131.403195:-12.118069:-900.000000
 -109.733195:-14.618069:-900.000000
 PORT
-Title:"X"
+Title:"Sag."
 FIN_BOX
 BOX
 wx:OutputText:Box46
@@ -322,13 +322,13 @@ ISEXEC:FALSE
 -107.557741:-11.877406:-900.000000
 -85.887741:-14.377406:-900.000000
 PORT
-Title:"Y"
+Title:"Cor."
 FIN_BOX
 BOX
 wx:LayoutLine:Box47
 ISEXEC:FALSE
 -140.961664:-31.753791:-900.000000
--107.641664:-34.253791:-900.000000
+-105.881664:-34.253791:-900.000000
 PORT
 Orientation:"H"
 FIN_BOX
@@ -338,7 +338,7 @@ ISEXEC:FALSE
 -83.573489:-11.867957:-900.000000
 -61.903489:-14.367957:-900.000000
 PORT
-Title:"Z"
+Title:"Axi."
 FIN_BOX
 BOX
 std:ConcatStrings:Box49
index 51af7fead3f48de38c9bc589a9745fbb687338b1..1e8e7d302f701ddd11ce17a7036dccd04bd3cfec 100644 (file)
@@ -73,17 +73,17 @@ new wx:CheckBox Box42
 new wx:LayoutTab Box21
 
 new wx:LayoutLine Box22
-  set Box22.WinTitle "X"
+  set Box22.WinTitle "Sagittal"
 
 new wx:LayoutTab Box23
 
 new wx:LayoutLine Box24
-  set Box24.WinTitle "Y"
+  set Box24.WinTitle "Coronal"
 
 new wx:LayoutTab Box25
 
 new wx:LayoutLine Box26
-  set Box26.WinTitle "Z"
+  set Box26.WinTitle "Axial"
 
 new std:MagicBox Box28
 
@@ -117,16 +117,16 @@ new std:MathOperationVector Box44
   set Box44.Type "0"
 
 new wx:OutputText Box45
-  set Box45.Title "X"
+  set Box45.Title "Sag."
 
 new wx:OutputText Box46
-  set Box46.Title "Y"
+  set Box46.Title "Cor."
 
 new wx:LayoutLine Box47
   set Box47.Orientation "H"
 
 new wx:OutputText Box48
-  set Box48.Title "Z"
+  set Box48.Title "Axi."
 
 new std:ConcatStrings Box49
   set Box49.In1 "["
index 0e4f85af50e1e4d59188d59209919b8b8d7c78b2..aa3dce7317bfcfa57ebfa5dd08f1bda65ea3d6a2 100644 (file)
@@ -32,7 +32,7 @@ void Cutter::Process()
   
   //  See example in:
   //  https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/Cutter/
-  
+
     if ( (bbGetInputActive()==true) && (bbGetInputIn()!=NULL) )
     {
         vtkCutter *cutter;
index 58f529249361ea6f0c500358a2204683ca24798e..8892805db0c091509aa7fe1a255b24d06047a707 100644 (file)
@@ -31,54 +31,75 @@ void PolyDataToImageData::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
 
-       if ((bbGetInputInPolyData()!=NULL) && (bbGetInputInImage()!=NULL) )
-       {
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-               int ext[6];
-        double spc[3];
-        double org[3];
-               bbGetInputInImage()->GetExtent( ext );
-        bbGetInputInImage()->GetSpacing( spc );
-        bbGetInputInImage()->GetOrigin( org );
+    if (bbGetInputTypeOutput()==0) // NULL
+    {
+        bbSetOutputOut( NULL);
+    } // if TypeOutput 1:NULL
 
-//             vtkCleanPolyData *clean1 = vtkCleanPolyData::New();             
-               if (clean1!=NULL) clean1->Delete();
-               clean1 = vtkCleanPolyData::New();
-               clean1->SetInputData( bbGetInputInPolyData() );
-               clean1->Update();
-               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();
-               extract->SetVOI( ext );
-               extract->SetSampleRate(1, 1, 1);
-               extract->SetInputData( bbGetInputInImage() );
-               extract->ReleaseDataFlagOff();
-               extract->Update();      
-//             vtkImageStencil *stencil = vtkImageStencil::New();
-               if (stencil!=NULL) stencil->Delete();
-               stencil = vtkImageStencil::New();
-               stencil->SetInputData( extract->GetOutput() );
-               stencil->Update();
-               stencil->SetStencilData(  dataToStencil->GetOutput() );
-               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
+
+    if (bbGetInputTypeOutput()==1) // Normal
+    {
+        if ((bbGetInputInPolyData()!=NULL) && (bbGetInputInImage()!=NULL) )
+        {
+            printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
+            int ext[6];
+            double spc[3];
+            double org[3];
+            bbGetInputInImage()->GetExtent( ext );
+            bbGetInputInImage()->GetSpacing( spc );
+            bbGetInputInImage()->GetOrigin( org );
+            
+            //         vtkCleanPolyData *clean1 = vtkCleanPolyData::New();
+            if (clean1!=NULL) clean1->Delete();
+            clean1 = vtkCleanPolyData::New();
+            clean1->SetInputData( bbGetInputInPolyData() );
+            clean1->Update();
+            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();
+            extract->SetVOI( ext );
+            extract->SetSampleRate(1, 1, 1);
+            extract->SetInputData( bbGetInputInImage() );
+            extract->ReleaseDataFlagOff();
+            extract->Update();
+            //         vtkImageStencil *stencil = vtkImageStencil::New();
+            if (stencil!=NULL) stencil->Delete();
+            stencil = vtkImageStencil::New();
+            stencil->SetInputData( extract->GetOutput() );
+            stencil->Update();
+            stencil->SetStencilData(  dataToStencil->GetOutput() );
+            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
+    } // if TypeOutput 0:Normal
+    
+    if (bbGetInputTypeOutput()==2) // The original input image without filter
+    {
+        if (bbGetInputInImage()!=NULL)
+        {
+            bbSetOutputOut( bbGetInputInImage() );
+        } else {
+            bbSetOutputOut( NULL );
+        }
+    } // if TypeOutput 2: The original input image without filter
+
+    
 }
 
 //=====
@@ -88,6 +109,7 @@ void PolyDataToImageData::bbUserSetDefaultValues()
 {
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
+    bbSetInputTypeOutput(1);
        bbSetInputInPolyData(NULL);
        bbSetInputInImage(NULL);
        bbSetInputBackgroundValue(255);
index b5dc35ab678f2e9eed49c80e1878f54e9d0c00fe..8043ab00e3d4f1979147b6bdfa0140337edf434c 100644 (file)
@@ -31,6 +31,7 @@ class bbcreaVtk_EXPORT PolyDataToImageData
   BBTK_DECLARE_INPUT(InImage,vtkImageData*);
   BBTK_DECLARE_INPUT(BackgroundValue,double);
   BBTK_DECLARE_INPUT(InPolyData,vtkPolyData*);
+  BBTK_DECLARE_INPUT(TypeOutput,int);
   BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
   BBTK_PROCESS(Process);
   void Process();
@@ -54,6 +55,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(PolyDataToImageData,bbtk::AtomicBlackBox);
   BBTK_INPUT(PolyDataToImageData,InImage,"Image to put Result",vtkImageData*,"");
   BBTK_INPUT(PolyDataToImageData,BackgroundValue,"(default 255) Background value",double,"");
   BBTK_INPUT(PolyDataToImageData,InPolyData,"Input vtkPolyData",vtkPolyData*,"");
+  BBTK_INPUT(PolyDataToImageData,TypeOutput,"(default 1) 0:NULL  1:Normal filter 2:The original input image without the filter",int,"");
 
   BBTK_OUTPUT(PolyDataToImageData,Out,"Output vtkImageData",vtkImageData*,"");
 
index 2c3a8eca21f30b086301dbf05eb26990289e9389..83e611ea1e752745abad3a91db311c843ae18afa 100644 (file)
@@ -105,7 +105,7 @@ void TurnImage::Process()
          } // for k
          bbSetOutputOut(newImage);
         */
-        if ( (bbGetInputDir()>=-1) && (bbGetInputDir()<=5) )
+        if ( (bbGetInputDir()>=-1) && (bbGetInputDir()<=6) )
         {
             vtkImageReslice             *reslice = vtkImageReslice::New();
             vtkImageChangeInformation   *mchange = vtkImageChangeInformation::New();
@@ -120,17 +120,17 @@ void TurnImage::Process()
                     reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
                 }
             } // dir -1
-            if (  bbGetInputDir()==0 )   // nothing
+            if (  bbGetInputDir()==0 )   // XY    nothing
             {
                 static double axes[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
                 reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
             } // dir 0
-            if (  bbGetInputDir()==1 )
+            if (  bbGetInputDir()==1 )  // YZ
             {
                 static double axes[3][3] = { { 0, 1, 0 }, { 0, 0, -1 }, { 1, 0, 0 } };
                 reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
             } // dir 1
-            if (  bbGetInputDir()==2 )
+            if (  bbGetInputDir()==2 )  // XZ  
             {
                 static double axes[3][3] = { { 1, 0, 0 }, { 0, 0, -1 }, { 0, 1, 0 } };
                 reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);