00001 /* 00002 * Copyright (c) 2002, University of Amsterdam, The Netherlands. 00003 * All rights reserved. 00004 * 00005 * 00006 * Author(s): 00007 * Dennis Koelma (koelma@science.uva.nl) 00008 */ 00009 00010 #ifndef HxSegmentation2d_h 00011 #define HxSegmentation2d_h 00012 00013 #include "HxImageRep.h" 00014 //#include "HxBlob2d.h" 00015 #include "HxBlob2dList.h" 00016 #include <map> 00017 00018 class HxBlob2dRelation; 00019 00020 00025 class HxSegmentation2d 00026 { 00027 public: 00029 HxSegmentation2d(); 00030 00032 HxSegmentation2d(HxImageRep inputIm, HxImageRep labIm); 00033 00035 ~HxSegmentation2d(); 00036 00038 int ident() const; 00039 00041 void setInputImage(HxImageRep inputIm); 00042 00044 HxImageRep getInputImage() const; 00045 00047 void setLabeledImage(HxImageRep labIm); 00048 00050 HxImageRep getLabeledImage() const; 00051 00052 00056 void addBlob(HxBlob2d* blob); 00057 00059 void addBlob(int label, int xmin, int ymin, 00060 int width, int height); 00061 00063 HxBlob2dListConstIter getBlobBegin() const; 00064 00066 HxBlob2dListConstIter getBlobEnd() const; 00067 00069 HxBlob2dListBackInserter getBlobInserter(); 00070 00071 00075 void addRelation(HxString name, HxBlob2dRelation* rel); 00076 00078 HxBlob2dRelation* getRelation(HxString name) const; 00079 00080 00082 STD_OSTREAM& put(STD_OSTREAM& os) const; 00083 00084 private: 00085 // forbid copy construction until it is implemented 00086 HxSegmentation2d(const HxSegmentation2d&) {} 00087 00088 int _ident; // unique identifier 00089 HxImageRep _inputImage; 00090 HxImageRep _labImage; // visualization of the Blob's 00091 HxBlob2dList _blobs; 00092 std::map<HxString, HxBlob2dRelation*> _relations; 00093 00094 static int _nr; 00095 }; 00096 00097 inline STD_OSTREAM& 00098 operator<<(STD_OSTREAM& os, const HxSegmentation2d& seg) 00099 { 00100 return seg.put(os); 00101 } 00102 00103 inline HxString 00104 makeString(const HxSegmentation2d& b) 00105 { 00106 return HxString("HxSegmentation2d") + makeString(b.ident()); 00107 } 00108 00109 #endif