![]() |
Eppley Institute for Cancer Research |
University of Nebraska Medical Center |
|
|
Each image decoder module will occupy its own dll. The functions must be named as indicated and compiled with the standard "C" calling convention and exported. __declspec(dllexport) is how borland builder determines if a function is exported by a DLL file. The functions that return void pointers should be pointers to objects that can be type cast as imgbaseclass
extern "C" __declspec(dllexport) int stopimage(void);
Function is called before the library is removed from memory on program exit. Used to clean up memory used to keep track of open images.
extern "C" __declspec(dllexport) int initimage(void);
Function is called when the library is loaded into memory. Used to initialize memory to keep track of open images.
extern "C" __declspec(dllexport) void* newimage(char* ImageName, UINT32 XPixels, UINT32 YPixels, UINT32 BitDepth);
Function is called when a new image needs to be created from scratch. It should return a pointer to an object descending from type imgbaseclass.
extern "C" __declspec(dllexport) void* openimage(char* ImageName);
Function is called to open the image ImageName. It should return a pointer to an object descending from type imgbaseclass.
extern "C" __declspec(dllexport) void* deleteimage(void* AnImagePointer);
Function is called to delete an image from memory. Should return null if successful.
extern "C" __declspec(dllexport) UINT32 testimage(char* ImageName);
Test if ImageName is this type of image. Return 1 for yes and 0 for no.
extern "C" __declspec(dllexport) char* dlldescription(void);
Function that returns a string that describes the dll. For image module should return "Ripple:Image"
extern "C" __declspec(dllexport) char* image_extensions(void);
Function that returns a string that describes image extenstions valid for this type of image. Example: "*.img"
extern "C" __declspec(dllexport) extern "C" __declspec(dllexport) char* image_description(void);
Function that returns a string that describes image type. Example: "ADSC Detectors"
class imgbaseclass (All virtual functions must be overridden in descendent classes)
{
public:imgbaseclass();
constructor
~imgbaseclass();
destructor
UINT16* pixels;
Pointer to the array holding the pixels. Pixels should be stored in by rows.
virtual int open(const AnsiString& FileName,int HeaderOnly=0, const TRect& = TRect(0,0,0,0))=0;
Function open a file and returns 1 if successful. It must be defined in a descendent class. If an optional TRect is specified it will only return a piece of the image.
virtual int save()=0;
Function to save this image back to its file. This function is not used by Ripple and can just return 0 in the descendent class.
virtual int saveas(const AnsiString& FileAndPath)=0;
Save this image as a different name. Currently not used by ripple.
virtual int set(const AnsiString& Name, const AnsiString& Value)=0;
Used to set new items in the header. Not used by Ripple. For future expansion.
const AnsiString get(const AnsiString& Name);
Return the value of header key by name.
TStringList * properties();
Pointer to a string list of header keys.
TStringList * values();
Pointer to a string list of header values.
double max();
Return the maximum value of intensity values.
double min();
Return the minimum value of intensity values.
double avg();
Return the average of all intensity values.
double stdev();
Return the standard deviation of all intensity values.
UINT32 top();
Return the top of the image (typically 0) in pixels.
UINT32 left();
Return the left edge of the image (typically 0) in pixels.
UINT32 width();
Return the width of the image in pixels.
UINT32 height();
Return the height of the image in pixels.
UINT32 bitsperpixel();
Return the bits per pixel. Used to calculate the maximum possible value.
UINT32 bytesperpixel();
Return the bytes per pixel. Used to calculate the size of the pixels array.
virtual UINT32 resize(UINT32 NewX, UINT32 NewY)=0;
Function to allow resizing of an image for storage in a different format. Currently not used by Ripple.
virtual int pixel(int X, int Y);
Return a pixel by X and Y location.
double osc_start();
Return the starting oscillation angle for this image.
double osc_width();
Return the oscillation width. (0 for stills)
double osc_time();
Return the exposure time in seconds.
double pixel_size_x_um();
Return the X Pixel Size in microns.
double pixel_size_y_um();
Return the Y Pixel Size in microns.
protected:
AnsiString INTFileName; - Stores the file name
AnsiString INTPath; - Stores the path to the file
double INTmax; - Stores the maximum intensity
double INTmin; - Stores the minimum intensity
double INTavg; - Stores the average intensity
double INTstdev; - Stores the standard deviation
double INTosc_start; - Stores the starting angle
double INTosc_width; - Stores the width
double INTosc_time; - Stores the exposure time
double INTpixel_size_x_um; - Stores the size in microns
double INTpixel_size_y_um; - Stores the size in microns
UINT32 INTbitsperpixel; - Store the bits per pixel
UINT32 INTbytesperpixel; - Stores the bytes per pixel
TRect INTPixelLimits; - Stores the image limits
TStringList * INTValues; - Stores header values
TStringList * INTProperties; - Stores header properties};