#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxMakeFrom2Images (HxImageRep i1, HxImageRep i2) |
| Make a new image with pixel values "stacked" from given arguments. More... | |
|
||||||||||||
|
Make a new image with pixel values "stacked" from given arguments. For example, if i1 and i2 are scalar images the pixel values in the new image are 2-vectors. Result may need exceed highest pixel dimensionality.
00014 {
00015 HxString fname("HxMakeFrom2Images");
00016
00017 if (i1.isNull())
00018 {
00019 HxGlobalError::instance()->reportError(fname, i1.name(), "null image", HxGlobalError::HX_GE_INVALID);
00020 return HxImageRep();
00021 }
00022 if (i2.isNull())
00023 {
00024 HxGlobalError::instance()->reportError(fname, i2.name(), "null image", HxGlobalError::HX_GE_INVALID);
00025 return HxImageRep();
00026 }
00027
00028 if (i1.dimensionality() != i2.dimensionality())
00029 {
00030 HxGlobalError::instance()->reportError(fname, "unequal image dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00031 return HxImageRep();
00032 }
00033 if (i1.pixelType() != i2.pixelType())
00034 {
00035 HxGlobalError::instance()->reportError(fname, "unequal pixel types", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00036 return HxImageRep();
00037 }
00038 if (i1.pixelDimensionality() != i2.pixelDimensionality())
00039 {
00040 HxGlobalError::instance()->reportError(fname, "unequal pixel dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00041 return HxImageRep();
00042 }
00043
00044 if (i1.sizes().x() != i2.sizes().x())
00045 {
00046 HxGlobalError::instance()->reportError(fname, "unequal image widths", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00047 return HxImageRep();
00048 }
00049 if (i1.sizes().y() != i2.sizes().y())
00050 {
00051 HxGlobalError::instance()->reportError(fname, "unequal image heights", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00052 return HxImageRep();
00053 }
00054 if (i1.dimensionality() > 2)
00055 {
00056 if (i1.sizes().z() != i2.sizes().z())
00057 {
00058 HxGlobalError::instance()->reportError(fname, "unequal image depths", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00059 return HxImageRep();
00060 }
00061 }
00062
00063 return HxImageFactory::instance().from2Images(i1, i2);
00064 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001