00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifdef _USE_ITK_
00033
00034 #ifndef __bbitkImageRegion_h_INCLUDED__
00035 #define __bbitkImageRegion_h_INCLUDED__
00036
00037 #include "itkImageRegion.h"
00038 #include "bbtkMessageManager.h"
00039 #include "bbtkAny.h"
00040 #include "bbtkAtomicBlackBox.h"
00041
00042 namespace bbitk
00043 {
00044
00046 template <typename T> struct ImageRegion { static const bool value = false; };
00047
00048 #ifdef BBTK_ITK_IMAGE_DIM_2
00049 typedef itk::ImageRegion<2> ImageRegion_2;
00050 template <> struct ImageRegion<ImageRegion_2> { static const bool value = true; };
00051 #endif
00052 #ifdef BBTK_ITK_IMAGE_DIM_3
00053 typedef itk::ImageRegion<3> ImageRegion_3;
00054 template <> struct ImageRegion<ImageRegion_3> { static const bool value = true; };
00055 #endif
00056 #ifdef BBTK_ITK_IMAGE_DIM_4
00057 typedef itk::ImageRegion<4> ImageRegion_4;
00058 template <> struct ImageRegion<ImageRegion_4> { static const bool value = true; };
00059 #endif
00060
00062 typedef bbtk::any<ImageRegion> anyImageRegion;
00063 }
00064
00065 namespace bbtk
00066 {
00068 BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(bbitk::anyImageRegion,"anyItkImageRegion");
00069 }
00070
00071
00072
00073 namespace bbitk
00074 {
00075
00077 class ImageRegionCreator
00078 : public bbtk::AtomicBlackBox
00079 {
00080 BBTK_BLACK_BOX_INTERFACE(ImageRegionCreator,bbtk::AtomicBlackBox);
00081 BBTK_DECLARE_INPUT(Index,std::vector<long>);
00082 BBTK_DECLARE_INPUT(Size,std::vector<long>);
00083 BBTK_DECLARE_OUTPUT(Out,anyImageRegion);
00084 BBTK_PROCESS(DoIt);
00085 private:
00086 void DoIt();
00087 template <unsigned int Dimension> void DoIt();
00088 };
00089
00090
00091 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageRegionCreator,bbtk::AtomicBlackBox);
00092 BBTK_NAME("ImageRegion");
00093 BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
00094 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).");
00095 BBTK_CATEGORY("image");
00096 typedef std::vector<long> vectoroflong;
00097 BBTK_INPUT(ImageRegionCreator,Index,"Vector of region indices",
00098 vectoroflong,"image index");
00099 BBTK_INPUT(ImageRegionCreator,Size,"Vector of region sizes",
00100 vectoroflong,"image size");
00101 BBTK_OUTPUT(ImageRegionCreator,Out,"Output generic region",anyImageRegion,"");
00102 BBTK_END_DESCRIBE_BLACK_BOX(ImageRegionCreator);
00103
00104 }
00105
00106
00107 #endif
00108 #endif