#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxMakeFromMatlab (const HxImageSignature &signature, HxSizes sizes, double *pixels) |
Make a new image with given signature and sizes. More... |
|
Make a new image with given signature and sizes. Pixel values are initialized from given values. The given values are stored in Matlab format.
00015 { 00016 HxString fname("HxMakeFromMatlab"); 00017 00018 if ((signature.pixelDimensionality() < 1) || (signature.pixelDimensionality() > 3)) 00019 { 00020 HxGlobalError::instance()->reportError(fname, "Illegal pixel dimensionality", HxGlobalError::HX_GE_INVALID); 00021 return HxImageRep(); 00022 } 00023 if ((signature.imageDimensionality() < 2) || (signature.imageDimensionality() > 3)) 00024 { 00025 HxGlobalError::instance()->reportError(fname, "Illegal number of dimensions", HxGlobalError::HX_GE_INVALID); 00026 return HxImageRep(); 00027 } 00028 00029 if (sizes.x() < 1) 00030 { 00031 HxGlobalError::instance()->reportError(fname, "Illegal x size", HxGlobalError::HX_GE_INVALID); 00032 return HxImageRep(); 00033 } 00034 if (sizes.y() < 1) 00035 { 00036 HxGlobalError::instance()->reportError(fname, "Illegal y size", HxGlobalError::HX_GE_INVALID); 00037 return HxImageRep(); 00038 } 00039 if (signature.imageDimensionality() > 2) 00040 { 00041 if (sizes.y() < 1) 00042 { 00043 HxGlobalError::instance()->reportError(fname, "Illegal y size", HxGlobalError::HX_GE_INVALID); 00044 return HxImageRep(); 00045 } 00046 } 00047 // check size of double*, but how? 00048 00049 return HxImageFactory::instance().fromMatlab(signature, sizes, pixels); 00050 } |