#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxAnd (HxImageRep im1, HxImageRep im2) |
| And. More... | |
|
||||||||||||
|
And. The function performs and (see Pixels) on all pixels in the input images via a binary pixel operation (see Images). Implementation specifics : The pixel functor : HxBpoAnd. The image functor instantiator : HxInstantiatorAnd.
00013 {
00014 HxString fname("HxAnd");
00015
00016 if (im1.isNull())
00017 {
00018 HxGlobalError::instance()->reportError(fname, im1.name(), "null image", HxGlobalError::HX_GE_INVALID);
00019 return HxImageRep();
00020 }
00021 if (im2.isNull())
00022 {
00023 HxGlobalError::instance()->reportError(fname, im2.name(), "null image", HxGlobalError::HX_GE_INVALID);
00024 return HxImageRep();
00025 }
00026
00027 if (im1.signature().imageDimensionality() != im2.signature().imageDimensionality())
00028 {
00029 HxGlobalError::instance()->reportError(fname, "unequal image dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00030 return HxImageRep();
00031 }
00032 if (im1.signature().pixelDimensionality() != im2.signature().pixelDimensionality())
00033 {
00034 HxGlobalError::instance()->reportError(fname, "unequal pixel dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00035 return HxImageRep();
00036 }
00037 if (im1.signature().pixelDimensionality() != 1)
00038 {
00039 HxGlobalError::instance()->reportError(fname, "logical operators are only valid for scalar images", HxGlobalError::HX_GE_INVALID);
00040 return HxImageRep();
00041 }
00042
00043 if (im1.signature().pixelType() != im2.signature().pixelType())
00044 {
00045 HxGlobalError::instance()->reportError(fname, "unequal pixel types", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00046 return HxImageRep();
00047 }
00048 if (im1.signature().pixelType() != INT_VALUE)
00049 {
00050 HxGlobalError::instance()->reportError(fname, "logical operators are only valid on integer values", HxGlobalError::HX_GE_INVALID);
00051 return HxImageRep();
00052 }
00053
00054 if (im1.signature().pixelPrecision() != im2.signature().pixelPrecision())
00055 {
00056 HxGlobalError::instance()->reportError(fname, "unequal pixel precisions", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00057 return HxImageRep();
00058 }
00059
00060 if (im1.sizes().x() != im2.sizes().x())
00061 {
00062 HxGlobalError::instance()->reportError(fname, "unequal image widths", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00063 return HxImageRep();
00064 }
00065 if (im1.sizes().y() != im2.sizes().y())
00066 {
00067 HxGlobalError::instance()->reportError(fname, "unequal image heights", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00068 return HxImageRep();
00069 }
00070 if (im1.signature().imageDimensionality() > 2)
00071 {
00072 if (im1.sizes().z() != im2.sizes().z())
00073 {
00074 HxGlobalError::instance()->reportError(fname, "unequal image depths", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00075 return HxImageRep();
00076 }
00077 }
00078
00079 return im1.binaryPixOp(im2, "and");
00080 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001