]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Thu, 7 Feb 2008 12:27:07 +0000 (12:27 +0000)
committerguigues <guigues>
Thu, 7 Feb 2008 12:27:07 +0000 (12:27 +0000)
packages/itk/bbs/appli/ImageCrop.bbs [new file with mode: 0644]
packages/itk/bbs/appli/ImageInfo.bbs [new file with mode: 0644]
packages/itk/src/bbitkAnyImageToTypedImage.h
packages/itk/src/bbitkImage.h
packages/itk/src/bbitkTypedImageToAnyImage.h
packages/std/src/bbstdMagicBox.h
packages/std/src/bbstdStringToVector.h
packages/std/src/bbstdVectorToString.h

diff --git a/packages/itk/bbs/appli/ImageCrop.bbs b/packages/itk/bbs/appli/ImageCrop.bbs
new file mode 100644 (file)
index 0000000..12262d8
--- /dev/null
@@ -0,0 +1,25 @@
+description "Extracts a sub-image of an image"
+author "laurent.guigues@creatis.insa-lyon.fr"
+category "application"
+
+load std
+load itk
+
+new ImageReader reader
+input I reader.Filename "Input file name"
+
+new ExtractImageFilter filter
+connect reader.Out filter.In
+
+new ImageRegion region
+input P region.Index "Position of the crop region"
+input S region.Size "Size of the crop region"
+
+connect region.Out filter.Region
+
+new ImageWriter writer
+connect filter.Out writer.In
+
+input O writer.Filename "Output file name"
+
+exec writer
diff --git a/packages/itk/bbs/appli/ImageInfo.bbs b/packages/itk/bbs/appli/ImageInfo.bbs
new file mode 100644 (file)
index 0000000..6e24f9d
--- /dev/null
@@ -0,0 +1,31 @@
+#load std
+load itk
+
+description "Gives information on the input image (pixel type, dimension, size, spacing)"
+author "laurent.guigues@creatis.insa-lyon.fr"
+category "application;image"
+
+new ImageReader reader
+
+# Make File name Using Black Box 'PrependDataPath'
+#----------------------------------------------------
+#note : .bbs not mandatory
+include std/boxes/bbPrependDataPath
+new PrependDataPath pdp
+set pdp.In "thorax.hdr"
+#connect pdp.Out reader.Filename
+
+# Allow user to specify his own image, in GUI mode (-g option)
+#---------------------------------------------------------------
+set reader.Filename "thorax.hdr"
+input In reader.Filename "Input file"
+
+new ImageProperties P
+connect reader.Out P.In
+
+print "Type      = $P.TypeName$\n"
+print "Dimension = $P.Dimension$\n"
+print "Size      = $P.Size$\n"
+print "Spacing   = $P.Spacing$\n"
+
+#graph
index beb8a20378d251a04d8523fd9edcab0533e81612..8b10cbee17060a22b0b03532159125e3a880095c 100644 (file)
@@ -26,18 +26,19 @@ namespace bbitk
   //=================================================================
   // BlackBox description
   BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(AnyImageToTypedImage);
-  BBTK_NAME(bbtk::HumanTypeName<anyImagePointer>() + "To"+bbtk::HumanTypeName<T>());
+  BBTK_NAME(bbtk::HumanTypeName<anyImagePointer>() + "To"
+           +bbtk::HumanTypeName<T>());
   BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
-  BBTK_DESCRIPTION("Transforms a generic itk image ("+
+  BBTK_DESCRIPTION("Converts a generic itk image pointer ("+
                   bbtk::HumanTypeName<anyImagePointer>()+
-                  ") into a typed itk image ("+
-                  bbtk::HumanTypeName<T>()+"*)");
+                  ") into a typed itk image pointer ("+
+                  bbtk::HumanTypeName<T>()+")");
   BBTK_DEFAULT_ADAPTOR();
   BBTK_CATEGORY("adaptor");
   BBTK_TEMPLATE_INPUT(AnyImageToTypedImage,In,
-                     "Input generic image",anyImagePointer);
+                     "Input generic image pointer",anyImagePointer);
   BBTK_TEMPLATE_OUTPUT(AnyImageToTypedImage,Out,
-                       "Output typed image",T);
+                       "Output typed image pointer",T);
   BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(AnyImageToTypedImage);
   //=================================================================
   
@@ -75,19 +76,19 @@ namespace bbitk
   //=================================================================
   // BlackBox description
   BBTK_BEGIN_DESCRIBE_TEMPLATE2_BLACK_BOX(AnyImageToConstTypedImage);
-  BBTK_NAME("Convert<"+bbtk::TypeName<anyImagePointer>() + "," +
-           bbtk::TypeName<T2>()+">");
+  BBTK_NAME(bbtk::HumanTypeName<anyImagePointer>() + "To" +
+           bbtk::HumanTypeName<T2>());
   BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
-  BBTK_DESCRIPTION("Transforms a generic itk image ("+
-                  bbtk::TypeName<anyImagePointer>()+
-                  ") into a typed itk image ("+
-                  bbtk::TypeName<T2>()+"*)");
+  BBTK_DESCRIPTION("Converts a generic itk image pointer ("+
+                  bbtk::HumanTypeName<anyImagePointer>()+
+                  ") into a const typed itk image pointer ("+
+                  bbtk::HumanTypeName<T2>()+")");
   BBTK_CATEGORY("adaptor");
   BBTK_DEFAULT_ADAPTOR();
   BBTK_TEMPLATE2_INPUT(AnyImageToConstTypedImage,In,
-                     "Input generic image",anyImagePointer);
+                     "Input generic image pointer",anyImagePointer);
   BBTK_TEMPLATE2_OUTPUT(AnyImageToConstTypedImage,Out,
-                       "Output typed image",T2);
+                       "Output const typed image pointer",T2);
   BBTK_END_DESCRIBE_TEMPLATE2_BLACK_BOX(AnyImageToConstTypedImage);
   //=================================================================
   
index 2e674625dfdc4fe6e9d6722a4d888f6447bfd809..88eea1af5f5bf80ce391580fd1e8bd07f8db1d04 100644 (file)
@@ -532,6 +532,18 @@ n += std::string("ptr"); \
  n+= HumanTypeName<TYPE>(); \
        n += std::string(#DIM); \
 n+= std::string("ptr"); \
+       return n; }                                                     \
+template <> inline std::string HumanTypeName< bbitk::Image_##TYPE##_##DIM##_cptr >()           \
+  { std::string n("itkImage"); \
+       n+= HumanTypeName<TYPE>();\
+ n += std::string(#DIM);\
+n += std::string("cptr"); \
+       return n; }                                                     \
+    template <> inline std::string HumanTypeName< bbitk::Image_##TYPE##_##DIM##_cptr >(const bbitk::Image_##TYPE##_##DIM##_cptr &)     \
+    { std::string n("itkImage");\
+ n+= HumanTypeName<TYPE>(); \
+       n += std::string(#DIM); \
+n+= std::string("cptr"); \
        return n; }
 
 //BBTK_HUMAN_READABLE_ITK_IMAGE(int8_t,2);                     
index ed7ee3591c5785701fea49934da2e6f3a4717803..50efb5031f1e6cac262155114895285406855b61 100644 (file)
@@ -30,8 +30,9 @@ namespace bbitk
   BBTK_NAME(bbtk::HumanTypeName<T>()
            + "To" + bbtk::HumanTypeName<anyImagePointer>());
   BBTK_AUTHOR("laurent.guigues at creatis.insa-lyon.fr");
-  BBTK_DESCRIPTION("Transforms a typed itk image ("+bbtk::HumanTypeName<T>()+
-                  ") into a generic itk image ("+
+  BBTK_DESCRIPTION("Converts a typed itk image pointer ("
+                  +bbtk::HumanTypeName<T>()+
+                  ") into a generic itk image pointer ("+
                   bbtk::HumanTypeName<anyImagePointer>()+")");
   BBTK_CATEGORY("adaptor");
   BBTK_DEFAULT_ADAPTOR();
index 951f92eaa6214d189c5e44d9f1ac955e4ced863f..79f575e3e564a2290e4ba6a48619a4f7a16aa42e 100644 (file)
@@ -66,7 +66,7 @@ namespace bbstd
   BBTK_BEGIN_DESCRIBE_BLACK_BOX(MagicBox,bbtk::AtomicBlackBox);
   BBTK_NAME("MagicBox");
   BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
-  BBTK_CATEGORY("adaptor");
+  BBTK_CATEGORY("misc");
   BBTK_DESCRIPTION("Takes *any kind* of data and copies it to its output. Is a magic box as any box output can be plugged into it and its output can be plugged into any other box input (dynamic type checking, see below), hence it can be put between **any** two boxes. Type matching between its output and the input of the box(es) to which it is connected is made at *run-time*. The pipeline will be executed if the data types : i) match exactly ii) can be transformed by an adaptor iii) are related pointers, i.e. if the output pointer can be upcasted (static_cast) or downcasted (dynamic_cast) to an input type pointer (see the bbtk::any output connection rule in the guide for details). Important uses of the MagicBox are : 1) performing run-time pointer cast, either upward or backward an object hierarchy 2) perform data adaptation (adaptor creation) at run-time vs. pipeline creation time.");
   AddInputDescriptor
   (new bbtk::AtomicBlackBoxInputDescriptor
index e145569cd9e8afa8c6a97a4b29252d75f8578fa7..c31ba56e1a0a8a01da1d05ceb39e933425706a06 100644 (file)
@@ -27,7 +27,7 @@ namespace bbstd
   BBTK_CATEGORY("adaptor");
   BBTK_DEFAULT_ADAPTOR();
   BBTK_DESCRIPTION("Converts the content of the input string to a "
-                  +bbtk::TypeName<std::vector<T> >()
+                  +bbtk::HumanTypeName<std::vector<T> >()
                   +" ("+bbtk::TypeName<std::vector<T> >()+")");
   BBTK_TEMPLATE_INPUT(StringToVector, In,"Input",std::string);
   typedef std::vector<T> Tvector;
index be651caeb03c67469591f321eca9bedad7ac5831..50bffc51d40e60a6e18f77765652fc0567783a52 100644 (file)
@@ -23,7 +23,7 @@ namespace bbstd
   //=================================================================
   // BlackBox description
   BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(VectorToString);
-  BBTK_NAME(bbtk::TypeName<std::vector<T> >()+"ToString");
+  BBTK_NAME(bbtk::HumanTypeName<std::vector<T> >()+"ToString");
   BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
   BBTK_CATEGORY("adaptor");
   BBTK_DEFAULT_ADAPTOR();