#ifndef REGIONSET_HEADER #define REGIONSET_HEADER ////////////////////////////////////////////////////////////// //! docentry="Image.Image Processing.Region.Data Structures" //! userlevel=Normal //! example="exSeg.cc" //! file="amma/Image/IPStream/IPRegion/RegionSet.hh" //! rcsid="$Id: RegionSet.hh,v 1.12 2000/12/14 09:55:20 ees1cg Exp $" //! lib=IPRegion //! author="Roshano Roberts" //! date="12/06/98" #include "amma/RCHandle.hh" #include "amma/Num/NumLabel.hh" #include "amma/Num/NumDataSet.hh" #include "amma/Region/RegionSetB.hh" #include "amma/DList.hh" #include "amma/Image.hh" #include "amma/ImageRec.hh" // --------------------------------------------------------------------------- // ********** RegionSetC *************************************************** // --------------------------------------------------------------------------- //: Class for representing the segmentation template class RegionSetC : public RCHandleC > { public: RegionSetC() : RCHandleC > (*new RegionSetBodyC()) {} //: Default constructor RegionSetC(const ImageC & map, const NumDataSetC & stats) : RCHandleC > (*new RegionSetBodyC(map, stats)) {} //: Constructor from the segmentation map and the associated statistics for each region inline ImageC Image() const; //: Returns the segmentation map inline NumDataSetC Stats() const; //: Returns the statistics associated to each region in the segmentation map inline NumDataSetC & Stats(); //: Returns the statistics associated to each region in the segmentation map inline ByteImageC ByteImage() const; //: Returns the segmentation map in the form of a ByteImageC inline IntImageC IntImage() const; //: Returns the segmentation map in the form of a IntImageC inline RGBImageC RandomImage() const; //: Returns the segmentation map in the form of a colour random image inline YUVImageC RandomTaintImage(ByteGreyValueT max=100) const; //: Returns the segmentation map in the form of a colour random image. The Y channel is left blank (e.g., for displaying the original data). The labels in the U and V channels are in the range 0 to 'max'. inline void SetMap(const IntImageC & map); //: The segmentation map for this is changed to map; UpdateStats should be performed after this operation template void UpdateStats(const ImageC & img); //: Calculates the statistics of the regions in the segmentation map from scratch inline void MakeConnectedComponents(); //: Connected component labelling is performed on the segmentation map; Each new component is given the same statistic as the coreesponding previous region inline void MakeConnectedComponents(const ByteImageC & roi); //: Connected component labelling is performed on the segmentation map; Each new component is given the same statistic as the coreesponding previous region. The whole operation is performed on the region of interest "roi". The region of interest should be labelled 0 and all other pixels in the image should be labelled 1. In the output segmentation map, the pixels outside the region of interest are undefined. protected: RegionSetC(RegionSetBodyC &bod) : RCHandleC >(bod) {} //: Constructor from the body class }; template inline ImageC RegionSetC::Image() const { return Body().Image(); } template inline NumDataSetC RegionSetC::Stats() const { return Body().Stats(); } template inline NumDataSetC & RegionSetC::Stats() { return Body().Stats(); } template inline ByteImageC RegionSetC::ByteImage() const { return Body().ByteImage(); } template inline IntImageC RegionSetC::IntImage() const { return Body().IntImage(); } template inline RGBImageC RegionSetC::RandomImage() const { return Body().RandomImage(); } template inline YUVImageC RegionSetC::RandomTaintImage(ByteGreyValueT max) const { return Body().RandomTaintImage(max); } template inline void RegionSetC::SetMap(const IntImageC & map) { Body().SetMap(map); } template template void RegionSetC::UpdateStats(const ImageC & img) { Body().UpdateStats(img); } template inline void RegionSetC::MakeConnectedComponents() { Body().MakeConnectedComponents(); } template inline void RegionSetC::MakeConnectedComponents(const ByteImageC & roi) { Body().MakeConnectedComponents(roi); } #endif