//! file="amma/Image/RegModel/PolynRMo.hh" //! lib=RegModel //! userlevel=Default //! author="Radek Marik" //! docentry="Image.Image Processing.Region Model" //! rcsid="$Id: PolynRMo.hh,v 1.10 1999/03/29 11:16:39 ees1cg Exp $" //! date="17/08/95" /* IAPS - Image analysis program system - include file File name : PolRModel.hh Description: polynomial model of region surface Last change: 26.12.1992 Author : R. Marik Libraries : iaps _____________________________________________________________________ Modifications: */ #ifndef POLRMODEL_HH #define POLRMODEL_HH #include "amma/Boolean.hh" #include "amma/StdType.hh" #include "amma/GreyVal.hh" #include "amma/ByteImag.hh" #include "amma/Polynomi.hh" #include "amma/LqSystem.hh" #include "amma/RegSrch.hh" #include "amma/Filename.hh" class EdgeC; class PixelC; //------------------------------------------------------------------- //+++++++++ RegionPolynBoundC +++++++++++++++++++++++++++++++++++++++ //------------------------------------------------------------------- // The class RegionPolynBoundC contains the description of the image region. // The region is described by its boundary and the polynomial surface. class RegionPolynBoundC: public BoundaryC, public PolynomialC { public: // Constructors, copies, assigment, and destructor // ----------------------------------------------- RegionPolynBoundC(BoundaryC & boundary, PolynomialC & pol, GreyValueT label); // Creates the description of the region with the image surface // aproximated by the polynomial 'pol' with the domain restricted // by the 'boundary'. The region has got the 'label'. RegionPolynBoundC(const RegionPolynBoundC & region); // Copy constructor. GreyValueT Label(); // Returns the label of the region. private: GreyValueT colour; // The region label. }; /*------------------------------------------------------------------*/ /***************** PolRModelC ***************************************/ /*------------------------------------------------------------------*/ class PolRModelC { public: PolRModelC(ByteImageC & origImage, ByteImageC & seedImage, ByteImageC & edgeImage, RealT ratioArea, RealT modelErr, int modelOrder, int eThr, const RealT addingRatio); void SetLabel(GreyValueT colour); void SetOrder(int order); RegionPolynBoundC Search(PixelC & pxl); void SpreadIfPossible(RegionPolynBoundC & region); void SaveAs(const FilenameC & name); BooleanT IsProcessed(PixelC & pxl); private: ByteImageC orig; // original image ByteImageC dif; // image of diferences between original and model ByteImageC seed; // image of the suitable seeds ByteImageC edges; // image of the edge measure ByteImageC proc; // image of the processed pixels ByteImageC segm; // segmented image int edgeThr; // maximal edge measure in a region RealT errV; // model error int maxOrder; // maximal order of the polynomial model int actOrder; // actual order of the model GreyValueT label; // region colour in the segmented image RealT ratio; // new processed pixels / whole region long newPxls; // number of the new processed pixels BooleanT expandible; // model was changed during search PolynomialC pol; // polynomial region model LqSystemC lqS; // system solving model int spreadPixels; int thrSpread; RSControlC rsc; RealT minAddedRatio; // Criteria of homogeneity // ----------------------- // The following functions should be member functions of this class. // Unfortunately, this way of the implementation seems to be the only // one how to avoid a bug in GNU C++ 2.7.2. friend BooleanT SpreadModel(PolRModelC & model, const EdgeC & edge); friend BooleanT BuildModel(PolRModelC & model, const EdgeC & edge); friend BooleanT SetBetterModel(PolRModelC & model, const EdgeC & edge); friend BooleanT LastSpreadModel(PolRModelC & model,const EdgeC & edge); friend BooleanT SpreadIntoUnprocessed(PolRModelC & model,const EdgeC & edge); friend BooleanT ResetProcessed(PolRModelC & model, const EdgeC & edge); }; BooleanT SpreadModel(PolRModelC & model, const EdgeC & edge); BooleanT BuildModel(PolRModelC & model, const EdgeC & edge); // The new model is created from pixels which don't belong to any // region. The edge in the pixel and the distance from the model // must be enough small. BooleanT SetBetterModel(PolRModelC & model, const EdgeC & edge); BooleanT SetBetterModelContinue(PolRModelC & model, const EdgeC & edge); BooleanT LastSpreadModel(PolRModelC & model,const EdgeC & edge); BooleanT SpreadIntoUnprocessed(PolRModelC & model,const EdgeC & edge); BooleanT ResetProcessed(PolRModelC & model, const EdgeC & edge); #endif /* IAPS - Image analysis program system. End of include file PolRModel.hh */