#ifndef __bbUtilitiesRegionGrowing2_h_INCLUDED__ #define __bbUtilitiesRegionGrowing2_h_INCLUDED__ #include "bbtkAtomicBlackBox.h" //INCLUDES #include "iostream" #include "vtkImageData.h" #include "MetzData.h" #define INVALIDO -1 #define NO_VISITADO 0 #define VALIDO 1 #define RADIO 2 #define VOXELS_LIMIT 30000 #define PI 3.1415926535897932384626433832795 namespace bbUtilities { class /*BBTK_EXPORT*/ RegionGrowing2 : public bbtk::AtomicBlackBox { //BBTK_USER_BLACK_BOX_INTERFACE(RegionGrowing2,bbtk::AtomicBlackBox); BBTK_BLACK_BOX_INTERFACE(RegionGrowing2,bbtk::AtomicBlackBox); //================================================================== //--------------------------------------------- //Declaration //---------------------------------------------- //INPUTS BBTK_DECLARE_INPUT(InImage,vtkImageData*); BBTK_DECLARE_INPUT(SeedPoint,std::vector); BBTK_DECLARE_INPUT(Upper, double) BBTK_DECLARE_INPUT(Lower, double) //OUTPUT BBTK_DECLARE_OUTPUT(OutImage,vtkImageData*); BBTK_PROCESS(Process); void Process(); //--------------------------------------------- //Methods //---------------------------------------------- protected: //--------------------------------------------- //ATRIBUTTES //---------------------------------------------- //Pointers to (x,y,z,number of voxels) //std::vector stack; //std::vector pointsStack; //initial image vtkImageData* initialImage; //filtered image vtkImageData* filteredImage; //seed point std::vector seedPoint; //upper unsigned short upper; //lower unsigned short lower; //image size int ext[6]; //first iteration std::vector firstIteration; //second iteration std::vector currentVector; //third iteration std::vector nextVector; int voxels; bool validNeighbor(int x, int y ,int z); int countValidPoints(int x, int y, int z); void connectivity(int x, int y, int z); void addNeighborsToVector(int x, int y, int z, std::vector* v, int it); void cleanVector(std::vector* v); void mark(int x,int y,int z, int it); bool isMarked(int x,int y,int z); }; //-------------------------------------------------------------------- //Documentation //-------------------------------------------------------------------- BBTK_BEGIN_DESCRIBE_BLACK_BOX(RegionGrowing2,bbtk::AtomicBlackBox); BBTK_NAME("RegionGrowing2"); BBTK_AUTHOR("Monica lozano (mo-lozan@uniandes.edu.co) y Fernando Martinez Santa (f.martinez227@uniandes.edu.co)"); BBTK_DESCRIPTION("Region growing propose by Metz paper"); BBTK_CATEGORY("__CATEGORY__"); //INPUTS BBTK_INPUT(RegionGrowing2,InImage,"Image to segment",vtkImageData*,""); BBTK_INPUT(RegionGrowing2,SeedPoint,"Seed point to star the algorithm",std::vector,""); BBTK_INPUT(RegionGrowing2,Upper,"Upper threshold value",double,""); BBTK_INPUT(RegionGrowing2,Lower,"Lower threshold value",double,""); //OUTPUTS BBTK_OUTPUT(RegionGrowing2,OutImage,"Image segmented",vtkImageData*,""); BBTK_END_DESCRIBE_BLACK_BOX(RegionGrowing2); } // EO namespace bbUtilities #endif // __bbUtilitiesRegionGrowing2_h_INCLUDED__