Imagine++
Images Library

Classes

class  Imagine::Image< T, dim >
 Image. More...
 

Functions

template<typename T, int dim>
Image< T, dim > Imagine::blur (const Image< T, dim > &I, const FVector< typename PixelTraits< T >::scalar_type, dim > &sigmas, bool neumann=true)
 Blur (anisotropic).
 
template<typename T, int dim>
Image< T, dim > Imagine::blur (const Image< T, dim > &I, typename PixelTraits< T >::scalar_type sigma, bool neumann=true)
 Blur.
 
template<typename T, int dim>
Image< Color, dim > Imagine::color (const Image< RGB< T >, dim > &I)
 Color representation.
 
template<typename T, int dim>
Image< Color, dim > Imagine::color (const Image< RGB< T >, dim > &I, const RGB< T > &m, const RGB< T > &M)
 Color representation.
 
void Imagine::createMaskFromColor (Image< AlphaColor > &I, AlphaColor col)
 Create a transparency mask from a specified color-key.
 
template<typename T, int dim>
Image< T > Imagine::cut2D (const Image< T, dim > &I, const Coords< dim > &cut, int d1, int d2)
 2D cut.
 
template<typename T, int dim>
Image< T, dim > Imagine::deriche (const Image< T, dim > &I, typename PixelTraits< T >::scalar_type sigma, int order, int d, bool neumann=true)
 Deriche filter.
 
template<typename T, int dim>
Imagine::derivative (const Image< T, dim > &u, const Coords< dim > &p, int d)
 Derivative.
 
void Imagine::display (const Image< AlphaColor > &I, int x=0, int y=0, bool xorMode=false, double fact=1.)
 Display color image with alpha channel.
 
void Imagine::display (const Image< Color > &I, int x=0, int y=0, bool xorMode=false, double fact=1.)
 Display color image.
 
void Imagine::display (const Image< Color > &I, IntPoint2 p, bool xorMode=false, double fact=1.)
 Display color image (IntPoint2 alias).
 
void Imagine::display (const Image< octet > &I, int x=0, int y=0, bool xorMode=false, double fact=1.)
 Display grey image.
 
void Imagine::display (const Image< octet > &I, IntPoint2 p, bool xorMode=false, double fact=1.)
 Display grey image (IntPoint2 alias).
 
void Imagine::display (const Image< octet > &IR, const Image< octet > &IG, const Image< octet > &IB, int x=0, int y=0, bool xorMode=false, double fact=1.)
 Display color image (3 chanels).
 
void Imagine::display (const Image< octet > &IR, const Image< octet > &IG, const Image< octet > &IB, IntPoint2 p, bool xorMode=false, double fact=1.)
 Display color image (3 chanels, IntPoint2 alias).
 
template<typename T>
Image< T, 2 > Imagine::enlarge (const Image< T, 2 > &I, int w, int h, bool keepRatio=false)
 Enlarge image (given dimensions), 2D alias.
 
template<typename T>
Image< T, 3 > Imagine::enlarge (const Image< T, 3 > &I, int w, int h, int d, bool keepRatio=false)
 Enlarge image (given dimensions), 3D alias.
 
template<typename T, int dim>
Image< T, dim > Imagine::enlarge (const Image< T, dim > &I, Coords< dim > nd, bool keepRatio=false)
 Enlarge image (given dimensions).
 
template<typename T, int dim>
Image< T, dim > Imagine::enlarge (const Image< T, dim > &I, double fact)
 Enlarge image (given factor).
 
template<typename T>
Imagine::gaussianCurvature (const Image< T, 3 > &u, const Coords< 3 > &p)
 Gaussian curvature of iso level (3D).
 
template<typename T, int dim>
FVector< T, dim > Imagine::gradient (const Image< T, dim > &u, const Coords< dim > &p)
 Gradient.
 
template<typename T, int dim>
Image< octet, dim > Imagine::grey (const Image< T, dim > &I)
 Grey level representation.
 
template<typename T, int dim>
Image< octet, dim > Imagine::grey (const Image< T, dim > &I, T m, T M)
 Grey level representation.
 
template<typename T, int dim>
void Imagine::inPlaceBlur (Image< T, dim > &I, const FVector< typename PixelTraits< T >::scalar_type, dim > &sigmas, bool neumann=true)
 In Place Blur (anisotropic).
 
template<typename T, int dim>
void Imagine::inPlaceBlur (Image< T, dim > &I, typename PixelTraits< T >::scalar_type sigma, bool neumann=true)
 In Place Blur.
 
template<typename T, int dim>
void Imagine::inPlaceDeriche (Image< T, dim > &I, typename PixelTraits< T >::scalar_type sigma, int order, int d, bool neumann=true)
 In place Deriche filter.
 
template<typename T, int dim>
Imagine::laplacian (const Image< T, dim > &u, const Coords< dim > &p)
 Laplacian.
 
bool Imagine::load (Image< AlphaColor > &I, std::string name)
 Load color image with alpha channel.
 
bool Imagine::load (Image< Color > &I, std::string name)
 Load color image.
 
bool Imagine::load (Image< octet > &I, std::string name)
 Load grey image.
 
bool Imagine::load (Image< octet > &IR, Image< octet > &IG, Image< octet > &IB, std::string name)
 Load color image.
 
template<typename T, int dim>
bool Imagine::loadAnalyze (Image< T, dim > &I, const std::string name)
 Load Analyze file.
 
template<typename T>
Imagine::meanCurvature (const Image< T, 2 > &u, const Coords< 2 > &p)
 Mean curvature (2D).
 
template<typename T>
Imagine::meanCurvature (const Image< T, 3 > &u, const Coords< 3 > &p)
 Mean curvature (3D).
 
template<typename T>
Imagine::meanCurvatureMotion (const Image< T, 2 > &u, const Coords< 2 > &p)
 Level set Mean curvature motion (2D).
 
template<typename T>
Imagine::meanCurvatureMotion (const Image< T, 3 > &u, const Coords< 3 > &p)
 Level set Mean curvature motion (3D).
 
template<typename T, int dim>
void Imagine::neighbourCoords (const Image< T, dim > &u, const Coords< dim > &p, Coords< dim > &pp, Coords< dim > &pm)
 Coordinates of neighbours.
 
template<typename T, int dim>
void Imagine::neighbourOffsets (const Image< T, dim > &u, const Coords< dim > &p, FVector< size_t, dim > &dp, FVector< size_t, dim > &dm)
 Offsets to neighbours.
 
template<typename T, int dim>
FVector< T, dim > Imagine::normal (const Image< T, dim > &u, const Coords< dim > &p)
 Unit normal of iso level.
 
template<typename T, int dim>
Image< Color, dim > Imagine::rainbow (const Image< T, dim > &I)
 Rainbow representation.
 
template<typename T, int dim>
Image< Color, dim > Imagine::rainbow (const Image< T, dim > &I, T m, T M)
 Rainbow representation.
 
template<typename T>
Image< T, 2 > Imagine::reduce (const Image< T, 2 > &I, int w, int h, bool keepRatio=false)
 Reduce image (given dimensions), 2D alias.
 
template<typename T>
Image< T, 3 > Imagine::reduce (const Image< T, 3 > &I, int w, int h, int d, bool keepRatio=false)
 Reduce image (given dimensions), 3D alias.
 
template<typename T, int dim>
Image< T, dim > Imagine::reduce (const Image< T, dim > &I, Coords< dim > nd, bool keepRatio=false)
 Reduce image (given dimensions).
 
template<typename T, int dim>
Image< T, dim > Imagine::reduce (const Image< T, dim > &I, double fact)
 Reduce image (double factor).
 
template<typename T, int dim>
Image< T, dim > Imagine::reduce (const Image< T, dim > &I, int fact)
 Reduce image (integer factor).
 
bool Imagine::save (const Image< Color > &I, std::string name, int quality=85)
 Save color image.
 
bool Imagine::save (const Image< octet > &I, std::string name)
 Save grey image.
 
bool Imagine::save (const Image< octet > &IR, const Image< octet > &IG, const Image< octet > &IB, std::string name, int quality=85)
 Save color image.
 
bool Imagine::save (Image< AlphaColor > &I, std::string name, int quality=85)
 Save color imagewith alpha channel.
 
template<typename TO, typename TI, int dim>
bool Imagine::saveAnalyze (const Image< TI, dim > &I, const std::string name)
 Save Analyze file.
 
template<typename T, int dim>
Image< T, dim > Imagine::scaleDown (const Image< T, dim > &I, int fact)
 Down scaling: fast naive version.
 
template<typename T, int dim>
Image< T, dim > Imagine::scaleUp (const Image< T, dim > &I, int fact)
 Up scaling: fast naive version.
 

Detailed Description

Function Documentation

◆ blur() [1/2]

template<typename T, int dim>
Image< T, dim > Imagine::blur ( const Image< T, dim > & I,
const FVector< typename PixelTraits< T >::scalar_type, dim > & sigmas,
bool neumann = true )

Anisotropic blur using Deriche

Parameters
Iinput image.
sigmassmoothing parameters (sigmas[i] in dimension i)
neumannNeumann border condition (default=true)
Returns
blurred image
inPlaceBlur(J,FVector<double,2>(3,.01)); // in place anisotropic blur
Vector of fixed size.
Definition FVector.h:17
void inPlaceBlur(Image< T, dim > &I, const FVector< typename PixelTraits< T >::scalar_type, dim > &sigmas, bool neumann=true)
In Place Blur (anisotropic).
Definition Algos.h:325

◆ blur() [2/2]

template<typename T, int dim>
Image< T, dim > Imagine::blur ( const Image< T, dim > & I,
typename PixelTraits< T >::scalar_type sigma,
bool neumann = true )

Blur using Deriche

Parameters
Iinput image.
sigmasmoothing parameter
neumannNeumann border condition (default=true)
Returns
blurred image
display(color(blur(J,3)),0,3*h); // blur
Image< T, dim > blur(const Image< T, dim > &I, typename PixelTraits< T >::scalar_type sigma, bool neumann=true)
Blur.
Definition Algos.h:352
Image< Color, dim > color(const Image< RGB< T >, dim > &I, const RGB< T > &m, const RGB< T > &M)
Color representation.
Definition IO.h:322
void display(const Image< octet > &I, int x=0, int y=0, bool xorMode=false, double fact=1.)
Display grey image.
Definition IO.h:161

◆ color() [1/2]

template<typename T, int dim>
Image< Color, dim > Imagine::color ( const Image< RGB< T >, dim > & I)

Represents a RGB<T> image by a Color one (each coordinate being rescaled from 0 for min value to 255 for max value, and stored to respective R,G or B channel)

Parameters
Iimage to represent
display(color(L),0,2*h); // to color

◆ color() [2/2]

template<typename T, int dim>
Image< Color, dim > Imagine::color ( const Image< RGB< T >, dim > & I,
const RGB< T > & m,
const RGB< T > & M )

Represents a RGB<T> image by a Color one (each coordinate being rescaled from 0 to 255 and stored to respective R,G or B channel)

Parameters
Iimage to represent
m,Mextremal values (For each channel, m[i] (or less) will be 0, M[i] (or more) 255)
display(color(L,RGB<double>(.2,.3,.1),RGB<double>(.8,1.,.6)),w,2*h); // to color (given range)
RED GREEN BLUE color.
Definition Color.h:28

◆ createMaskFromColor()

void Imagine::createMaskFromColor ( Image< AlphaColor > & I,
AlphaColor col )
inline

Create a transparency mask from a specified color-key. Hides a color in current image by making it invisible.

Parameters
Iimage to modify
colcolor to hide
// Create mask
load(Ib,srcPath("ryu.gif")); // Load Image
createMaskFromColor(Ib,Color(112,136,136)); // ...
Image.
Definition Image.h:24
#define srcPath(s)
Transform relative file path to absolute path.
Definition Base.h:43
RGB< octet > Color
RGB<octet> alias.
Definition Color.h:283
bool load(Image< octet > &I, std::string name)
Load grey image.
Definition IO.h:37
void createMaskFromColor(Image< AlphaColor > &I, AlphaColor col)
Create a transparency mask from a specified color-key.
Definition IO.h:22

◆ cut2D()

template<typename T, int dim>
Image< T > Imagine::cut2D ( const Image< T, dim > & I,
const Coords< dim > & cut,
int d1,
int d2 )

Extract a 2D cut from a N-dimensional image

Parameters
Iimage to cut
cuta point of the cut (used to set every fixed coordinates).
d1the first moving coordinate.
d2the second moving coordinate.
display(cut2D(M,Coords<3>(0,5,0),0,2),2*w,2*h); // 2D cut (here {j=5})
Coordinates.
Definition Coords.h:16
Image< T > cut2D(const Image< T, dim > &I, const Coords< dim > &cut, int d1, int d2)
2D cut.
Definition IO.h:218

◆ deriche()

template<typename T, int dim>
Image< T, dim > Imagine::deriche ( const Image< T, dim > & I,
typename PixelTraits< T >::scalar_type sigma,
int order,
int d,
bool neumann = true )

Deriche filter

Parameters
Iinput image.
sigmasmoothing parameter
orderorder of derivation (between 0 and 2)
ddimension of derivation
neumannNeumann border condition (default=true)
Returns
filtered image
Image< RGB<double> > J(I); // Deriche
display(color(deriche(J,3.,0,0)),w,2*h);
display(color(deriche(J,1.,1,1)),2*w,2*h); // ...
Image< T, dim > deriche(const Image< T, dim > &I, typename PixelTraits< T >::scalar_type sigma, int order, int d, bool neumann=true)
Deriche filter.
Definition Algos.h:311

◆ derivative()

template<typename T, int dim>
T Imagine::derivative ( const Image< T, dim > & u,
const Coords< dim > & p,
int d )

PDE schemes. Derivative.

Parameters
uimage
pposition
ddirection
Returns
derivative
cout << derivative(u,p,0) << ' '; // Derivatives at p
T derivative(const Image< T, dim > &u, const Coords< dim > &p, int d)
Derivative.
Definition Schemes.h:58
cout << derivative(u,p,1) << ' ';
cout << derivative(u,p,2) << endl; // ...

◆ display() [1/4]

void Imagine::display ( const Image< AlphaColor > & I,
int x = 0,
int y = 0,
bool xorMode = false,
double fact = 1. )
inline

Displays a alpha color image in current Window. NB: zooming factor is a fast hardware rendering and does not necesseraly use interpolation or anti aliasing.

Parameters
Iimage to display
x,yposition in window (default=(0,0))
xorModeXOR drawing (default=off). Used twice, recovers the original content
factscaling factor (default=1.)
display(I); //Display PNG Image

◆ display() [2/4]

void Imagine::display ( const Image< Color > & I,
int x = 0,
int y = 0,
bool xorMode = false,
double fact = 1. )
inline

Displays a color image in current Window. NB: zooming factor is a fast hardware rendering and does not necesseraly use interpolation or anti aliasing.

Parameters
Iimage to display
x,yposition in window (default=(0,0))
xorModeXOR drawing (default=off). Used twice, recovers the original content
factscaling factor (default=1.)
display(J,w,0); // display color

◆ display() [3/4]

void Imagine::display ( const Image< octet > & I,
int x = 0,
int y = 0,
bool xorMode = false,
double fact = 1. )
inline

Displays a grey image in current Window. NB: zooming factor is a fast hardware rendering and does not necesseraly use interpolation or anti aliasing.

Parameters
Iimage to display
x,yposition in window (default=(0,0))
xorModeXOR drawing (default=off). Used twice, recovers the original content
factscaling factor (default=1.)
display(I); // display grey

◆ display() [4/4]

void Imagine::display ( const Image< octet > & IR,
const Image< octet > & IG,
const Image< octet > & IB,
int x = 0,
int y = 0,
bool xorMode = false,
double fact = 1. )
inline

Displays a color image given by 3 chanels in current Window. NB: zooming factor is a fast hardware rendering and does not necesseraly use interpolation or anti aliasing.

Parameters
IR,IG,IBimage to display
x,yposition in window (default=(0,0))
xorModeXOR drawing (default=off). Used twice, recovers the original content
factscaling factor (default=1.)
display(R,G,B,2*w,0,false,1.5); // display color (3 chanels)

◆ enlarge() [1/2]

template<typename T, int dim>
Image< T, dim > Imagine::enlarge ( const Image< T, dim > & I,
Coords< dim > nd,
bool keepRatio = false )

Enlarges image to given dimensions. Interpolation is performed. If ratio is kept, extra parts of the reduced image are filled with the max value of the original one.

Parameters
Iimage to scale
ndenlarged dimensions.
keepRatiokeeps aspect ratio or not?
Returns
a larger image.
display(enlarge(I,400,400),350,h); // enlargement (dimensions)
Image< T, dim > enlarge(const Image< T, dim > &I, Coords< dim > nd, bool keepRatio=false)
Enlarge image (given dimensions).
Definition Algos.h:137
display(enlarge(I,400,400,true),600,h); // ...

◆ enlarge() [2/2]

template<typename T, int dim>
Image< T, dim > Imagine::enlarge ( const Image< T, dim > & I,
double fact )
inline

Enlarges image by a given factor. Interpolation is performed.

Parameters
Iimage to scale
factenlargement factor.
Returns
a larger image.
display(enlarge(I,1.5),0,2*h); // enlargement (factor)

◆ gaussianCurvature()

template<typename T>
T Imagine::gaussianCurvature ( const Image< T, 3 > & u,
const Coords< 3 > & p )

PDE schemes. Gaussian curvature of iso level at p

Parameters
uimage
pposition
Returns
Gaussian curvature of iso level
cout << gaussianCurvature(u,p) << endl; // Gaussian curvature of iso level at p
T gaussianCurvature(const Image< T, 3 > &u, const Coords< 3 > &p)
Gaussian curvature of iso level (3D).
Definition Schemes.h:278

◆ gradient()

template<typename T, int dim>
FVector< T, dim > Imagine::gradient ( const Image< T, dim > & u,
const Coords< dim > & p )

PDE schemes. Gradient at p

Parameters
uimage
pposition
Returns
gradient
cout << gradient(u,p) << endl << normal(u,p) << endl; // Gradient and unit normal of iso level at p
FVector< T, dim > gradient(const Image< T, dim > &u, const Coords< dim > &p)
Gradient.
Definition Schemes.h:350
FVector< T, dim > normal(const Image< T, dim > &u, const Coords< dim > &p)
Unit normal of iso level.
Definition Schemes.h:334

◆ grey() [1/2]

template<typename T, int dim>
Image< octet, dim > Imagine::grey ( const Image< T, dim > & I)

Represents a scalar image by a grey scale (from BLACK for min value to WHITE for max value) for display purposes

Parameters
Iimage to represent
display(grey(K),2*w,h); // to grey
Image< octet, dim > grey(const Image< T, dim > &I, T m, T M)
Grey level representation.
Definition IO.h:289

◆ grey() [2/2]

template<typename T, int dim>
Image< octet, dim > Imagine::grey ( const Image< T, dim > & I,
T m,
T M )

Represents a scalar image by a grey scale (from BLACK to WHITE) for display purposes

Parameters
Iimage to represent
m,Mextremal values (m (or less) will be BLACK, M (or more) WHITE)
display(grey(K,.2,.8),3*w,h); // to grey (given range)

◆ inPlaceBlur() [1/2]

template<typename T, int dim>
void Imagine::inPlaceBlur ( Image< T, dim > & I,
const FVector< typename PixelTraits< T >::scalar_type, dim > & sigmas,
bool neumann = true )

In place anisotropic blur using Deriche

Parameters
Iinput/output image.
sigmassmoothing parameters (sigmas[i] for dimension i)
neumannNeumann border condition (default=true)
inPlaceBlur(J,FVector<double,2>(3,.01)); // in place anisotropic blur

◆ inPlaceBlur() [2/2]

template<typename T, int dim>
void Imagine::inPlaceBlur ( Image< T, dim > & I,
typename PixelTraits< T >::scalar_type sigma,
bool neumann = true )

In place blur using Deriche

Parameters
Iinput/output image.
sigmasmoothing parameter
neumannNeumann border condition (default=true)
inPlaceBlur(J,1.); // in place blur

◆ inPlaceDeriche()

template<typename T, int dim>
void Imagine::inPlaceDeriche ( Image< T, dim > & I,
typename PixelTraits< T >::scalar_type sigma,
int order,
int d,
bool neumann = true )

In place Deriche filter

Parameters
Iinput/output image.
sigmasmoothing parameter
orderorder of derivation (between 0 and 2)
ddimension of derivation
neumannNeumann border condition (default=true)
inPlaceDeriche(J,2.,2,0); // in place Deriche
void inPlaceDeriche(Image< T, dim > &I, typename PixelTraits< T >::scalar_type sigma, int order, int d, bool neumann=true)
In place Deriche filter.
Definition Algos.h:188
display(color(J),3*w,2*h); // ...

◆ laplacian()

template<typename T, int dim>
T Imagine::laplacian ( const Image< T, dim > & u,
const Coords< dim > & p )

PDE schemes. Laplacian.

Parameters
uimage
pposition
Returns
Laplacian
cout << laplacian(u,p) << endl; // Laplacian at p
T laplacian(const Image< T, dim > &u, const Coords< dim > &p)
Laplacian.
Definition Schemes.h:74

◆ load() [1/4]

bool Imagine::load ( Image< AlphaColor > & I,
std::string name )
inline

Loads a alpha color (i.e AlphaColor) image from a file. Known formats are JPG, PNG, TIFF, GIF. Prefer PNG for image with transparency displaying.

Parameters
Iimage to load
namefile name
Returns
true if OK
Image<AlphaColor> I; // Load PNG image
load(I, srcPath("sup.png"));
load(Ia,srcPath("ryu.gif")); //Load GIF image
// Create mask
load(Ib,srcPath("ryu.gif")); // Load Image
createMaskFromColor(Ib,Color(112,136,136)); // ...

◆ load() [2/4]

bool Imagine::load ( Image< Color > & I,
std::string name )
inline

Loads a color (i.e Color) image from a file. Known formats are JPG, PNG, TIFF

Parameters
Iimage to load
namefile name
Returns
true if OK
load(J,srcPath("test.jpg")); // load color

◆ load() [3/4]

bool Imagine::load ( Image< octet > & I,
std::string name )
inline

Loads a grey (octet) image from a file. Known formats: JPG, PNG, TIFF

Parameters
Iimage to load
namefile name
Returns
true if OK
load(I,srcPath("test.jpg")); // load grey

◆ load() [4/4]

bool Imagine::load ( Image< octet > & IR,
Image< octet > & IG,
Image< octet > & IB,
std::string name )
inline

Loads a color (i.e 3 chanels) images from a file. Known formats are JPG, PNG, TIFF

Parameters
IR,IG,IBR,G,B images to load
namefile name
Returns
true if OK
load(R,G,B,srcPath("test.jpg")); // load color chanels

◆ loadAnalyze()

template<typename T, int dim>
bool Imagine::loadAnalyze ( Image< T, dim > & I,
const std::string name )
inline

Loads an image from an Analyze file (medical imaging) (extensions IMG and HDR)

Parameters
Iimage to load
namefile name
Returns
true if OK
// Analyze tests
saveAnalyze<float>(I,"out"); // saving octet into float
Image<octet> I0,K0;
loadAnalyze(I0,"out"); // checking
if (I(10,10)!=I0(10,10))
cout << "Analyze error!!!" << endl;
saveAnalyze<double>(K,"out"); // saving double into double
loadAnalyze(K0,"out"); // checking
if (K(10,10)!=K0(10,10))
cout << "Analyze error!!!" << endl; // ...
bool saveAnalyze(const Image< TI, dim > &I, const std::string name)
Save Analyze file.
Definition Analyze.h:99
bool loadAnalyze(Image< T, dim > &I, const std::string name)
Load Analyze file.
Definition Analyze.h:36

◆ meanCurvature()

template<typename T>
T Imagine::meanCurvature ( const Image< T, 3 > & u,
const Coords< 3 > & p )

PDE schemes. Mean curvature of iso level at p.

Parameters
uimage
pposition
Returns
mean curvature
cout << meanCurvature(u,p) << endl; // Mean curvature of iso level at p
T meanCurvature(const Image< T, 3 > &u, const Coords< 3 > &p)
Mean curvature (3D).
Definition Schemes.h:92

◆ meanCurvatureMotion()

template<typename T>
T Imagine::meanCurvatureMotion ( const Image< T, 3 > & u,
const Coords< 3 > & p )

PDE schemes. Level set Mean curvature motion at p

Parameters
uimage
pposition
Returns
mean curvature motion
cout << meanCurvatureMotion(u,p) << endl; // Level set Mean curvature motion at p
T meanCurvatureMotion(const Image< T, 3 > &u, const Coords< 3 > &p)
Level set Mean curvature motion (3D).
Definition Schemes.h:152

◆ neighbourCoords()

template<typename T, int dim>
void Imagine::neighbourCoords ( const Image< T, dim > & u,
const Coords< dim > & p,
Coords< dim > & pp,
Coords< dim > & pm )

PDE schemes. Coordinates of neighbours of p in each direction. Set to p[i] when it would lead outside of the image.

Parameters
uimage
pposition
ppcoordinates of forward neighbours (change p[i] into pp[i] to get ith forward neighbour)
pmcoordinates of backward neighbours (change p[i] into pm[i] to get ith backward neighbour)
neighbourCoords(u,p0,pp,pm); // neighb coords
void neighbourCoords(const Image< T, dim > &u, const Coords< dim > &p, Coords< dim > &pp, Coords< dim > &pm)
Coordinates of neighbours.
Definition Schemes.h:41

◆ neighbourOffsets()

template<typename T, int dim>
void Imagine::neighbourOffsets ( const Image< T, dim > & u,
const Coords< dim > & p,
FVector< size_t, dim > & dp,
FVector< size_t, dim > & dm )

PDE schemes. Offsets to neighbours of p in each direction. Set to 0 when it would lead outside of the image. Warning: dm is positive, thus -dm should be applied to get backward neighbour.

Parameters
uimage
pposition
dpoffsets to forward neighbors (dp[i] for ith dim)
dmoffsets to backward neighbors (dm[i] for ith dim)
neighbourOffsets(u,p0,dp,dm); // neighb offsets
void neighbourOffsets(const Image< T, dim > &u, const Coords< dim > &p, FVector< size_t, dim > &dp, FVector< size_t, dim > &dm)
Offsets to neighbours.
Definition Schemes.h:25

◆ normal()

template<typename T, int dim>
FVector< T, dim > Imagine::normal ( const Image< T, dim > & u,
const Coords< dim > & p )

PDE schemes. Unit normal of iso level at p

Parameters
uimage
pposition
Returns
n normal
cout << gradient(u,p) << endl << normal(u,p) << endl; // Gradient and unit normal of iso level at p

◆ rainbow() [1/2]

template<typename T, int dim>
Image< Color, dim > Imagine::rainbow ( const Image< T, dim > & I)

Represents a scalar image by a rainbow scale (from RED for min value to BLUE for max value) for display purposes

Parameters
Iimage to represent
display(rainbow(K),0,h); // to rainbow
Image< Color, dim > rainbow(const Image< T, dim > &I, T m, T M)
Rainbow representation.
Definition IO.h:259

◆ rainbow() [2/2]

template<typename T, int dim>
Image< Color, dim > Imagine::rainbow ( const Image< T, dim > & I,
T m,
T M )

Represents a scalar image by a rainbow scale (from RED to BLUE) for display purposes

Parameters
Iimage to represent
m,Mextremal values (m (or less) will be RED, M (or more) will be BLUE)
display(rainbow(K,.2,.8),w,h); // to rainbow (given range)

◆ reduce() [1/3]

template<typename T, int dim>
Image< T, dim > Imagine::reduce ( const Image< T, dim > & I,
Coords< dim > nd,
bool keepRatio = false )

Reduces image to given dimensions. Anti aliasing is performed. If ratio is kept, extra parts of the reduced image are filled with the max value of the original one.

Parameters
Iimage to scale
ndreduced dimensions.
keepRatiokeeps aspect ratio or not?
Returns
a smaller image.
display(reduce(I,100,50),0,h); // reduction (dimensions)
Image< T, dim > reduce(const Image< T, dim > &I, int fact)
Reduce image (integer factor).
Definition Algos.h:62
display(reduce(I,100,50,true),100,h); // ...

◆ reduce() [2/3]

template<typename T, int dim>
Image< T, dim > Imagine::reduce ( const Image< T, dim > & I,
double fact )
inline

Reduces image by a given fcator. Anti aliasing is performed.

Parameters
Iimage to scale
factreduction factor.
Returns
a smaller image.
display(reduce(I,1.6),200,h); // reduction (double factor)

◆ reduce() [3/3]

template<typename T, int dim>
Image< T, dim > Imagine::reduce ( const Image< T, dim > & I,
int fact )

Reduces image by an integer factor. Each pixel is assigned with the mean of the corresponding original pixels.

Parameters
Iimage to scale
factdivider coefficient.
Returns
a smaller image.
display(reduce(I,2),7*w/2,0); // reduction (integer factor)

◆ save() [1/4]

bool Imagine::save ( const Image< Color > & I,
std::string name,
int quality = 85 )
inline

Saves a color (i.e Color) image to a file. Known formats are JPG, PNG, TIFF

Parameters
Iimage to save
namefile name
qualityJpeg quality (between 0 and 100)
Returns
true if OK
save(J,"out_color.tif"); // save color
bool save(const Image< octet > &I, std::string name)
Save grey image.
Definition IO.h:53
save(J,"out_color.jpg",95); // ...

◆ save() [2/4]

bool Imagine::save ( const Image< octet > & I,
std::string name )
inline

Saves a grey (i.e octet) image to a file. Known formats are JPG, PNG, TIFF

Parameters
Iimage to save
namefile name
Returns
true if OK
save(I,"out_grey.png"); // save grey

◆ save() [3/4]

bool Imagine::save ( const Image< octet > & IR,
const Image< octet > & IG,
const Image< octet > & IB,
std::string name,
int quality = 85 )
inline

Saves a color (i.e 3 chanels) image to a file. Known formats are JPG, PNG, TIFF

Parameters
IR,IG,IBR,G,B chanels to save
namefile name
qualityJpeg quality (between 0 and 100)
Returns
true if OK
save(R,G,B,"out_color.png"); // save color chanels

◆ save() [4/4]

bool Imagine::save ( Image< AlphaColor > & I,
std::string name,
int quality = 85 )
inline

Saves a alpha color (i.e AlphaColor) image to a file. Known formats are JPG, PNG, TIFF, GIF

Parameters
Iimage to save
namefile name
qualityJpeg quality (between 0 and 100)
Returns
true if OK
save(Ib,"out.png"); // save image with alpha channel

◆ saveAnalyze()

template<typename TO, typename TI, int dim>
bool Imagine::saveAnalyze ( const Image< TI, dim > & I,
const std::string name )
inline

Saves an image into an Analyze file (medical imaging) (extensions IMG and HDR)

Template Parameters
T0output type
TIimage type
Parameters
Iimage to save
namefile name
Returns
true if OK
// Analyze tests
saveAnalyze<float>(I,"out"); // saving octet into float
Image<octet> I0,K0;
loadAnalyze(I0,"out"); // checking
if (I(10,10)!=I0(10,10))
cout << "Analyze error!!!" << endl;
saveAnalyze<double>(K,"out"); // saving double into double
loadAnalyze(K0,"out"); // checking
if (K(10,10)!=K0(10,10))
cout << "Analyze error!!!" << endl; // ...

Build header and data filenames and open files

◆ scaleDown()

template<typename T, int dim>
Image< T, dim > Imagine::scaleDown ( const Image< T, dim > & I,
int fact )

Scales image down. Fast naive version with no anti-aliasing: each pixel is assigneg with the value of one corresponding pixel in the original image.

Parameters
Iimage to scale
factdown scaling factor.
Returns
a smaller image.
display(scaleDown(I,2),3*w,0); // scale down (fast naive)
Image< T, dim > scaleDown(const Image< T, dim > &I, int fact)
Down scaling: fast naive version.
Definition Algos.h:45

◆ scaleUp()

template<typename T, int dim>
Image< T, dim > Imagine::scaleUp ( const Image< T, dim > & I,
int fact )

Scales image up. Fast naive version with no interpolation: each original pixel becomes a big constant one.

Parameters
Iimage to scale
factup scaling factor.
Returns
a larger image.
display(scaleUp(I,2),w,0); // scale up (fast naive)
Image< T, dim > scaleUp(const Image< T, dim > &I, int fact)
Up scaling: fast naive version.
Definition Algos.h:23