From 32f28c419e0c356a18a288af2ea6ffdd32a259ca Mon Sep 17 00:00:00 2001 From: guigues Date: Wed, 13 Feb 2008 11:12:20 +0000 Subject: [PATCH] bbfy changes ... --- kernel/appli/bbfy/bbfy.cpp | 108 ++++++++++-------- packages/std/bbs/appli/testAdd.bbs | 8 ++ packages/std/src/bbstdAdd.xml | 6 +- packages/std/src/bbstdMultipleInputs.xml | 13 +-- packages/vtk/src/bbvtkAppendPolyData.xml | 45 ++------ packages/vtk/src/bbvtkConeSource.xml | 68 ++--------- .../src/bbvtkImageAnisotropicDiffusion3D.xml | 27 +---- packages/vtk/src/bbvtkImageDilateErode3D.xml | 54 ++------- packages/vtk/src/bbvtkImageGaussianSmooth.xml | 38 +----- packages/vtk/src/bbvtkMetaImageReader.xml | 16 +-- packages/vtk/src/bbvtkSphereSource.xml | 54 ++------- 11 files changed, 126 insertions(+), 311 deletions(-) create mode 100644 packages/std/bbs/appli/testAdd.bbs diff --git a/kernel/appli/bbfy/bbfy.cpp b/kernel/appli/bbfy/bbfy.cpp index 6412047..8123db2 100644 --- a/kernel/appli/bbfy/bbfy.cpp +++ b/kernel/appli/bbfy/bbfy.cpp @@ -19,6 +19,10 @@ public: }; //========================================================================== +const std::string itkImageToImageFilterString = "ITK_ImageToImageFilter"; +const std::string vtkImageAlgorithmString = "VTK_ImageAlgorithm"; +const std::string vtkPolyDataAlgorithmString = "VTK_PolyDataAlgorithm"; + //========================================================================== class bbfy { @@ -54,6 +58,7 @@ private: vtkPolyDataAlgorithm, } BoxType; + BoxType mType; bool mIsWidget; std::string mParentBlackBox; @@ -81,7 +86,7 @@ private: { std::string name; std::string type; - std::string help; + std::string descr; std::string special; std::string generic_type; } @@ -109,6 +114,8 @@ bbfy::bbfy(const std::string& filename, const std::string& output_path, bool verbose) { + mIsWidget = false; + mFilename = filename; mPackage = package; mNamespace = "bb" + mPackage; @@ -173,7 +180,7 @@ void bbfy::ParseXML() // Name if (!BB.isAttributeSet("name")) { - throw bbfyException("Error : no 'name' attribute found (mandatory)"); + throw bbfyException("Error : tag : no 'name' attribute found (mandatory)"); } mName = BB.getAttribute("name"); @@ -192,35 +199,53 @@ void bbfy::ParseXML() mGeneric = false; mType = STD; } - else if (bbtype=="itkImageToImageFilter") + else if (bbtype==itkImageToImageFilterString) { mType = itkImageToImageFilter; // Looks for tag if (!BB.nChildNode("itkparent")) { - throw bbfyException("Error : blackbox type 'itkImageToImageFilter' but no tag found (mandatory)"); + throw bbfyException("Error : blackbox type '"+itkImageToImageFilterString+"' but no tag found (mandatory)"); } GetTextOrClear(BB.getChildNode("itkparent"),mItkParent); // mGeneric = false; if (BB.isAttributeSet("generic")) mGeneric=true; } - else if ((bbtype=="vtkImageAlgorithm") || (bbtype=="vtkPolyDataAlgorithm")) + else if (bbtype == vtkImageAlgorithmString) { mType = vtkImageAlgorithm; // Looks for tag if (!BB.nChildNode("vtkparent")) { - throw bbfyException("Error : blackbox type 'vtkImageAlgorithm' but no tag found (mandatory)"); + throw bbfyException("Error : blackbox type '" + +vtkImageAlgorithmString + +"' but no tag found (mandatory)"); } GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent); // } - else + else if (bbtype == vtkPolyDataAlgorithmString ) + { + mType = vtkPolyDataAlgorithm; + // Looks for tag + if (!BB.nChildNode("vtkparent")) + { + throw bbfyException("Error : blackbox type '" + +vtkPolyDataAlgorithmString + +"' but no tag found (mandatory)"); + } + GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent); + // + } + else { std::string mess("Error : blackbox type '"); mess += bbtype; - mess += "' unknown (types are 'standard','itkfilter')"; + mess += "' unknown. Known types :"; + mess += "'" + itkImageToImageFilterString + "' "; + mess += "'" + vtkImageAlgorithmString + "' "; + mess += "'" + vtkPolyDataAlgorithmString + "' "; throw bbfyException(mess); } } @@ -239,22 +264,6 @@ void bbfy::ParseXML() mInclude.push_back("bbtkAtomicBlackBox.h"); } - /* - // Parent black box - if (!BB.nChildNode("parentblackbox")) - { - throw bbfyException("Error : no tag found (mandatory)"); - } - GetTextOrClear(BB.getChildNode("parentblackbox"),mParentBlackBox); - - // Package - if (!BB.nChildNode("package")) - { - throw bbfyException("Error : no tag found (mandatory)"); - } - GetTextOrClear(BB.getChildNode("package"),mPackage); - */ - // Author int i,j; for (i=0,j=0; i attribute 'name' not found (mandatory)"); } + io.name = n.getAttribute("name"); if (!n.isAttributeSet("type")) { - throw bbfyException("Error : attribute 'type' not found (mandatory)"); + throw bbfyException("Error : attribute 'type' not found (mandatory)"); } - - IO io; - io.name = n.getAttribute("name"); io.type = n.getAttribute("type"); - GetTextOrClear(n,io.help); + if (!n.isAttributeSet("description")) + { + throw bbfyException("Error : attribute 'description' not found (mandatory)"); + } + io.descr = n.getAttribute("description"); if (n.isAttributeSet("special")) { @@ -377,20 +385,23 @@ void bbfy::ParseXML() // Outputs for (i=0,j=0; i attribute 'name' not found (mandatory)"); } + io.name = n.getAttribute("name"); if (!n.isAttributeSet("type")) { - throw bbfyException("Error : attribute 'type' not found (mandatory)"); + throw bbfyException("Error : attribute 'type' not found (mandatory)"); } - - IO io; - io.name = n.getAttribute("name"); io.type = n.getAttribute("type"); - GetTextOrClear(n,io.help); + if (!n.isAttributeSet("description")) + { + throw bbfyException("Error : attribute 'description' not found (mandatory)"); + } + io.descr = n.getAttribute("description"); if (n.isAttributeSet("special")) { @@ -462,7 +473,10 @@ void bbfy::CreateHeader() } // If is widget - mFile << "#ifdef _USE_WXWIDGETS_\n"; + if (mIsWidget) + { + mFile << "#ifdef _USE_WXWIDGETS_\n"; + } // Prevent multiple inclusions std::string included("__bb"); @@ -745,7 +759,7 @@ void bbfy::CreateHeader() mFile << "BBTK_INPUT("; } mFile << mName << "," << ioi->name << ",\"" - << ioi->help << "\"," << ioi->type <<");\n"; + << ioi->descr << "\"," << ioi->type <<");\n"; } // Outputs @@ -760,7 +774,7 @@ void bbfy::CreateHeader() mFile << "BBTK_OUTPUT("; } mFile << mName << "," << ioi->name << ",\"" - << ioi->help << "\"," << ioi->type <<");\n"; + << ioi->descr << "\"," << ioi->type <<");\n"; } // EO black box description @@ -795,7 +809,10 @@ void bbfy::CreateHeader() // Prevent multiple inclusions mFile << "#endif // " << included <<"\n"; // If is widget - mFile << "#endif // _USE_WXWIDGETS_\n"; + if (mIsWidget) + { + mFile << "#endif // _USE_WXWIDGETS_\n"; + } // EOF mFile << "\n"; @@ -870,7 +887,7 @@ void bbfy::WriteGenericITKFilterHeader() { mFile << "BBTK_INPUT("; mFile << mName << "Generic," << ioi->name << ",\"" - << ioi->help << "\"," << ioi->generic_type <<");\n"; + << ioi->descr << "\"," << ioi->generic_type <<");\n"; } // Outputs @@ -878,7 +895,7 @@ void bbfy::WriteGenericITKFilterHeader() { mFile << "BBTK_OUTPUT("; mFile << mName << "Generic," << ioi->name << ",\"" - << ioi->help << "\"," << ioi->generic_type <<");\n"; + << ioi->descr << "\"," << ioi->generic_type <<");\n"; } // EO black box description @@ -1067,7 +1084,8 @@ int main(int argc, char **argv) } catch (bbfyException e) { - std::cerr << e.mMessage << std::endl; + std::cerr << argv[0] << " " << argv[1] << std::endl + << e.mMessage << std::endl; return 1; } return 0; diff --git a/packages/std/bbs/appli/testAdd.bbs b/packages/std/bbs/appli/testAdd.bbs new file mode 100644 index 0000000..4e4e7f1 --- /dev/null +++ b/packages/std/bbs/appli/testAdd.bbs @@ -0,0 +1,8 @@ +description "Tests the std::Add box" +category "test" + +include std +new Add a +set a.In1 1 +set a.In2 2 +print $a.Out$ diff --git a/packages/std/src/bbstdAdd.xml b/packages/std/src/bbstdAdd.xml index 0d38870..b6df26b 100644 --- a/packages/std/src/bbstdAdd.xml +++ b/packages/std/src/bbstdAdd.xml @@ -6,9 +6,9 @@ Adds its inputs math - First number to add - Second number to add - Result + + +
     bbSetOutputOut( bbGetInputIn1() + bbGetInputIn2() );
diff --git a/packages/std/src/bbstdMultipleInputs.xml b/packages/std/src/bbstdMultipleInputs.xml
index a02d054..fc11460 100644
--- a/packages/std/src/bbstdMultipleInputs.xml
+++ b/packages/std/src/bbstdMultipleInputs.xml
@@ -6,13 +6,12 @@
   This box has multiple Void inputs and one Void output. Hence it relays any input modification to its output. It is usefull to plug different BoxChange outputs into the same BoxExecute input.
   misc
 
-  Input 1
-  Input 2
-  Input 3
-  Input 4
-  Input 5
-
-  Output
+  
+  
+  
+  
+  
+  
 
 
 
diff --git a/packages/vtk/src/bbvtkAppendPolyData.xml b/packages/vtk/src/bbvtkAppendPolyData.xml
index a425ca8..a422ab5 100644
--- a/packages/vtk/src/bbvtkAppendPolyData.xml
+++ b/packages/vtk/src/bbvtkAppendPolyData.xml
@@ -1,7 +1,7 @@
 
 
 
-
+
 
 jpr at creatis.insa-lyon.fr
 
Appends one of more polygonal datasets into a single polygonal dataset
@@ -10,43 +10,12 @@ vtkAppendPolyData.h vtkAppendPolyData - -Output Mesh - - - -PolyData 1 - - - -PolyData 2 - - - -PolyData 3 - - - -PolyData 4 - - - -PolyData 5 - - + + + + + +
diff --git a/packages/vtk/src/bbvtkConeSource.xml b/packages/vtk/src/bbvtkConeSource.xml
index a544b24..a0bb806 100644
--- a/packages/vtk/src/bbvtkConeSource.xml
+++ b/packages/vtk/src/bbvtkConeSource.xml
@@ -1,7 +1,7 @@
 
 
 
-
+
 
 jpr at creatis.insa-lyon.fr
 
Creates a Cone (bbfication of vtkConeSource)
@@ -11,63 +11,15 @@ vtkConeSource.h vtkConeSource - -Output Cone - - - -Cone Radius - - - -Cone Resolution - - - -Center X coord - - - -Center Y coord - - - -Center Z coord - - - - X Direction - - - - Y Direction - - - - Z Direction - - + + + + + + + + +
diff --git a/packages/vtk/src/bbvtkImageAnisotropicDiffusion3D.xml b/packages/vtk/src/bbvtkImageAnisotropicDiffusion3D.xml
index bc05990..4ea350a 100644
--- a/packages/vtk/src/bbvtkImageAnisotropicDiffusion3D.xml
+++ b/packages/vtk/src/bbvtkImageAnisotropicDiffusion3D.xml
@@ -1,6 +1,6 @@
 
 
-
+
 
 jpr at creatis.insa-lyon.fr
 
vtkImageAnisotropicDiffusion3D diffuses an volume iteratively. The neighborhood of the diffusion is determined by the instance flags. if 'Faces' is on, the 6 voxels adjoined by faces are included in the neighborhood. If 'Edges' is on the 12 edge connected voxels are included, and if 'Corners' is on, the 8 corner connected voxels are included. 'DiffusionFactor' determines how far a pixel value moves toward its neighbors, and is insensitive to the number of neighbors chosen. The diffusion is anisotropic because it only occurs when a gradient measure is below 'GradientThreshold'. Two gradient measures exist and are toggled by the 'GradientMagnitudeThreshold' flag. When 'GradientMagnitudeThreshold' is on, the magnitude of the gradient, computed by central differences, above 'DiffusionThreshold' a voxel is not modified. The alternative measure examines each neighbor independently. The gradient between the voxel and the neighbor must be below the 'DiffusionThreshold' for diffusion to occur with THAT neighbor.
@@ -10,28 +10,9 @@ vtkImageData.h vtkImageAnisotropicDiffusion3D - -Input image - - - -Output image - - - - -Difference threshold that stops diffusion - - + + +
diff --git a/packages/vtk/src/bbvtkImageDilateErode3D.xml b/packages/vtk/src/bbvtkImageDilateErode3D.xml index 7bb8751..c4a3509 100644 --- a/packages/vtk/src/bbvtkImageDilateErode3D.xml +++ b/packages/vtk/src/bbvtkImageDilateErode3D.xml @@ -1,6 +1,6 @@ - + laurent.guigues at creatis.insa-lyon.fr
Dilates one value and erodes another. vtkImageDilateErode3D will dilate one value and erode another. It uses an elliptical foot print, and only erodes/dilates on the boundary of the two values. The filter is restricted to the X, Y, and Z axes for now. It can degenerate to a 2 or 1 dimensional filter by setting the kernel size to 1 for a specific axis. (bbfication of vtkImageDilateErode3D)
@@ -11,51 +11,13 @@ vtkImageDilateErode3D - -Input image - - - -Output image - - - -Size of the kernel in direction X - - - -Size of the kernel in direction Y - - - -Size of the kernel in direction Z - - - -The dilation value - - - -The erosion value - + + + + + + +
diff --git a/packages/vtk/src/bbvtkImageGaussianSmooth.xml b/packages/vtk/src/bbvtkImageGaussianSmooth.xml
index 95e73cc..e743045 100644
--- a/packages/vtk/src/bbvtkImageGaussianSmooth.xml
+++ b/packages/vtk/src/bbvtkImageGaussianSmooth.xml
@@ -1,6 +1,6 @@
 
 
-
+
 
 laurent.guigues at creatis.insa-lyon.fr
 
Performs a gaussian convolution of the input image (bbfication of vtkImageGaussianSmooth)
@@ -11,37 +11,11 @@ vtkImageGaussianSmooth - -Input image - - - -Output image - - - -Standard deviation in direction X - - - -Standard deviation in direction Y - - - -Standard deviation in direction Z - + + + + +
diff --git a/packages/vtk/src/bbvtkMetaImageReader.xml b/packages/vtk/src/bbvtkMetaImageReader.xml
index 71314a1..8c50c78 100644
--- a/packages/vtk/src/bbvtkMetaImageReader.xml
+++ b/packages/vtk/src/bbvtkMetaImageReader.xml
@@ -1,6 +1,6 @@
 
 
-
+
 
 laurent.guigues at creatis.insa-lyon.fr
 
Reads .mhd / .mha image formats (bbfication of vtkMetaImageReader)
@@ -10,18 +10,8 @@ vtkImageData.h vtkMetaImageReader - -Filename - - - -Output image - + +
diff --git a/packages/vtk/src/bbvtkSphereSource.xml b/packages/vtk/src/bbvtkSphereSource.xml index 483897f..113aa8d 100644 --- a/packages/vtk/src/bbvtkSphereSource.xml +++ b/packages/vtk/src/bbvtkSphereSource.xml @@ -1,6 +1,6 @@ - + jpr@creatis.insa-lyon.fr
Creates a Sphere (bbfication of vtkSphereSource)
@@ -9,51 +9,13 @@ vtkSphereSource.h vtkSphereSource - -Output Sphere - - - -Center X coord - - - -Center Y coord - - - -Center Z coord - - - -Sphere PhiResolution - - - -Sphere Radius - - - -Sphere ThetaResolution - + + + + + + +
-- 
2.45.1