RasterData

Get_BinaryValue, Get_BValue, Get_GValue, Get_Histogram, Get_PixelValue, Get_Profile, Get_RValue, Int_AnalyzeFunction, RGB, WavelengthToColor

Get_BValue

Description 

 Get_BValue(
   dword  Int_Color
);

This function extracts the blue value from the 32-bit RGB value.

Parameters

dword Int_Color

The RGB color as a 32bit integer. Use the RGB function to get the value.

See Also 
Get_PixelValue, Get_Profile, Get_RValue, Get_GValue

Get_BinaryValue

Description 

 Get_BinaryValue(
   int  Int_X,
   int  Int_Y
);

The function returns nonzero if there is any binary layer at the specified pixel, otherwise it returns zero. The function tests only selected (visible) binary layers. If there is no binary layer or none selected it returns zero.

Parameters

int Int_X

X coordinate.

int Int_Y

Y coordinate.

Get_GValue

Description 

 Get_GValue(
   dword  Int_Color
);

This function extracts the green value from the 32-bit RGB value.

Parameters

dword Int_Color

The RGB color as a 32bit integer. Use the RGB function to get the value.

See Also 
Get_PixelValue, Get_Profile, Get_RValue, Get_BValue

Get_Histogram

Description 

INT Get_Histogram(
   int  mode,
   int *lpModeData,
   dword *lpMean,
   dword *lpMin,
   dword *lpMax,
   dword *lpMaxFreq,
   int *lpRed,
   int *lpGreen,
   int *lpBlue,
   int *lpIntensity
);

This function can be used for getting the histogram in a whole image, in a rectangle, in a circle or under a binary image.

Parameters

int mode

Defines if the histogram should be taken from the whole image, a rectangle, a circle or under binary.

0, HISTO_PICWND

Picture window. Histogram is calculated from whole image.

4, HISTO_BINARY

Picture window under binary image. A binary image must exist.

1, HISTO_RECT

Rectangle. Histogram is calculated from defined rectangle.

2, HISTO_CIRCLE

Circle. Histogram is calculated from defined circle.

int *lpModeData

Array of four integers must be passed. If the probe is rectangle, the first parameter defines the left coordinate, second the upper coordinate, third the width and fourth the height of the probe. All in pixels. If the probe is circle, the first and second parameters are X and Y and the third parameter is the radius of the probe. All in pixels. This parameter is not used if the histogram is taken from full image or under binary.

dword *lpMean

Array of four DWORDs, where the mean red, green, blue and intensity values are filled in this order.

dword *lpMin

Array of four DWORDs, where the minimum red, green, blue and intensity values are filled in this order.

dword *lpMax

Array of four DWORDs, where the maximum red, green, blue and intensity values are filled in this order.

dword *lpMaxFreq

Array of user-defined class width.

int *lpRed

Points to red frequencies. For a gray image it points to gray frequencies. Integer array must be passed. Mind that the required length of the array depends on the bit depth of the image.

int *lpGreen

Points to green frequencies. Filled on output for a color image. Integer array must be passed. Mind that the required length of the array depends on the bit depth of the image.

int *lpBlue

Points to blue frequencies. Filled on output for a color image. Integer array must be passed. Mind that the required length of the array depends on the bit depth of the image.

int *lpIntensity

This parameter is for future use.

Return Values

INT

Unused.

//gets the histogram in whole image
int   rect[4];
dword mean[4];
dword min[4];
dword max[4];
dword maxFrekv[4];
int   red[4096];  //max for 12 bit images!
int   green[4096];
int   blue[4096];
int   intensity[4096];
//rectangle [0, 0, 10, 10], not used in this sample
rect[0] = 0;
rect[1] = 0;
rect[2] = 10;
rect[3] = 10;
Get_Histogram(0, rect, mean, min, max, maxFrekv, red, green, blue, intensity);
ShowVars("red", 2);

See Also 
Get_PixelValue, Get_Profile, Get_RValue, Get_GValue, Get_BValue, Int_AnalyzeFunction, Int_RescaleHist

Get_PixelValue

Description 

 Get_PixelValue(
   int  Int_X,
   int  Int_Y,
   int  Int_Radius
);

This function retrieves the color or intensity for gray images covered by a circle (pixel).

Parameters

int Int_X

X coordinate.

int Int_Y

Y coordinate.

int Int_Radius

Radius of the circle. If radius == 1, color (intensity) from the pixel with x and y coordinates is considered.

Return Values

This function returns color packed in DWORD.

// Get_PixelValue example - picks up the average gray or RGB values under the disk with radius 10 pixels.
dword            keys[2], key; 
char             buf[256], buf2[256], text[256];
dword            val;
int              red, green, blue;
int              x, y;
int              type;
SetCommandText("Get_PixelValue example. Waiting for mouse click or Esc...");
strcpy(buf, "  NIS-Elements API Example - Get_PixelValue\tTo define the center of the disk, click primary mouse button. To cancel, press Esc.   ");
Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100);  
keys[0] = VK_ESC;
keys[1] = VK_LBUTTON;
while(TRUE)
   {                    
   strcpy(buf, "  NIS-Elements API Example - Get_PixelValue\t");
   key = Int_GetEvents(&keys,2);
   if(key == keys[0]) break;
   if(key == keys[1])
   {
   Int_GetMousePos(&x,&y);
   val =Get_PixelValue(x,y,10);
   type = Get_Info(INFO_PICTURETYPE);
   if(type != PT_GRAY8)
   {
   red = Get_RValue(val);
   blue = Get_BValue(val);
   green = Get_GValue(val);
   sprintf(buf2, "coor = %i,%i   RGB = %i,%i,%i   ","x, y, red, green, blue");
   }
   else
   sprintf(buf2, "coor = %i,%i    gray = %i   ","x, y, val");
   strcpy(text, buf);
   strcat(text, buf2);
   Int_CreateTextWindow(text,0,RGB(0,0,128),RGB_WHITE,100);
   Wait(1.8);
   strcpy(buf, "  NIS-Elements API Example - Get_PixelValue\tTo define the center of the disk, click primary mouse button. To cancel, press Esc.   ");
   Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100);  
   }
   }
Int_CloseTextWindow();

See Also 
Get_Profile, Get_RValue, Get_GValue, Get_BValue, Get_Histogram

Get_Profile

Description 

int Get_Profile(
   int  Int_X,
   int  Int_Y,
   int  Int_X1,
   int  Int_Y1,
   void *Int_LpRed,
   void *Int_LpGreen,
   void *Int_LpBlue,
   void *Int_LpIntensity,
   int  Int_Num
);

This function retrieves the profile under the line.

Parameters

int Int_X

X coordinate.

int Int_Y

Y coordinate.

int Int_X1

X coordinate of end point.

int Int_Y1

Y coordinate of end point.

void *Int_LpRed

An array for red component (first component for multichannel images). Filled on output. Macro is responsible for a buffer allocation.

void *Int_LpGreen

An array for green component (second component for multichannel images). Filled on output. Macro is responsible for a buffer allocation.

void *Int_LpBlue

An array for blue component (third component for multichannel images). Filled on output. Macro is responsible for a buffer allocation.

void *Int_LpIntensity

An array for intensity. Filled on output. Macro is responsible for a buffer allocation.

int Int_Num

Size of arrays.

Return Values

int

The function returns number of points, where profile was calculated.

Note

All arrays are filled byte after byte for images with bit depth <= 8 and word after word for images with bit depth greater than 8.

See Also 
Get_PixelValue, Get_RValue, Get_GValue, Get_BValue, Int_AnalyzeFunction, Get_Histogram

Get_RValue

Description 

 Get_RValue(
   dword  Int_Color
);

This function extracts the red value from the 32-bit RGB value.

Parameters

dword Int_Color

The RGB color as a 32bit integer. Use the RGB function to get the value.

See Also 
Get_PixelValue, Get_Profile, Get_GValue, Get_BValue

Int_AnalyzeFunction

Description 

 Int_AnalyzeFunction(
   double *lpData,
   int  type,
   int  num,
   int *lpMin,
   int *lpMax,
   int *lpInflex
);

This function finds local minima, local maxima and inflexes in the data array and fills the appropriate min, max and inflex arrays.

Parameters

double *lpData

Points to data to be analyzed. Filled on input. Macro is responsible for a buffer allocation.

int type

Describes type of data in the array.

BYTE

1 byte.

INT

2 bytes.

DWORD

4 bytes.

DOUBLE

8 bytes.

int num

Number entries in the data array.

int *lpMin

Index array, that specifies local minima in the source lpData array. Filled on output. Macro is responsible for buffer allocation. If lpMin[0] = 0, then default values for extreme detection are taken; it means that neighborhood for polynom is 4 points on the left, 4 points on the right, data is fitted with polynom of order 3 and 3 derivation points on the left is < resp > 0 and 3 derivation points on the right > resp < 0 for minima resp maxima. If lpMin[0] != 0, then lpMin[0] ... neighborhood for polynom lpMin[1] ... polynom order; lpMin[2] ... neighborhood for extreme detection; lpMax[0] ... neighborhood for extreme detection;

int *lpMax

Index array, that specifies local maxima in the source lpData array. Filled on output. Macro is responsible for buffer allocation.

int *lpInflex

Index array, that specifies inflex points in the source lpData array. Filled on output. Macro is responsible for a buffer allocation.

Return Values

By default, extrema is calculated on .

// Int_Analyze example - detects an inflex point of the cubic function.
double             data[128];
int                min[128], max[128], inflexes[128];  
int                i;
double             t;
char               buf[256];
strcpy(buf, "API Example - Int_AnalyzeFunction. Please, wait...");
Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100);  
SetCommandText("Working...");
// Calculate values for cubic function
for(i=-64; i<64; i=i+1)
   {
   t=i;
   t=t/10;   
   t=t*t*t;
   data[i+64]=t;
   }
// Find inflex points for cubic function
Int_AnalyzeFunction(data, DOUBLE, 128, NULL, NULL, inflexes);
// Creating graph window, titles and data
Int_GSCreateWindow("API Example", WP_CENTERED,1,1,400,400);
Int_GSSetClr(BACKGROUND, RGB_WHITE);
Int_GSTitles("X Axis", "Y Axis", "(X-64)*(X-64)*(X-64)/1000");
Int_GSFunData(data, NULL, NULL, NULL, 128);
// Creating additional text for the value of inflex point
i=inflexes[1];
sprintf(buf,"inflex=%i", "i");
Int_GSUserText(buf);
// Selecting fonts for title,...
Int_GSSetFont(GS_TITLE, "Arial", 35, GS_FOBOLD, FALSE); 
Int_GSSetFont(GS_XYTITLE, "Arial", 25, GS_FOBOLD, FALSE); 
Int_GSSetFont(GS_LEGEND, "Arial", 25, GS_FODEFAULT, FALSE); 
Int_GSSetFont(GS_LABEL, "Arial", 25, GS_FODEFAULT, FALSE); 
Int_GSShow(GS_FUNCTION);
Int_CloseTextWindow();
RGB

Description 

 RGB(
   int  redC,
   int  greenC,
   int  blueC
);

This function selects an RGB color based on supplied parameters.

Parameters

int redC

Specifies the intensity of the red color. Values are ranging from 0 to 255.

int greenC

Specifies the intensity of the green color. Values are ranging from 0 to 255.

int blueC

Specifies the intensity of the blue color. Values are ranging from 0 to 255.

Return Values

The return value specifies the result RGB color. If one of component values is > 255, then the function returns 0.

Note

If all three intensities are specified as zero, the result color is black. If all three intensities are specified 255, the result color is white.

See Also 
Get_Info

WavelengthToColor

Description 

 WavelengthToColor(
   double  Int_Wavelength
);

This function returns the RGB color value matching the light wavelength given by the parameter.

Parameters

double Int_Wavelength

Insert the wavelength value in [nm].