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

HxUpoSetPartImage.h

00001 /*
00002  *  Copyright (c) 2002, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *  Author(s):
00006  *  Leon Todoran (todoran@science.uva.nl)
00007  *
00008  */
00009 
00012 #ifndef HxUpoSetPartImage_h
00013 #define HxUpoSetPartImage_h
00014 
00015 #include "HxTagList.h"
00016 #include "HxClassName.h"
00017 #include "HxCategories.h"
00018 
00019 #include "HxValue.h"
00020 
00021 
00023 
00024 template<class DstValT, class SrcValT>
00025 class HxUpoSetPartImage
00026 {
00027 public:
00029     typedef HxTagTransVar TransVarianceCategory;
00030 
00031                         HxUpoSetPartImage(HxTagList& tag) {
00032                         x1=HxGetTag(tag,"x1",0);
00033                         y1=HxGetTag(tag,"y1",0);
00034                         x2=HxGetTag(tag,"x2",0);
00035                         y2=HxGetTag(tag,"y2",0);
00036 
00037                         inside=HxGetTag(tag,"inside",true);
00038 
00039                         HxValue hv = HxGetTag<HxValue>(tag,"val");
00040                         val = hv;
00041                         }
00042 
00043     DstValT             doIt(const SrcValT& v, int x, int y, int z)
00044                         {
00045                             if(inside)
00046                             {           
00047                                 if(x>=x1 && x<=x2 && y>=y1 && y<=y2)
00048                                     return val;
00049                                 return v;
00050                             }
00051                             else //fill the outside of specified rectangle
00052                             {           
00053                                 if(x>=x1 && x<=x2 && y>=y1 && y<=y2)
00054                                     return v;
00055                                 return val;
00056                             }
00057 
00058                         }
00059     static HxString     className() { return HxString("setPartImg"); }
00060 private:
00061     int x1,y1,x2,y2;
00062     SrcValT val;
00063     bool inside;
00064 };
00065 
00066 
00067 #endif
00068 

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