00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef HxImageFactory_h
00010 #define HxImageFactory_h
00011
00012 #include "HxImageRep.h"
00013 #include "HxImageList.h"
00014
00015 #include <map>
00016
00017 class HxImageGenerator;
00018 class HxImageData;
00019
00022 class L_HXIMAGEREP HxImageFactory
00023 {
00024 public:
00026 static HxImageFactory& instance();
00027
00030 HxImageRep fromSignature(
00031 const HxImageSignature& signature, HxSizes sizes);
00032
00036 HxImageRep fromImage(
00037 const HxImageSignature& signature, HxImageRep src);
00038
00042 HxImageRep fromValue(
00043 const HxImageSignature& signature,
00044 HxSizes sizes, HxValue val);
00045
00049 HxImageRep fromByteData(
00050 int pixelDimensionality, int dimensions,
00051 HxSizes sizes, HxByte* data);
00052
00056 HxImageRep fromShortData(
00057 int pixelDimensionality, int dimensions,
00058 HxSizes sizes, short* data);
00059
00063 HxImageRep fromIntData(
00064 int pixelDimensionality, int dimensions,
00065 HxSizes sizes, int* data);
00066
00070 HxImageRep fromFloatData(
00071 int pixelDimensionality, int dimensions,
00072 HxSizes sizes, float* data);
00073
00077 HxImageRep fromDoubleData(
00078 int pixelDimensionality, int dimensions,
00079 HxSizes sizes, double* data);
00080
00084 HxImageRep fromGenerator(
00085 const HxImageSignature& signature,
00086 const HxImageGenerator* imgGenerator) const;
00087
00091 HxImageRep fromNamedGenerator(
00092 const HxImageSignature& signature,
00093 HxString generatorName, HxTagList& tags) const;
00094
00099 HxImageRep fromJavaRgb(
00100 const HxImageSignature& signature,
00101 HxSizes sizes, int* pixels);
00102
00106 HxImageRep fromGrayValue(
00107 const HxImageSignature& signature,
00108 HxSizes sizes, HxByte* pixels);
00109
00114 HxImageRep fromMatlab(
00115 const HxImageSignature& signature,
00116 HxSizes sizes, double* pixels);
00117
00122 HxImageRep fromImport(
00123 const HxImageSignature& signature,
00124 HxSizes sizes, HxString importOp, HxTagList& tags);
00125
00132 HxImageRep from2Images(HxImageRep i1, HxImageRep i2);
00133
00140 HxImageRep from3Images(
00141 HxImageRep i1, HxImageRep i2, HxImageRep i3);
00142
00144 HxImageRep fromFile(HxString fileName, HxTagList& tags);
00145
00147 bool writeFile(
00148 HxImageRep img, HxString fileName,
00149 HxTagList &tags) const;
00150
00152 bool imagesToFile(
00153 HxImageList imgs, HxString fileName,
00154 HxTagList &tags) const;
00155
00157 HxImageList imagesFromFile(
00158 HxString fileName, HxTagList &tags);
00159
00160 void subscribeGenerator(
00161 HxString name, HxImageGenerator*);
00162 void unSubscribeGenerator(
00163 HxString name, HxImageGenerator*);
00164
00165 HxImageGenerator* getGenerator(HxString name) const;
00166
00167 private:
00168
00169 typedef HxImageGenerator* HxImgGtorPtr;
00170 typedef std::map<
00171 HxString, HxImgGtorPtr,
00172 std::less<HxString> > GeneratorMap;
00173 typedef GeneratorMap::value_type GeneratorEntry;
00174
00175 static HxImageData* construct(
00176 const HxImageSignature& signature,
00177 HxSizes sizes);
00178
00179 #pragma warning (disable : 4251)
00180 GeneratorMap _generatorMap;
00181 #pragma warning (default : 4251)
00182 };
00183
00184 #endif