3 #ifndef __bbitkImageRegion_h_INCLUDED__
4 #define __bbitkImageRegion_h_INCLUDED__
6 #include "itkImageRegion.h"
7 #include "bbtkMessageManager.h"
9 #include "bbtkAtomicBlackBox.h"
13 //=======================================================================
14 /// Type traits ImageRegion to define bbtk::any<ImageRegion>
15 template <typename T> struct ImageRegion { static const bool value = false; };
16 // Specialisations for instantiated image types
17 #ifdef BBTK_ITK_IMAGE_DIM_2
18 typedef itk::ImageRegion<2> ImageRegion_2;
19 template <> struct ImageRegion<ImageRegion_2> { static const bool value = true; };
21 #ifdef BBTK_ITK_IMAGE_DIM_3
22 typedef itk::ImageRegion<3> ImageRegion_3;
23 template <> struct ImageRegion<ImageRegion_3> { static const bool value = true; };
25 #ifdef BBTK_ITK_IMAGE_DIM_4
26 typedef itk::ImageRegion<4> ImageRegion_4;
27 template <> struct ImageRegion<ImageRegion_4> { static const bool value = true; };
31 typedef bbtk::any<ImageRegion> anyImageRegion;
36 /// Human readable name for bbtk::any<bbitk::ImageRegion>
37 BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(bbitk::anyImageRegion,"anyItkImageRegion");
44 //=======================================================================
45 /// Black Box which creates an anyImageRegion
46 class /*BBTK_EXPORT*/ ImageRegionCreator
47 : public bbtk::AtomicBlackBox
49 BBTK_USER_BLACK_BOX_INTERFACE(ImageRegionCreator,bbtk::AtomicBlackBox);
50 BBTK_DECLARE_INPUT(Index,std::vector<long>);
51 BBTK_DECLARE_INPUT(Size,std::vector<long>);
52 BBTK_DECLARE_OUTPUT(Out,anyImageRegion);
56 template <unsigned int Dimension> void DoIt();
60 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageRegionCreator,bbtk::AtomicBlackBox);
61 BBTK_NAME("ImageRegion");
62 BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
63 BBTK_DESCRIPTION("Creates a generic ImageRegion ("+bbtk::TypeName<anyImageRegion>()+") from two vectors providing the index and size of the region. The dimension D of the actual itk::ImageRegion<D> created is the max of the sizes of Index and Size (the smallest vector is padded by zeros).");
64 BBTK_CATEGORY("image");
65 typedef std::vector<long> vectoroflong;
66 BBTK_INPUT(ImageRegionCreator,Index,"Vector of region indices",
68 BBTK_INPUT(ImageRegionCreator,Size,"Vector of region sizes",
70 BBTK_OUTPUT(ImageRegionCreator,Out,"Output generic region",anyImageRegion);
71 BBTK_END_DESCRIBE_BLACK_BOX(ImageRegionCreator);