--- /dev/null
+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
--- /dev/null
+#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
//=================================================================
// 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);
//=================================================================
//=================================================================
// 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);
//=================================================================
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);
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();
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
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;
//=================================================================
// 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();