#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxExtend (HxImageRep img, HxImageRep background, HxPoint begin) |
Extension of domain. More... |
|
Extension of domain. Extend the domain of the image to the size of the background image. The image is put at the position indicated by begin. Points are treated as pixel coordinates (integers).
00013 { 00014 HxString fname("HxExtend"); 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 (background.isNull()) 00022 { 00023 HxGlobalError::instance()->reportError(fname, background.name(), "null image", HxGlobalError::HX_GE_INVALID); 00024 return HxImageRep(); 00025 } 00026 00027 if (img.dimensionality() != background.dimensionality()) 00028 { 00029 HxGlobalError::instance()->reportError(fname, "unequal image dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00030 return HxImageRep(); 00031 } 00032 if (img.pixelDimensionality() != background.pixelDimensionality()) 00033 { 00034 HxGlobalError::instance()->reportError(fname, "unequal pixel dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00035 return HxImageRep(); 00036 } 00037 00038 if (begin.x() < 0) 00039 { 00040 HxGlobalError::instance()->reportError(fname, "begin.x less then 0", HxGlobalError::HX_GE_INVALID); 00041 return HxImageRep(); 00042 } 00043 if (begin.y() < 0) 00044 { 00045 HxGlobalError::instance()->reportError(fname, "begin.y less then 0", HxGlobalError::HX_GE_INVALID); 00046 return HxImageRep(); 00047 } 00048 if (begin.z() < 0) 00049 { 00050 HxGlobalError::instance()->reportError(fname, "begin.z less then 0", HxGlobalError::HX_GE_INVALID); 00051 return HxImageRep(); 00052 } 00053 if ((begin.x() + img.sizes().x()) > background.sizes().x()) 00054 { 00055 HxGlobalError::instance()->reportError(fname, "x size of extend too large", HxGlobalError::HX_GE_INVALID); 00056 return HxImageRep(); 00057 } 00058 if ((begin.y() + img.sizes().y()) > background.sizes().y()) 00059 { 00060 HxGlobalError::instance()->reportError(fname, "y size of extend too large", HxGlobalError::HX_GE_INVALID); 00061 return HxImageRep(); 00062 } 00063 if ((img.dimensionality() > 2) && ((begin.z() + img.sizes().z()) > background.sizes().z())) 00064 { 00065 HxGlobalError::instance()->reportError(fname, "z size of extend too large", HxGlobalError::HX_GE_INVALID); 00066 return HxImageRep(); 00067 } 00068 00069 return img.extend(background, begin); 00070 } |