Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxImageRep.h

00001 /*
00002  *  Copyright (c) 1998, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *  Author(s):
00006  *  Dennis Koelma           (koelma@wins.uva.nl)
00007  *  Edo Poll                (poll@wins.uva.nl)
00008  */
00009 
00010 #ifndef HxImageRep_h
00011 #define HxImageRep_h
00012 
00013 #include "HxValueType.h"
00014 #include "HxValue.h"
00015 #include "HxValueList.h"
00016 #include "HxPoint.h"
00017 #include "HxPointList.h"
00018 #include "HxByte.h"
00019 #include "HxImageSignature.h"
00020 #include "HxSizes.h"
00021 #include "HxString.h"
00022 #include "HxStringList.h"
00023 #include "HxMatrix.h"
00024 #include "HxGeoIntType.h"
00025 #include "HxGeoTransType.h"
00026 #include "HxTagList.h"
00027 
00028 
00029 #undef min
00030 #undef max
00031 
00032 class HxImageList;
00033 
00034 #include "HxRcObject.h"
00035 #include "HxRcPtr.h"
00036 
00037 class HxImageData;
00038 typedef HxRcPtr<HxImageData> HxImageDataRcPtr;
00039 
00040 class HxImageFactory;
00041 
00042 class HxObjectObserver;
00043 class HxImageGenerator;
00044 
00049 class L_HXIMAGEREP HxImageRep {
00050 public:
00051 
00052 
00054 
00056                         HxImageRep();
00057 
00059                         HxImageRep(const HxImageRep&);
00060 
00062 
00064 
00066                         ~HxImageRep();
00068 
00070 
00072     HxImageRep&         operator=(const HxImageRep&);
00073 
00075     int                 operator==(const HxImageRep& arg) const;
00076 
00078     int                 isNull() const;
00079 
00081                         operator int() const;
00083 
00085 
00087     int                 ident() const;
00088 
00090     HxString            name() const;
00091 
00093     void                name(HxString s);
00094 
00096     int                 dimensionality() const;
00097 
00101     int                 dimensionSize(int i) const;
00102 
00104     HxSizes             sizes() const;
00105 
00107     int                 numberOfPixels() const;
00108 
00110     int                 pixelDimensionality() const;
00111 
00115     HxValueType         pixelType() const;
00116 
00121     int                 pixelPrecision() const;
00122 
00124     HxImageSignature    signature() const;
00126 
00128 
00135     HxImageRep          unaryPixOp(HxString upoName,
00136                             HxTagList& tags = HxMakeTagList()) const;
00137 
00142 //    HxImageRep          unaryPixOp(HxUpoVec3Double func) const;
00143 
00145 
00147 
00154     HxImageRep          binaryPixOp(const HxValue arg, HxString bpoName,
00155                             HxTagList& tags = HxMakeTagList()) const;
00156 
00162     HxImageRep          binaryPixOp(const HxImageRep arg, HxString bpoName,
00163                             HxTagList& tags = HxMakeTagList()) const;
00164 
00169     //HxImageRep          binaryPixOp(const HxImageRep arg,
00170 //                                    HxBpoVec3Double func) const;
00171 
00173 
00175 
00183     HxImageRep          multiPixOp(const HxImageList& args,
00184                             HxString mpoName,
00185                             HxTagList& tags = HxMakeTagList()) const;
00186 
00193     HxImageList         MNPixOp(const HxImageList& args,
00194                             HxString mpoName, 
00195                             HxTagList& tags = HxMakeTagList()) const;
00197 
00199 
00202     void                exportOp(HxString exportName,
00203                             HxTagList& tags = HxMakeTagList()) const;
00204 
00206     void                exportOpExtra(HxString exportName,
00207                             HxImageRep extraIm,
00208                             HxTagList& tags = HxMakeTagList()) const;
00209 
00216     HxValue             reduceOp(HxString op,
00217                             HxTagList& tags = HxMakeTagList()) const;
00218 
00220 
00239     enum                ResultPrecision {
00240                             DEFAULT_PREC, SOURCE_PREC,
00241                             ARITH_PREC, SMALL_PREC};
00242 
00244     static void         setDefaultResultPrecision(ResultPrecision resPrec);
00245 
00247     static ResultPrecision     getResultPrecision(
00248                             ResultPrecision resPrec = DEFAULT_PREC);
00249 
00251 
00263     HxImageRep          generalizedConvolution(
00264                             HxImageRep kerImg,
00265                             HxString gMul, HxString gAdd,
00266                             ResultPrecision resPrec = DEFAULT_PREC,
00267                             HxTagList& tags = HxMakeTagList()) const;
00268 
00286     HxImageRep          generalizedConvolutionK1d(
00287                             int dimension, HxImageRep kerImg,
00288                             HxString gMul, HxString gAdd,
00289                             ResultPrecision resPrec = DEFAULT_PREC,
00290                             HxTagList& tags = HxMakeTagList()) const;
00291 
00310     HxImageRep          genConvSeparated(
00311                             HxImageRep kernel,
00312                             HxString gMul, HxString gAdd,
00313                             ResultPrecision resPrec = DEFAULT_PREC,
00314                             HxTagList& tags = HxMakeTagList()) const;
00315 
00334     HxImageRep          genConv2dSep(
00335                             HxImageRep kernel1, HxImageRep kernel2,
00336                             HxString gMul, HxString gAdd,
00337                             ResultPrecision resPrec = DEFAULT_PREC,
00338                             HxTagList& tags = HxMakeTagList()) const;
00339 
00358     HxImageRep          genConv3dSep(
00359                             HxImageRep kernel1, HxImageRep kernel2,
00360                             HxImageRep kernel3,
00361                             HxString gMul, HxString gAdd,
00362                             ResultPrecision resPrec = DEFAULT_PREC,
00363                             HxTagList& tags = HxMakeTagList()) const;
00364 
00366 
00367 
00369 
00388     HxImageRep          recGenConv(
00389                             HxImageRep kerImg,
00390                             HxString gMul, HxString gAdd,
00391                             ResultPrecision resPrec = DEFAULT_PREC,
00392                             HxTagList& tags = HxMakeTagList()) const;
00393 
00419     HxImageRep          recGenConv2dSep(
00420                             HxImageRep kernel1, HxImageRep kernel2,
00421                             HxString gMul, HxString gAdd,
00422                             ResultPrecision resPrec = DEFAULT_PREC,
00423                             HxTagList& tags = HxMakeTagList()) const;
00424 
00426 
00427 
00429 
00438     HxImageRep          neighbourhoodOp(
00439                             HxString ngbName,
00440                             HxTagList& tags = HxMakeTagList()) const;
00441 
00449     HxImageRep          neighbourhoodOpExtra(
00450                             HxString ngbName,
00451                             HxImageRep extraIm,
00452                             HxTagList& tags = HxMakeTagList()) const;
00453 
00461     HxImageRep          neighbourhoodOpExtra2(
00462                             HxString ngbName,
00463                             HxImageRep extraIm, HxImageRep extraIm2,
00464                             HxTagList& tags = HxMakeTagList()) const;
00465 
00474     HxImageRep          neighbourhoodOp(
00475                             HxImageRep kernel, HxString ngbName,
00476                             HxTagList& tags = HxMakeTagList()) const;
00478 
00479 
00481 
00485     HxImageRep          queueBasedOp(
00486                             HxImageRep kernel, HxString qName, 
00487                             HxTagList& tags = HxMakeTagList()) const;
00489 
00490 
00492 
00494                         // matrix needs to be 4x4 (homogeneous coordinates)
00495 //    HxImageRep          geometricOp(HxMatrix func, HxGeoIntType gi = LINEAR) const;
00496 
00510     HxImageRep          geometricOp2d(HxMatrix func, HxGeoIntType gi = LINEAR,
00511                             HxGeoTransType gt = FORWARD, int adjustSize = 1,
00512                             HxValue background = HxValue(0)) const;
00513 
00515 
00516 
00518 
00525     HxImageRep          diyOp(
00526                             HxString diyName,
00527                             HxTagList& tags = HxMakeTagList()) const;
00529 
00530 
00532 
00535     void                setAt(const HxValue v, int x, int y = 0, int z = 0);
00536 
00538     HxValue             getAt(int x, int y = 0, int z = 0) const;
00539 
00541     STD_OSTREAM&        printInfo(STD_OSTREAM& os, int doData = 0);
00542 
00544 
00545 
00547 
00561     void                getRgbPixels2d(int* pixels, HxString displayMode,
00562                             int resWidth = -1, int resHeight = -1,
00563                             HxGeoIntType gi = NEAREST) const;
00564 
00566     void                getRgbPixels2d(int* pixels, HxString displayMode,
00567                             int bufWidth, int bufHeight,
00568                             int VX, int VY, int VW, int VH,
00569                             double SX, double SY, double scaleX, double scaleY,
00570                             HxGeoIntType gi) const;
00571 
00573     void                getRgbPixels3d(int* pixels, HxString displayMode,
00574                             int dimension, int coordinate,
00575                             int resWidth = -1, int resHeight = -1,
00576                             HxGeoIntType gi = NEAREST) const;
00577 
00579 
00581 
00582 
00583     HxImageData*        dirty() { return pointee(); }
00584 
00586     static void         setObjectObserver(const HxObjectObserver&);
00588     static void         setImageDataObserver(const HxObjectObserver&);
00589 
00591     HxString            ref() const;
00592 
00594 
00597 private:
00598     friend class        HxImageFactory;
00599     friend class        HxImageRepInit;
00600 
00601                         HxImageRep(const HxImageData*);
00602                         void construct(const HxImageSignature&, HxSizes);
00603 
00604 
00605 // Deprecated interface.
00610                         HxImageRep(
00611                             int pixelDimensionality, HxValueType pixelType,
00612                             int pixelPrecision, int dimensions,
00613                             int dimSize1, int dimSize2 = 1, int dimSize3 = 1);
00614 
00619                         HxImageRep(
00620                             const HxImageSignature& signature, HxSizes sizes);
00621 
00627                         HxImageRep(
00628                             const HxImageSignature& signature, HxImageRep);
00629 
00635                         HxImageRep(const HxImageSignature& signature,
00636                             HxSizes sizes, HxValue val);
00637 
00643                         HxImageRep(
00644                             int pixelDimensionality, int dimensions,
00645                             HxSizes sizes, HxByte* pixels);
00646 
00652                         HxImageRep(
00653                             int pixelDimensionality, int dimensions,
00654                             HxSizes sizes, short* pixels);
00655 
00661                         HxImageRep(
00662                             int pixelDimensionality, int dimensions,
00663                             HxSizes sizes, int* pixels);
00664 
00670                         HxImageRep(
00671                             int pixelDimensionality, int dimensions,
00672                             HxSizes sizes, float* pixels);
00673 
00679                         HxImageRep(
00680                             int pixelDimensionality, int dimensions,
00681                             HxSizes sizes, double* pixels);
00682 
00689                         HxImageRep(const HxImageSignature& signature,
00690                             HxSizes sizes, int* pixels);
00691 
00697                         HxImageRep(const HxImageSignature& signature,
00698                             HxSizes sizes, HxByte* pixels);
00699 
00706                         HxImageRep(const HxImageSignature& signature,
00707                             HxSizes sizes, double* pixels);
00708 
00714                         HxImageRep(
00715                             const HxImageSignature& signature,
00716                             const HxImageGenerator* imgGenerator);
00717 
00724                         HxImageRep(
00725                             const HxImageSignature& signature,
00726                             HxSizes sizes, HxString importOp,
00727                             HxTagList& = HxMakeTagList());
00728 
00737                         HxImageRep(HxImageRep i1, HxImageRep i2);
00738 
00747                         HxImageRep(HxImageRep i1, HxImageRep i2, HxImageRep i3);
00748 
00749     HxImageRep          projectRange(int dimension) const;
00750     HxImageRep          inverseProjectRange(int dimension,
00751                             const HxImageRep arg) const;
00752 
00753     HxImageRep          restrict(HxPoint begin, HxPoint end) const;
00754     HxImageRep          extend(HxSizes newSize, HxValue background,
00755                             HxPoint begin = HxPoint(0, 0, 0)) const;
00756     HxImageRep          extend(HxImageRep background,
00757                             HxPoint begin = HxPoint(0, 0, 0)) const;
00758 
00770     HxImageRep          projectDomain(int dimension, int coordinate) const;
00771 
00776     HxImageRep          inverseProjectDomain(int dimension, int coordinate,
00777                             const HxImageRep arg) const;
00778 
00779     static HxImageRep   makeGaussian(
00780                             double sigma, int deri, double acc,
00781                             int fsize, int maxfsize);
00782 
00783 
00787     void                getValues(
00788                             HxPointListConstIter first,
00789                             HxPointListConstIter last,
00790                             HxValueListBackInserter);
00791 
00795     void                getDoublePixels(double* pixels);
00796 
00817     HxImageRep          genConvSeparated(
00818                             int dimension,
00819                             HxImageRep kernel1, HxImageRep kernel2,
00820                             HxString gMul, HxString gAdd,
00821                             ResultPrecision resPrec = DEFAULT_PREC,
00822                             HxTagList& tags = HxMakeTagList()) const;
00823 
00824 friend HxImageRep L_HXIMAGEREP HxProjectRange(HxImageRep im, int dimension);
00825 friend HxImageRep L_HXIMAGEREP HxInverseProjectRange(HxImageRep im, int dimension, HxImageRep arg);
00826 friend HxImageRep L_HXIMAGEREP HxRestrict(HxImageRep img, HxPoint begin, HxPoint end);
00827 friend HxImageRep L_HXIMAGEREP HxExtend(HxImageRep img, HxImageRep background, HxPoint begin);
00828 friend HxImageRep L_HXIMAGEREP HxExtendVal(HxImageRep img, HxSizes newSize, HxValue background, HxPoint begin);
00829 
00830 friend void L_HXIMAGEREP HxGetValues(HxImageRep img, HxPointListConstIter first, HxPointListConstIter last, HxValueListBackInserter valPtr);
00831 
00832 friend void       L_HXIMAGEREP HxExportMatlabPixels(HxImageRep img, double* pixels);
00833 
00834 
00835 
00836 #pragma warning (disable : 4251)
00837 
00838     HxImageDataRcPtr    _pointee;
00839 
00840 #pragma warning (default : 4251)
00841 
00842     HxImageData*        pointee() const;
00843 
00844     HxImageRep          errorIm(HxString msg) const;
00845 
00846     static const HxObjectObserver*  _objectObserver;
00847 
00848     static ResultPrecision          _defaultResPrec;
00849 
00850 };
00851 
00852 inline HxString
00853 ClassName(const HxImageRep&)
00854 {
00855     return "HxImageRep";
00856 }
00857 
00858 inline HxString
00859 makeString(const HxImageRep& i)
00860 {
00861     return HxString("HxImageRep") + makeString(i.ident());
00862 }
00863 
00864 #endif

Generated on Tue Feb 3 14:18:35 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001