#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxInverseProjectRange (HxImageRep im, int dimension, HxImageRep arg) |
Inverse projection of the pixel range. More... |
|
Inverse projection of the pixel range. The function projects (see Pixels) all pixels of image im on the given dimension of image arg via a unary pixel operation (see Images). Dimension starts at 1.
00013 { 00014 HxString fname("HxInverseProjectRange"); 00015 00016 if (im.isNull()) 00017 { 00018 HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID); 00019 return HxImageRep(); 00020 } 00021 if (arg.isNull()) 00022 { 00023 HxGlobalError::instance()->reportError(fname, arg.name(), "null arg image", HxGlobalError::HX_GE_INVALID); 00024 return HxImageRep(); 00025 } 00026 00027 if (im.dimensionality() != arg.dimensionality()) 00028 { 00029 HxGlobalError::instance()->reportError(fname, "unequal image dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00030 return HxImageRep(); 00031 } 00032 00033 if (im.pixelDimensionality() != 1) 00034 { 00035 HxGlobalError::instance()->reportError(fname, "operation only valid on scalar input images", HxGlobalError::HX_GE_INVALID); 00036 return HxImageRep(); 00037 } 00038 00039 if (im.sizes().x() != arg.sizes().x()) 00040 { 00041 HxGlobalError::instance()->reportError(fname, "unequal image widths", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00042 return HxImageRep(); 00043 } 00044 if (im.sizes().y() != arg.sizes().y()) 00045 { 00046 HxGlobalError::instance()->reportError(fname, "unequal image heights", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00047 return HxImageRep(); 00048 } 00049 if (im.dimensionality() > 2) 00050 { 00051 if (im.sizes().z() != arg.sizes().z()) 00052 { 00053 HxGlobalError::instance()->reportError(fname, "unequal image depths", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00054 return HxImageRep(); 00055 } 00056 } 00057 if (dimension < 1) 00058 { 00059 HxGlobalError::instance()->reportError(fname, "dimension parameter should be greater than zero", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00060 return HxImageRep(); 00061 } 00062 if (dimension > arg.pixelDimensionality()) 00063 { 00064 HxGlobalError::instance()->reportError(fname, "dimension parameter should be less than result pixel dimensionality", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00065 return HxImageRep(); 00066 } 00067 00068 return im.inverseProjectRange(dimension, arg); 00069 } |