From: guigues Date: Thu, 7 Feb 2008 12:27:07 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: r0.6.1~251 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=adf48958c2f25cfb4444a049cb0bce4c9e4bbabe;p=bbtk.git *** empty log message *** --- diff --git a/packages/itk/bbs/appli/ImageCrop.bbs b/packages/itk/bbs/appli/ImageCrop.bbs new file mode 100644 index 0000000..12262d8 --- /dev/null +++ b/packages/itk/bbs/appli/ImageCrop.bbs @@ -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 index 0000000..6e24f9d --- /dev/null +++ b/packages/itk/bbs/appli/ImageInfo.bbs @@ -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 diff --git a/packages/itk/src/bbitkAnyImageToTypedImage.h b/packages/itk/src/bbitkAnyImageToTypedImage.h index beb8a20..8b10cbe 100644 --- a/packages/itk/src/bbitkAnyImageToTypedImage.h +++ b/packages/itk/src/bbitkAnyImageToTypedImage.h @@ -26,18 +26,19 @@ namespace bbitk //================================================================= // BlackBox description BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(AnyImageToTypedImage); - BBTK_NAME(bbtk::HumanTypeName() + "To"+bbtk::HumanTypeName()); + BBTK_NAME(bbtk::HumanTypeName() + "To" + +bbtk::HumanTypeName()); 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()+ - ") into a typed itk image ("+ - bbtk::HumanTypeName()+"*)"); + ") into a typed itk image pointer ("+ + bbtk::HumanTypeName()+")"); 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() + "," + - bbtk::TypeName()+">"); + BBTK_NAME(bbtk::HumanTypeName() + "To" + + bbtk::HumanTypeName()); BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); - BBTK_DESCRIPTION("Transforms a generic itk image ("+ - bbtk::TypeName()+ - ") into a typed itk image ("+ - bbtk::TypeName()+"*)"); + BBTK_DESCRIPTION("Converts a generic itk image pointer ("+ + bbtk::HumanTypeName()+ + ") into a const typed itk image pointer ("+ + bbtk::HumanTypeName()+")"); 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); //================================================================= diff --git a/packages/itk/src/bbitkImage.h b/packages/itk/src/bbitkImage.h index 2e67462..88eea1a 100644 --- a/packages/itk/src/bbitkImage.h +++ b/packages/itk/src/bbitkImage.h @@ -532,6 +532,18 @@ n += std::string("ptr"); \ n+= HumanTypeName(); \ 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();\ + 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(); \ + n += std::string(#DIM); \ +n+= std::string("cptr"); \ return n; } //BBTK_HUMAN_READABLE_ITK_IMAGE(int8_t,2); diff --git a/packages/itk/src/bbitkTypedImageToAnyImage.h b/packages/itk/src/bbitkTypedImageToAnyImage.h index ed7ee35..50efb50 100644 --- a/packages/itk/src/bbitkTypedImageToAnyImage.h +++ b/packages/itk/src/bbitkTypedImageToAnyImage.h @@ -30,8 +30,9 @@ namespace bbitk BBTK_NAME(bbtk::HumanTypeName() + "To" + bbtk::HumanTypeName()); BBTK_AUTHOR("laurent.guigues at creatis.insa-lyon.fr"); - BBTK_DESCRIPTION("Transforms a typed itk image ("+bbtk::HumanTypeName()+ - ") into a generic itk image ("+ + BBTK_DESCRIPTION("Converts a typed itk image pointer (" + +bbtk::HumanTypeName()+ + ") into a generic itk image pointer ("+ bbtk::HumanTypeName()+")"); BBTK_CATEGORY("adaptor"); BBTK_DEFAULT_ADAPTOR(); diff --git a/packages/std/src/bbstdMagicBox.h b/packages/std/src/bbstdMagicBox.h index 951f92e..79f575e 100644 --- a/packages/std/src/bbstdMagicBox.h +++ b/packages/std/src/bbstdMagicBox.h @@ -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 diff --git a/packages/std/src/bbstdStringToVector.h b/packages/std/src/bbstdStringToVector.h index e145569..c31ba56 100644 --- a/packages/std/src/bbstdStringToVector.h +++ b/packages/std/src/bbstdStringToVector.h @@ -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 >() + +bbtk::HumanTypeName >() +" ("+bbtk::TypeName >()+")"); BBTK_TEMPLATE_INPUT(StringToVector, In,"Input",std::string); typedef std::vector Tvector; diff --git a/packages/std/src/bbstdVectorToString.h b/packages/std/src/bbstdVectorToString.h index be651ca..50bffc5 100644 --- a/packages/std/src/bbstdVectorToString.h +++ b/packages/std/src/bbstdVectorToString.h @@ -23,7 +23,7 @@ namespace bbstd //================================================================= // BlackBox description BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(VectorToString); - BBTK_NAME(bbtk::TypeName >()+"ToString"); + BBTK_NAME(bbtk::HumanTypeName >()+"ToString"); BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); BBTK_CATEGORY("adaptor"); BBTK_DEFAULT_ADAPTOR();