C++ Template Image Processing Library. |
[Introduction]- [News]- [Download]- [Screenshots]- [Tutorial]- [Forums-Eng]- [Forums-Fr]- [Reference]- [SourceForge Repository ]

- Main Page
- Modules
- Namespaces
- Classes

- Namespace List
- Namespace Members

# cimg_library::cimg Namespace Reference

Namespace that encompasses low-level functions and variables of the CImg Library. More...

## Functions
template<typename tfunc, typename tp, typename tf>
void | marching_cubes (const tfunc &func, const float isovalue, const float x0, const float y0, const float z0, const float x1, const float y1, const float z1, const float resx, const float resy, const float resz, CImgl< tp > &points, CImgl< tf > &primitives, const bool invert_faces)
| Polygonize an implicit function.
template<typename tfunc, typename tp, typename tf>
void | marching_squares (const tfunc &func, const float isovalue, const float x0, const float y0, const float x1, const float y1, const float resx, const float resy, CImgl< tp > &points, CImgl< tf > &primitives)
| Polygonize an implicit 2D function by the marching squares algorithm.
const char * | convert_path ()
| Return path of the ImageMagick's `convert` tool.
const char * | medcon_path ()
| Return path of the `XMedcon` tool.
const char * | temporary_path ()
| Return path to store temporary files.
bool | endian ()
| Return `false` for little endian CPUs (Intel), `true` for big endian CPUs (Motorola).
void | info ()
| Print informations about CImg environement variables.
unsigned long | time ()
| Get the value of a system timer with a millisecond precision.
void | sleep (const unsigned int milliseconds)
| Sleep for a certain numbers of milliseconds.
unsigned int | wait (const unsigned int milliseconds)
| Wait for a certain number of milliseconds since the last call.
template<typename T>
T | abs (const T &a)
| Return the absolute value of `a`.
template<typename T>
const T & | min (const T &a, const T &b)
| Return the minimum between `a` and `b`.
template<typename T>
const T & | min (const T &a, const T &b, const T &c)
| Return the minimum between `a`,`b` and c.
template<typename T>
const T & | min (const T &a, const T &b, const T &c, const T &d)
| Return the minimum between `a`,`b`,`c` and `d`.
template<typename T>
const T & | max (const T &a, const T &b)
| Return the maximum between `a` and `b`.
template<typename T>
const T & | max (const T &a, const T &b, const T &c)
| Return the maximum between `a`,`b` and `c`.
template<typename T>
const T & | max (const T &a, const T &b, const T &c, const T &d)
| Return the maximum between `a`,`b`,`c` and `d`.
template<typename T>
T | sign (const T &x)
| Return the sign of `x`.
template<typename T>
unsigned long | nearest_pow2 (const T &x)
| Return the nearest power of 2 higher than `x`.
double | mod (const double &x, const double &m)
| Return `x` modulo `m` (generic modulo).
template<typename T>
T | minmod (const T &a, const T &b)
| Return minmod(`a`,`b`).
double | rand ()
| Return a random variable between [0,1], followin a uniform distribution.
double | crand ()
| Return a random variable between [-1,1], following a uniform distribution.
double | grand ()
| Return a random variable following a gaussian distribution and a standard deviation of 1.
template<typename t>
int | dialog (const char *title, const char *msg, const char *button1_txt, const char *button2_txt, const char *button3_txt, const char *button4_txt, const char *button5_txt, const char *button6_txt, const CImg< t > &logo, const bool centering=false)
| Display a dialog box, where a user can click standard buttons.
## Variables
const double | PI = 3.14159265358979323846
| Definition of the mathematical constant PI.

## Detailed Description

Namespace that encompasses low-level functions and variables of the CImg Library.

Most of the functions and variables within this namespace are used by the library for low-level processing. Nevertheless, documented variables and functions of this namespace may be used safely in your own source code.

Warning:
  Never write `using namespace cimg_library::cimg;` in your source code, since a lot of functions of the `cimg::` namespace have prototypes similar to standard C functions defined in the global namespace `::`.

## Function Documentation

const char* cimg_library::cimg::convert_path | ( |  | ) |

| Return path of the ImageMagick's `convert` tool. If you have installed the ImageMagick package in a standard directory, this function should return the correct path of the `convert` tool used by the CImg Library to load and save compressed image formats. Conversely, if the `convert` executable is not auto-detected by the function, you can define the macro `cimg_convert_path` with the correct path of the `convert` executable, before including `CImg.h` in your program :
           #define cimg_convert_path "/users/thatsme/local/bin/convert"
           #include "CImg.h"

           int main() {
             CImg<> img("my_image.jpg");     // Read a JPEG image file.
             return 0;
           }
Note that non compressed image formats can be read without installing ImageMagick. See also: temporary_path(), get_load_convert(), load_convert(), save_convert().

const char* cimg_library::cimg::medcon_path | ( |  | ) |

| Return path of the `XMedcon` tool. If you have installed the XMedcon package in a standard directory, this function should return the correct path of the `medcon` tool used by the CIg Library to load DICOM image formats. Conversely, if the `medcon` executable is not auto-detected by the function, you can define the macro `cimg_medcon_path` with the correct path of the `medcon` executable, before including `CImg.h` in your program :
           #define cimg_medcon_path "/users/thatsme/local/bin/medcon"
           #include "CImg.h"

           int main() {
             CImg<> img("my_image.dcm");    // Read a DICOM image file.
             return 0;
           }
Note that `medcon` is only needed if you want to read DICOM image formats. See also: temporary_path(), get_load_dicom(), load_dicom().

const char* cimg_library::cimg::temporary_path | ( |  | ) |

| Return path to store temporary files. If you are running on a standard Unix or Windows system, this function should return a correct path where temporary files can be stored. If such a path is not auto-detected by this function, you can define the macro `cimg_temporary_path` with a correct path, before including `CImg.h` in your program :
           #define cimg_temporary_path "/users/thatsme/tmp"
           #include "CImg.h"

           int main() {
             CImg<> img("my_image.jpg");   // Read a JPEG image file (using the defined temporay path).
             return 0;
           }
A temporary path is necessary to load and save compressed image formats, using `convert` or `medcon`. See also: convert_path(), get_load_convert(), load_convert(), save_convert(), get_load_dicom(), load_dicom().

void cimg_library::cimg::info | ( |  | ) |

| Print informations about CImg environement variables. Printing is done on the standart error output.

void cimg_library::cimg::sleep | ( | const unsigned int | milliseconds | ) |

| Sleep for a certain numbers of milliseconds. This function frees the CPU ressources during the sleeping time. It may be used to temporize your program properly, without wasting CPU time. See also: wait(), time().

unsigned int cimg_library::cimg::wait | ( | const unsigned int | milliseconds | ) |

| Wait for a certain number of milliseconds since the last call. This function is equivalent to sleep() but the waiting time is computed with regard to the last call of wait(). It may be used to temporize your program properly. See also: sleep(), time().

double cimg_library::cimg::mod | ( | const double & | x,
|  | const double & | m
| ) |

| Return `x` modulo `m` (generic modulo). This modulo function accepts negative and floating-points modulo numbers `m`.

T cimg_library::cimg::minmod | ( | const T & | a,
|  | const T & | b
| ) |

| Return minmod(`a`,`b`). The operator minmod(`a`,`b`) is defined to be : minmod(`a`,`b`) = min(`a`,`b`), if (`a` * `b`)>0. minmod(`a`,`b`) = 0, if (`a` * `b`)<=0

int cimg_library::cimg::dialog | ( | const char * | title,
|  | const char * | msg,
|  | const char * | button1_txt,
|  | const char * | button2_txt,
|  | const char * | button3_txt,
|  | const char * | button4_txt,
|  | const char * | button5_txt,
|  | const char * | button6_txt,
|  | const CImg< t > & | logo,
|  | const bool | centering = `false`
| ) |

  | Display a dialog box, where a user can click standard buttons. Up to 6 buttons can be defined in the dialog window. This function returns when a user clicked one of the button or closed the dialog window. Parameters:
  | title | = Title of the dialog window.
  | msg | = Main message displayed inside the dialog window.
  | button1_txt | = Label of the 1st button.
  | button2_txt | = Label of the 2nd button.
  | button3_txt | = Label of the 3rd button.
  | button4_txt | = Label of the 4th button.
  | button5_txt | = Label of the 5th button.
  | button6_txt | = Label of the 6th button.
  | logo | = Logo image displayed at the left of the main message. This parameter is optional.
  | centering | = Tell to center the dialog window on the screen.
Returns: The button number (from 0 to 5), or -1 if the dialog window has been closed by the user. Note: If a button text is set to 0, then the corresponding button (and the followings) won't appear in the dialog box. At least one button is necessary.

The CImg Library - C++ Template Image Processing Library