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

HxRestrict.h File Reference

More...

#include "HxImageRep.h"

Go to the source code of this file.

Functions

HxImageRep L_HXIMAGEREP HxRestrict (HxImageRep img, HxPoint begin, HxPoint end)
 Restriction of domain. More...


Detailed Description


Function Documentation

HxImageRep L_HXIMAGEREP HxRestrict HxImageRep    img,
HxPoint    begin,
HxPoint    end
 

Restriction of domain.

Restrict the domain of the image to the region specified by the given points. Points are treated as pixel coordinates (integers).

00013 {
00014     HxString fname("HxRestrict");
00015 
00016     if (img.isNull())
00017     {
00018         HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID);
00019         return HxImageRep();
00020     }
00021     if (begin.x() < 0)
00022     {
00023         HxGlobalError::instance()->reportError(fname, "begin.x less then 0", HxGlobalError::HX_GE_INVALID);
00024         return HxImageRep();
00025     }
00026     if (begin.y() < 0)
00027     {
00028         HxGlobalError::instance()->reportError(fname, "begin.y less then 0", HxGlobalError::HX_GE_INVALID);
00029         return HxImageRep();
00030     }
00031     if ((img.dimensionality() > 2) && (begin.z() < 0))
00032     {
00033         HxGlobalError::instance()->reportError(fname, "begin.y less then 0", HxGlobalError::HX_GE_INVALID);
00034         return HxImageRep();
00035     }
00036 
00037     if (end.x() < begin.x())
00038     {
00039         HxGlobalError::instance()->reportError(fname, "end.x less than begin.x", HxGlobalError::HX_GE_INVALID);
00040         return HxImageRep();
00041     }
00042     if (end.y() < begin.y())
00043     {
00044         HxGlobalError::instance()->reportError(fname, "end.y less than begin.y", HxGlobalError::HX_GE_INVALID);
00045         return HxImageRep();
00046     }
00047     if ((img.dimensionality() > 2) && (end.z() < begin.z()))
00048     {
00049         HxGlobalError::instance()->reportError(fname, "end.z less than begin.z", HxGlobalError::HX_GE_INVALID);
00050         return HxImageRep();
00051     }
00052     if (begin.x() > img.sizes().x())
00053     {
00054         HxGlobalError::instance()->reportError(fname, "begin.x greater then image size", HxGlobalError::HX_GE_INVALID);
00055         return HxImageRep();
00056     }
00057     if (begin.y() > img.sizes().y())
00058     {
00059         HxGlobalError::instance()->reportError(fname, "begin.y greater then image size", HxGlobalError::HX_GE_INVALID);
00060         return HxImageRep();
00061     }
00062     if ((img.dimensionality() > 2) && (begin.z() > img.sizes().z()))
00063     {
00064         HxGlobalError::instance()->reportError(fname, "begin.z greater then image size", HxGlobalError::HX_GE_INVALID);
00065         return HxImageRep();
00066     }
00067     if (end.x() > img.sizes().x())
00068     {
00069         HxGlobalError::instance()->reportError(fname, "end.x greater then image size", HxGlobalError::HX_GE_INVALID);
00070         return HxImageRep();
00071     }
00072     if (end.y() > img.sizes().y())
00073     {
00074         HxGlobalError::instance()->reportError(fname, "end.y greater then image size", HxGlobalError::HX_GE_INVALID);
00075         return HxImageRep();
00076     }
00077     if ((img.dimensionality() > 2) && (end.z() > img.sizes().z()))
00078     {
00079         HxGlobalError::instance()->reportError(fname, "end.z greater then image size", HxGlobalError::HX_GE_INVALID);
00080         return HxImageRep();
00081     }
00082 
00083     return img.restrict(begin, end);
00084 }


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