#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxMakeFrom3Images (HxImageRep i1, HxImageRep i2, HxImageRep i3) |
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, i2, and i3 are scalar images the pixel values in the new image are 3-vectors. Result may need exceed highest pixel dimensionality.
00014 { 00015 HxString fname("HxMakeFrom3Images"); 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 if (i3.isNull()) 00028 { 00029 HxGlobalError::instance()->reportError(fname, i3.name(), "null image", HxGlobalError::HX_GE_INVALID); 00030 return HxImageRep(); 00031 } 00032 00033 if ((i1.dimensionality() != i2.dimensionality()) || (i1.dimensionality() != i3.dimensionality())) 00034 { 00035 HxGlobalError::instance()->reportError(fname, "unequal image dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00036 return HxImageRep(); 00037 } 00038 if ((i1.pixelType() != i2.pixelType()) || (i1.pixelType() != i3.pixelType())) 00039 { 00040 HxGlobalError::instance()->reportError(fname, "unequal pixel types", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00041 return HxImageRep(); 00042 } 00043 if ((i1.pixelDimensionality() != i2.pixelDimensionality()) || (i1.pixelDimensionality() != i3.pixelDimensionality())) 00044 { 00045 HxGlobalError::instance()->reportError(fname, "unequal pixel dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00046 return HxImageRep(); 00047 } 00048 00049 if ((i1.sizes().x() != i2.sizes().x()) || (i1.sizes().x() != i3.sizes().x())) 00050 { 00051 HxGlobalError::instance()->reportError(fname, "unequal image widths", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00052 return HxImageRep(); 00053 } 00054 if ((i1.sizes().y() != i2.sizes().y()) || (i1.sizes().y() != i3.sizes().y())) 00055 { 00056 HxGlobalError::instance()->reportError(fname, "unequal image heights", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00057 return HxImageRep(); 00058 } 00059 if (i1.dimensionality() > 2) 00060 { 00061 if ((i1.sizes().z() != i2.sizes().z()) || (i1.sizes().z() != i3.sizes().z())) 00062 { 00063 HxGlobalError::instance()->reportError(fname, "unequal image depths", HxGlobalError::HX_GE_UNEQUAL_IMAGES); 00064 return HxImageRep(); 00065 } 00066 } 00067 00068 return HxImageFactory::instance().from3Images(i1, i2, i3); 00069 } |