In file inrimage/Inrimage.h:

class Inrimage : public BaseInrimage, public Pointed<Inrimage>

Inrimages

Inheritance:


Public Classes

enum WORD_TYPE
different handled inrimage types
WT_UNSIGNED_CHAR
unsigned 8 bits
WT_SIGNED_CHAR
signed 8 bits
WT_UNSIGNED_SHORT
unsigned 16 bits
WT_SIGNED_SHORT
signed 16 bits
WT_UNSIGNED_INT
unsigned 32 bits
WT_SIGNED_INT
signed 32 bits
WT_UNSIGNED_LONG
unsigned 64 bits
WT_SIGNED_LONG
signed 64 bits
WT_FLOAT
float 32 bits
WT_DOUBLE
float 64 bits
WT_RGB
R, G, B, 8 bits each
WT_RGBA
R, G, B, A, 8 bits each
WT_FLOAT_VECTOR
Vector of 32 bit floats
WT_DOUBLE_VECTOR
Vector of 64 bit floats
enum SLICE_ORIENTATION
the different geometry of a slice of a volumetric image
SLICE_X
slice with X (column) = constant
SLICE_Y
slice with Y (row) = constant
SLICE_Z
slice with Z (plane) = constant
SLICE_ALPHA
slice with alpha (angle in XY) = constant
enum GEOMETRY
the different image kinds
CARTESIAN
standard 3D image
CYLINDRICAL
cylindrical geometry (Z = plane angle, Y = elevation, Z = in plane radius)
SPHERICAL
spherical geometry (Z = plane angle, Y = in plane angle, X = radius)
enum CompressType
Compression type for writing
CT_8BITS
write using 8bits/voxel
CT_16BITS
write using 16bits/voxel
enum Noise
noise kinds
WHITE_NOISE
white Gaussian noise
GAUSSIAN_NOISE
Gaussian noise on image
US_NOISE
ultrasond-like

Public Methods

Inrimage& operator= (const Inrimage& img) throw(Inrimage::InvalidSize, Inrimage::InvalidVectorialMode, Inrimage::InvalidVoxelSize, Inrimage::NotEnoughMemory)
Make *this a replica of img
virtual Inrimage* allocate (unsigned int xdim, unsigned int ydim, unsigned int zdim, WORD_TYPE wt, unsigned int vdim = 1, VECTORIAL_MODE vm = VM_INTERLACED, float vx = 1.0, float vy = 1.0, float vz = 1.0) const throw(Inrimage::InvalidSize, Inrimage::UnknownType, Inrimage::NotEnoughMemory, InvalidVoxelSize)
Creates an inrimage from its size and its type
virtual Inrimage* allocate (const Inrimage& img) const throw(Inrimage::InvalidSize, Inrimage::InvalidVectorialMode, Inrimage::InvalidVoxelSize, Inrimage::NotEnoughMemory)
Created an inrimage identical to img
virtual void resize (unsigned int xdim, unsigned int ydim, unsigned int zdim, unsigned int vdim = 1, unsigned int wdim = 1, WORD_KIND wordKind = WK_FIXED, SIGN sign = SGN_SIGNED) throw(Inrimage::InvalidSize, Inrimage::NotEnoughMemory)
Changes image size
unsigned int ncols (void) const
returns number of columns
unsigned int nrows (void) const
returns number of rows
const TclString& getName (void) const
get inrimage file name
void setName (const TclString& _name)
set inrimage file name
WORD_TYPE getType (void) const
returns inrimage type
void setType (WORD_TYPE type, unsigned int vdim = 1, VECTORIAL_MODE vm = VM_INTERLACED, bool resize = true)
set inrimage type
void*** getArray (void) const
returns pointer a 3D buffer for a scalar image or interleaved vectorial image
void**** getVarray (void) const
returns a 4D buffer for a vectorial non-interleaved image
unsigned int sizeofWords (void) const
returns size of image words (each vector component size)
unsigned int sizeofVoxels (void) const
returns size of each voxel (a vector is one voxel)
void write (const char *name) throw(Inrimage::UnableToCreateFile, Inrimage::UnableToWriteHeader, Inrimage::UnableToWriteData)
Writes inrimage to file whose path is given as argument
void write (const char *name, CompressType ct) throw(UnableToCreateFile, UnableToWriteHeader, UnableToWriteData, InvalidCompressType)
Writes inrimage to file whose path is given as argument
virtual void allocate (void) throw(Inrimage::NotEnoughMemory)
Allocates and fills with zero image data buffer
virtual void free (void)
frees image data buffer
bool inside (const int x, const int y, const int z)
Tests if a voxel position is within the bounds of the image
virtual void* setData (void *data) throw(NotEnoughMemory)
Set a new data buffer
virtual void setVectorialMode (VECTORIAL_MODE vm) throw(Inrimage::InvalidVectorialMode, Inrimage::NotEnoughMemory)
Changes image vectorial mode
GEOMETRY getGeometry (void) const
returns image geometry
void setGeometry (GEOMETRY g)
set image geometry
Interpolator const* getInterpolator () const
set interpolator object
Extrapolator const* getExtrapolator () const
set extrapolator object
void setInterpolator (Interpolator* i)
set interpolator object
void setExtrapolator (Extrapolator* e)
set extrapolator object
ImageGeometry* newConverter (void) const
creates an image coordinates converter for this image geometry
Voxel* getRealVoxel (double x, double y, double z) const
Return image voxel at (x,y,z), using interpolation or extrapolation as appropriate
Voxel& getRealVoxel (double x, double y, double z, Voxel& v) const
Stores voxel (x, y, z) value in v, using interpolation or extrapolation as appropriate
Voxel* getVoxel (unsigned int x, unsigned int y, unsigned int z) const
returns a Voxel representing given image voxel
Voxel& getVoxel (unsigned int x, unsigned int y, unsigned int z, Voxel& v) const
stores voxel (x, y, z) value in v
void setVoxel (unsigned int x, unsigned int y, unsigned int z, const Voxel& v)
set given image voxel with transmitted voxel value
Voxel* checkVoxel (unsigned int x, unsigned int y, unsigned int z) const
Returns a Voxel representing given image voxel
void line (int x1, int y1, int x2, int y2, unsigned int z, const Voxel& v)
draw a 2D discrete line in given image plane
virtual void setWords (WORD_KIND wordKind = WK_FIXED, SIGN sign = SGN_SIGNED) throw(Inrimage::NotEnoughMemory)
Changes image word type
bool in (unsigned int row, unsigned int col, unsigned int plane)
indicates wether voxel lies in image bounds
bool sameSize (Inrimage const& inr) const
indicates wether inr has same size than this
void crop (unsigned int x1, unsigned int y1, unsigned int z1, unsigned int x2, unsigned int y2, unsigned int z2) throw(Inrimage::InvalidArguments)
crops region between (x1, y1, z1) and (x2, y2, z2) in inrimage Crop expects x1 < x2, y1 < y2 and z1 < z2
void isolateRegion (unsigned int x1, unsigned int y1, unsigned int z1, unsigned int x2, unsigned int y2, unsigned int z2) throw(Inrimage::InvalidArguments)
put to 0 all voxels outside region between (x1, y1, z1) and (x2, y2, z2) in inrimage it expects x1 < x2, y1 < y2 and z1 < z2
void zeroRegion (unsigned int x1, unsigned int y1, unsigned int z1, unsigned int x2, unsigned int y2, unsigned int z2) throw(Inrimage::InvalidArguments)
put to 0 all voxels inside region between (x1, y1, z1) and (x2, y2, z2) in inrimage it expects x1 < x2, y1 < y2 and z1 < z2
void getBounds (Voxel *min, Voxel *max, bool vectorNorm = true) const
compute inrimage grey level bounds
void setBounds (Voxel *min, Voxel *max, int z = -1)
Set inrimage grey level bounds (rescales GL window)
static bool vectorial (WORD_TYPE)
returns true if type is WT_FLOAT_VECTOR, WT_DOUBLE_VECTOR, WT_RGB or WT_RGBA, false otherwise
static bool floating (WORD_TYPE)
returns true if type is WT_FLOAT, WT_DOUBLE, WT_FLOAT_VECTOR or WT_DOUBLE_VECTOR, false otherwise
Inrimage** splitVectors (void) const
Split a vectorial inrimage in one inrimage per component
void setComponentsFrom (Inrimage **inrs) throw(Inrimage::InvalidSize, InvalidArguments)
Set vectorial components from an array of scalar inrimages
void flip (SLICE_ORIENTATION geom)
flip an inrimage in given direction
void switchGeometry (SLICE_ORIENTATION geom1, SLICE_ORIENTATION geom2)
switch two inrimage dimensions
void mel (const Inrimage *inr, int xdest, int ydest, int zdest, int xorg, int yorg, int zorg, unsigned int dx, unsigned int dy, unsigned int dz) throw(Inrimage::InvalidArguments)
mel given inrimage with this by substituing a box from this with a box from inr
GenericHistogram* createHistogram () const
creates and return the Histogram of this image
void noise (unsigned int x1, unsigned int y1, unsigned int z1, unsigned int x2, unsigned int y2, unsigned int z2, Noise kind, double mean, double dev) throw(Inrimage::InvalidArguments )
creates a noisy cube inside this inrimage
void convertCast (WORD_TYPE type)
converts inrimage to any type
void convertScale (WORD_TYPE type)
converts inrimage to any type, resizing grey-levels
void eval (char *func, int nmbr, Var_list *op) throw(Inrimage::InvalidArguments)
Evaluates expression in function string
static Vec3 * createDirectionArray (int frequency = DEFAULT_SPHERE_FREQUENCY)
Creates a vector array corresponding to the position of unit vector on a spherical dome of frequency "frequency"
void underSample (unsigned int sx = 2, unsigned int sy = 2, unsigned int sz = 1)
Undersamples image by an integer coefficient
void overSample (unsigned int sx, unsigned int sy, unsigned int sz) throw(Inrimage::InvalidSize)
Oversample an image
void resample (unsigned int sx, unsigned int sy, unsigned int sz)
Resamples an image to given image size
void setRegion (int x1, int y1, int z1, int x2, int y2, int z2)
set region in which operations are performed
void getRegion (int& x1, int& y1, int& z1, int& x2, int& y2, int& z2)
get region in which operations are performed
void getWorkRegion (unsigned int& x1, unsigned int& y1, unsigned int& z1, unsigned int& x2, unsigned int& y2, unsigned int& z2) const
get region [(x1,y1,z1),(x2,y2,z2)) in which operations are should be performed
void copyRegion (Inrimage const& img)
copy region from another image
bool regionIsWholeImage () const
test if region is the whole image

Public

Exception classes
class UnknownType : public Exception
unknown inrimage type
class InvalidArguments : public Exception
invalid arguments transmitted to method
class InvalidCompressType : public Exception
attempt to write image in an invalid compress type
class MissingCompressInfo : public Exception
missing compression information in header
Constructors
Inrimage (const TclString& name, bool headerOnly = false, VECTORIAL_MODE vm = VM_INTERLACED, VECTORIAL_MODE filevm = VM_INTERLACED) throw(ImageNotFound, UnknownImageType, InvalidHeader, InvalidData, UnknownType, InvalidVoxelSize)
Reads inrimage from file whose path is given as argument
Inrimage (unsigned int xdim, unsigned int ydim, unsigned int zdim, unsigned int vdim = 1, unsigned int wdim = 1, WORD_KIND wordKind = WK_FIXED, SIGN sign = SGN_SIGNED, float vx = 1.0, float vy = 1.0, float vz = 1.0) throw(InvalidSize, UnknownType, NotEnoughMemory, InvalidVoxelSize)
Creates an inrimage with given size and word type
Inrimage (unsigned int xdim, unsigned int ydim, unsigned int zdim, void *data, unsigned int vdim = 1, unsigned int wdim = 1, WORD_KIND wordKind = WK_FIXED, SIGN sign = SGN_SIGNED, float vx = 1.0, float vy = 1.0, float vz = 1.0) throw(InvalidSize, UnknownType, InvalidVoxelSize)
Creates an inrimage with given size and word type
Inrimage (unsigned int xdim, unsigned int ydim, unsigned int zdim, WORD_TYPE wt, unsigned int vdim = 1, VECTORIAL_MODE vm = VM_INTERLACED, float vx = 1.0, float vy = 1.0, float vz = 1.0) throw(InvalidSize, UnknownType, NotEnoughMemory, InvalidVoxelSize)
Creates an inrimage from its size and its type
Inrimage (unsigned int n, Inrimage **inrs, WORD_TYPE wt = WT_FLOAT_VECTOR, VECTORIAL_MODE vm = VM_INTERLACED, float vx = 1.0, float vy = 1.0, float vz = 1.0) throw(InvalidSize, InvalidArguments, NotEnoughMemory, InvalidVoxelSize)
Creates a vectorial inrimage from scalar inrimages
Inrimage (const Inrimage& img) throw(InvalidSize, InvalidVectorialMode, InvalidVoxelSize, NotEnoughMemory)
Creates an replica of img
Destructor
virtual ~Inrimage ()
deallocates image buffer

Protected Fields

TclString name
image file name
WORD_TYPE type
inrimage type
GEOMETRY geom
inrimage geometry
Interpolator const* interpolator
interpolator object used for image values at real coordinates inside the image.
void**** fourD
3D array on each image voxel -> array[z][y][x]

4D array on each vector component when vectors are not interlaced -> varray[v][z][y][x]
Extrapolator const* extrapolator
extrapolator object used for image values at real coordinates outside the image.
float region [6]
region in which operations are performed, in world coordinates. not used by all operations.

Private Fields

friend class TclInrimage
buffer convertion routine

Private Methods

void setType (void) throw(Inrimage::UnknownType)
set initial image type
void index3D (void) throw(Inrimage::NotEnoughMemory)
builds 3D index (array buffer, standard inrimage)
void index4D (void) throw(Inrimage::NotEnoughMemory)
builds 4D index (varray buffer, non-interlaced vectorial inrimage)
void buildIndex () throw(Inrimage::NotEnoughMemory)
builds 3D or 4D index depending on vectorial mode
void deleteArray (void)
deletes array buffer
void queryGeometry (void)
set image geometry field looking at inrimage header tags
void convertFromRGBToRGBABuffer (void)
buffer convertion routine
void convertFromRGBAToRGBBuffer (void)
buffer convertion routine

Inherited from BaseInrimage:

Public Methods

unsigned int getX() const
unsigned int getY() const
unsigned int getZ() const
void setX(const unsigned int x)
void setY(const unsigned int y)
void setZ(const unsigned int z)
void setVdim(const unsigned int v)
unsigned int getVdim(void) const
unsigned int getWdim(void) const
float getVX() const
float getVY() const
float getVZ() const
void* getData() const
unsigned int getWordSize() const
WORD_KIND getWordKind() const
SIGN getWordSign() const
VECTORIAL_MODE getVectorialMode() const
IMAGE_FORMAT getFileFormat(void) const
void setFileFormat(IMAGE_FORMAT f)
void setVoxelSize(float vx, float vy, float vz) throw(InvalidVoxelSize)
virtual void setInterlacedData(void)
virtual void setNonInterlacedData(void)
void setUserParams(unsigned int n, char **params)
static BaseInrimage* _image2BaseInrimage(const _image& img) throw(BaseInrimage::InvalidSize, BaseInrimage::InvalidVoxelSize, BaseInrimage::InvalidVectorialMode)
static _image* BaseInrimage2_image(const BaseInrimage& bimg)
bool userField(const char *name, char *val, unsigned int n) const
bool updateUserField(const char *name, const char *val) const
void addUserField(const char *name, const char *val)
bool removeUserField(const char *name)
template void rescaleBuffer(FROM, TO, double fmin, double fmax, double tmin, double tmax, double offset, BaseInrimage& img)

Public

Destructors

virtual ~BaseInrimage()
frees image buffer

Protected Fields

unsigned int xdim
unsigned int ydim
unsigned int zdim
unsigned int vdim
float vx
float vy
float vz
void* data
unsigned int wdim
WORD_KIND wordKind
SIGN sign
VECTORIAL_MODE vectMode
char** user
unsigned int nuser
IMAGE_FORMAT imageFormat
ImageInformation* info

Private Methods

_image* readHeader(const char *name) throw(ImageNotFound, InvalidHeader, UnknownImageType)

Documentation

Inrimages
Exception classes

class UnknownType: public Exception
unknown inrimage type

class InvalidArguments: public Exception
invalid arguments transmitted to method

class InvalidCompressType: public Exception
attempt to write image in an invalid compress type

class MissingCompressInfo: public Exception
missing compression information in header

enum WORD_TYPE
different handled inrimage types

WT_UNSIGNED_CHAR
unsigned 8 bits

WT_SIGNED_CHAR
signed 8 bits

WT_UNSIGNED_SHORT
unsigned 16 bits

WT_SIGNED_SHORT
signed 16 bits

WT_UNSIGNED_INT
unsigned 32 bits

WT_SIGNED_INT
signed 32 bits

WT_UNSIGNED_LONG
unsigned 64 bits

WT_SIGNED_LONG
signed 64 bits

WT_FLOAT
float 32 bits

WT_DOUBLE
float 64 bits

WT_RGB
R, G, B, 8 bits each

WT_RGBA
R, G, B, A, 8 bits each

WT_FLOAT_VECTOR
Vector of 32 bit floats

WT_DOUBLE_VECTOR
Vector of 64 bit floats

enum SLICE_ORIENTATION
the different geometry of a slice of a volumetric image

SLICE_X
slice with X (column) = constant

SLICE_Y
slice with Y (row) = constant

SLICE_Z
slice with Z (plane) = constant

SLICE_ALPHA
slice with alpha (angle in XY) = constant

enum GEOMETRY
the different image kinds

CARTESIAN
standard 3D image

CYLINDRICAL
cylindrical geometry (Z = plane angle, Y = elevation, Z = in plane radius)

SPHERICAL
spherical geometry (Z = plane angle, Y = in plane angle, X = radius)

enum CompressType
Compression type for writing

CT_8BITS
write using 8bits/voxel

CT_16BITS
write using 16bits/voxel

Constructors

Inrimage(const TclString& name, bool headerOnly = false, VECTORIAL_MODE vm = VM_INTERLACED, VECTORIAL_MODE filevm = VM_INTERLACED) throw(ImageNotFound, UnknownImageType, InvalidHeader, InvalidData, UnknownType, InvalidVoxelSize)
Reads inrimage from file whose path is given as argument. File can be an INRIMAGE(4) gzipped or not, an anlayse, a GIF or a RGB irix file. If image has a vectorial type, it can be read interlaced (default) or non interlaced by giving WM_NON_INTERLACED as third argument.
Throws:
ImageNotFound image file not found
UnknownImageType unknown image file format
InvalidHeader invalid inrimage header encountered
InvalidData invalid inrimage data encountered @excpetion UnknownType unsupported inrimage type
Parameters:
name - image file name
false - if true, only image header is read (data is set to 0)
vm - vectorial mode interleave
filevm - read file vectorial mode interleave

Inrimage(unsigned int xdim, unsigned int ydim, unsigned int zdim, unsigned int vdim = 1, unsigned int wdim = 1, WORD_KIND wordKind = WK_FIXED, SIGN sign = SGN_SIGNED, float vx = 1.0, float vy = 1.0, float vz = 1.0) throw(InvalidSize, UnknownType, NotEnoughMemory, InvalidVoxelSize)
Creates an inrimage with given size and word type. The inrimage data buffer is allocated
Throws:
InvalidSize image dimension should be > 0 @excpetion UnknownType unsupported inrimage type
NotEnoughMemory unable to allocate memory to store image
InvalidVoxelSize voxels size should be > 0.0
Parameters:
xdim - image number of columns
ydim - image number of rows
zdim - image number of planes
vdim - image vectorial dimension
wdim - image word size in bytes
wordKind - image word kind
sign - image word sign
vx - distance between voxels in the X direction
vy - distance between voxels in the Y direction
vz - distance between voxels in the Z direction

Inrimage(unsigned int xdim, unsigned int ydim, unsigned int zdim, void *data, unsigned int vdim = 1, unsigned int wdim = 1, WORD_KIND wordKind = WK_FIXED, SIGN sign = SGN_SIGNED, float vx = 1.0, float vy = 1.0, float vz = 1.0) throw(InvalidSize, UnknownType, InvalidVoxelSize)
Creates an inrimage with given size and word type. If data is 0, the image is not allocated. If data is non 0, image data points to it.
Throws:
InvalidSize image dimension should be > 0 @excpetion UnknownType unsupported inrimage type
InvalidVoxelSize voxels size should be > 0.0
Parameters:
xdim - image number of columns
ydim - image number of rows
zdim - image number of planes
data - image data buffer
vdim - image vectorial dimension
wdim - image word size in bytes
wordKind - image word kind
sign - image word sign
vx - distance between voxels in the X direction
vy - distance between voxels in the Y direction
vz - distance between voxels in the Z direction

Inrimage(unsigned int xdim, unsigned int ydim, unsigned int zdim, WORD_TYPE wt, unsigned int vdim = 1, VECTORIAL_MODE vm = VM_INTERLACED, float vx = 1.0, float vy = 1.0, float vz = 1.0) throw(InvalidSize, UnknownType, NotEnoughMemory, InvalidVoxelSize)
Creates an inrimage from its size and its type
Throws:
InvalidSize image dimension should be > 0 @excpetion UnknownType unsupported inrimage type
NotEnoughMemory unable to allocate image buffer
InvalidVoxelSize voxels size should be > 0.0
Parameters:
xdim - image number of columns
ydim - image number of rows
zdim - image number of planes
wt - inrimage word type
vdim - vectorial dimension (for WT_FLOAT_VECTOR and WT_DOUBLE_VECTOR only, ignored otherwise)
vectorial - mode (for WT_FLOAT_VECTOR and WT_DOUBLE_VECTOR only, ignored otherwise)
vx - distance between voxels in the X direction
vy - distance between voxels in the Y direction
vz - distance between voxels in the Z direction

Inrimage(unsigned int n, Inrimage **inrs, WORD_TYPE wt = WT_FLOAT_VECTOR, VECTORIAL_MODE vm = VM_INTERLACED, float vx = 1.0, float vy = 1.0, float vz = 1.0) throw(InvalidSize, InvalidArguments, NotEnoughMemory, InvalidVoxelSize)
Creates a vectorial inrimage from scalar inrimages
Throws:
InvalidSize image dimension should be > 0 @excpetion InvalidArguments there should be at least one image and wt should be WT_FLOAT_VECTOR or WT_DOUBLE_VECTOR
NotEnoughMemory unable to allocate image buffer
InvalidVoxelSize voxels size should be > 0.0
Parameters:
n - number of inrimages
inrs - inrimages array
wt - type (only WT_FLOAT_VECTOR and WT_DOUBLE_VECTOR)
vm - vectorial mode
vx - distance between voxels in the X direction
vy - distance between voxels in the Y direction
vz - distance between voxels in the Z direction

Inrimage(const Inrimage& img) throw(InvalidSize, InvalidVectorialMode, InvalidVoxelSize, NotEnoughMemory)
Creates an replica of img
Throws:
InvalidSize image dimension should be > 0
InvalidVectorialMode img has scalar vectorial mode for vectorial image or opposite
InvalidVoxelSize img has <= 0 voxel size
NotEnoughMemory unable to allocate image buffer
Parameters:
img - image to copy

Destructor

virtual ~Inrimage()
deallocates image buffer

Inrimage& operator=(const Inrimage& img) throw(Inrimage::InvalidSize, Inrimage::InvalidVectorialMode, Inrimage::InvalidVoxelSize, Inrimage::NotEnoughMemory)
Make *this a replica of img
Throws:
InvalidSize image dimension should be > 0
InvalidVectorialMode img has scalar vectorial mode for vectorial image or opposite
InvalidVoxelSize img has <= 0 voxel size
NotEnoughMemory unable to allocate image buffer
Parameters:
img - image to copy

virtual Inrimage* allocate(unsigned int xdim, unsigned int ydim, unsigned int zdim, WORD_TYPE wt, unsigned int vdim = 1, VECTORIAL_MODE vm = VM_INTERLACED, float vx = 1.0, float vy = 1.0, float vz = 1.0) const throw(Inrimage::InvalidSize, Inrimage::UnknownType, Inrimage::NotEnoughMemory, InvalidVoxelSize)
Creates an inrimage from its size and its type
Throws:
InvalidSize image dimension should be > 0 @excpetion UnknownType unsupported inrimage type
NotEnoughMemory unable to allocate image buffer
InvalidVoxelSize voxels size should be > 0.0
Parameters:
xdim - image number of columns
ydim - image number of rows
zdim - image number of planes
wt - inrimage word type
vdim - vectorial dimension (for WT_FLOAT_VECTOR and WT_DOUBLE_VECTOR only, ignored otherwise)
vectorial - mode (for WT_FLOAT_VECTOR and WT_DOUBLE_VECTOR only, ignored otherwise)
vx - distance between voxels in the X direction
vy - distance between voxels in the Y direction
vz - distance between voxels in the Z direction

virtual Inrimage* allocate(const Inrimage& img) const throw(Inrimage::InvalidSize, Inrimage::InvalidVectorialMode, Inrimage::InvalidVoxelSize, Inrimage::NotEnoughMemory)
Created an inrimage identical to img
Throws:
InvalidSize image dimension should be > 0
InvalidVectorialMode img has scalar vectorial mode for vectorial image or opposite
InvalidVoxelSize img has <= 0 voxel size
NotEnoughMemory unable to allocate image buffer
Parameters:
img - image to copy

virtual void resize(unsigned int xdim, unsigned int ydim, unsigned int zdim, unsigned int vdim = 1, unsigned int wdim = 1, WORD_KIND wordKind = WK_FIXED, SIGN sign = SGN_SIGNED) throw(Inrimage::InvalidSize, Inrimage::NotEnoughMemory)
Changes image size. If image data buffer existed it is fried and reallocated.
Throws:
InvalidSize image dimension should be > 0
NotEnoughMemory unable to allocate image buffer
Parameters:
xdim - image number of columns
ydim - image number of rows
zdim - image number of planes
vdim - image vectorial dimension
wdim - image word size in bytes

unsigned int ncols(void) const
returns number of columns

unsigned int nrows(void) const
returns number of rows

const TclString& getName(void) const
get inrimage file name

void setName(const TclString& _name)
set inrimage file name
Parameters:
_name - new file name

WORD_TYPE getType(void) const
returns inrimage type

void setType(WORD_TYPE type, unsigned int vdim = 1, VECTORIAL_MODE vm = VM_INTERLACED, bool resize = true)
set inrimage type
Parameters:
type - new image type
vdim - vectorial dimension (for WT_FLOAT_VECTOR and WT_DOUBLE_VECTOR types only)
resize - whether image should be resized (and buffer reallocated to new image size)

void*** getArray(void) const
returns pointer a 3D buffer for a scalar image or interleaved vectorial image

void**** getVarray(void) const
returns a 4D buffer for a vectorial non-interleaved image

unsigned int sizeofWords(void) const
returns size of image words (each vector component size)

unsigned int sizeofVoxels(void) const
returns size of each voxel (a vector is one voxel)

void write(const char *name) throw(Inrimage::UnableToCreateFile, Inrimage::UnableToWriteHeader, Inrimage::UnableToWriteData)
Writes inrimage to file whose path is given as argument. If file name ends with '.gz' suffix, file is gzipped.
Throws:
UnableToCreateFile file creation failed for writting
UnableToWriteHeader write error encountered while writting header
UnableToWriteData write error encountered while writting data
Parameters:
name - inrimage file name

void write(const char *name, CompressType ct) throw(UnableToCreateFile, UnableToWriteHeader, UnableToWriteData, InvalidCompressType)
Writes inrimage to file whose path is given as argument. If file name ends with '.gz' suffix, file is gzipped.
Throws:
UnableToCreateFile file creation failed for writting
UnableToWriteHeader write error encountered while writting header
UnableToWriteData write error encountered while writting data
Parameters:
name - inrimage file name
ct - number of bits to convert image to before writing.

virtual void allocate(void) throw(Inrimage::NotEnoughMemory)
Allocates and fills with zero image data buffer. If data is not null, buffer is first fried.
Throws:
NotEnoughMemory unable to allocate image buffer

virtual void free(void)
frees image data buffer

bool inside(const int x, const int y, const int z)
Tests if a voxel position is within the bounds of the image
Returns:
true is the voxel is inside the image and false otherwise
Parameters:
x - the x coordinate of the voxel position
y - the y coordinate of the voxel position
z - the z coordinate of the voxel position

virtual void* setData(void *data) throw(NotEnoughMemory)
Set a new data buffer. If image data is not 0, it is first fried. Use setVectorialMode(VECTORIAL_MODE vm) if vectMode has changed
Throws:
NotEnoughMemory unable to allocate image buffer
Returns:
old image data buffer
Parameters:
data - new image data buffer

virtual void setVectorialMode(VECTORIAL_MODE vm) throw(Inrimage::InvalidVectorialMode, Inrimage::NotEnoughMemory)
Changes image vectorial mode. A vectorial image buffer can be stored either interlaced (default) or non interlaced.
Throws:
InvalidVectorialMode attempt to set a scalar mode to a vectorial image or opposite
NotEnoughMemory unable to allocate temporary buffer to swap vectors
Parameters:
vm - new vectorial mode

GEOMETRY getGeometry(void) const
returns image geometry

void setGeometry(GEOMETRY g)
set image geometry

Interpolator const* getInterpolator() const
set interpolator object
Returns:
old interpolator object
Parameters:
i - new interpolator object

Extrapolator const* getExtrapolator() const
set extrapolator object
Returns:
old extrapolator object
Parameters:
e - new extrapolator object

void setInterpolator(Interpolator* i)
set interpolator object
Returns:
old interpolator object
Parameters:
i - new interpolator object

void setExtrapolator(Extrapolator* e)
set extrapolator object
Returns:
old extrapolator object
Parameters:
e - new extrapolator object

ImageGeometry* newConverter(void) const
creates an image coordinates converter for this image geometry
Returns:
image coordinates converter

Voxel* getRealVoxel(double x, double y, double z) const
Return image voxel at (x,y,z), using interpolation or extrapolation as appropriate
Returns:
s Voxel representing given image voxel
Parameters:
x - X voxel coordinate
y - Y voxel coordinate
z - Z voxel coordinate

Voxel& getRealVoxel(double x, double y, double z, Voxel& v) const
Stores voxel (x, y, z) value in v, using interpolation or extrapolation as appropriate
Parameters:
x - X voxel coordinate
y - Y voxel coordinate
z - Z voxel coordinate
v - voxel to store value

Voxel* getVoxel(unsigned int x, unsigned int y, unsigned int z) const
returns a Voxel representing given image voxel
Parameters:
x - X voxel coordinate
y - Y voxel coordinate
z - Z voxel coordinate

Voxel& getVoxel(unsigned int x, unsigned int y, unsigned int z, Voxel& v) const
stores voxel (x, y, z) value in v
Parameters:
x - X voxel coordinate
y - Y voxel coordinate
z - Z voxel coordinate
v - voxel to store value

void setVoxel(unsigned int x, unsigned int y, unsigned int z, const Voxel& v)
set given image voxel with transmitted voxel value
Parameters:
x - X voxel coordinate
y - Y voxel coordinate
z - Z voxel coordinate
v - voxel value

Voxel* checkVoxel(unsigned int x, unsigned int y, unsigned int z) const
Returns a Voxel representing given image voxel. Check that given coordinates do not exceed image size.
Parameters:
x - X voxel coordinate
y - Y voxel coordinate
z - Z voxel coordinate

void line(int x1, int y1, int x2, int y2, unsigned int z, const Voxel& v)
draw a 2D discrete line in given image plane
Parameters:
x1 - first pixel X coordinate
y1 - first pixel Y coordinate
x2 - last pixel X coordinate
y2 - last pixel Y coordinate
z - image plane
v - line voxels value

virtual void setWords(WORD_KIND wordKind = WK_FIXED, SIGN sign = SGN_SIGNED) throw(Inrimage::NotEnoughMemory)
Changes image word type. If image data buffer existed it is fried and reallocated.
Throws:
NotEnoughMemory unable to allocate image buffer
Parameters:
wordKind - image word kind
sign - image word sign

bool in(unsigned int row, unsigned int col, unsigned int plane)
indicates wether voxel lies in image bounds
Parameters:
row - voxel row (Y)
col - voxel column (X)
plane - voxel plane (Z)

bool sameSize(Inrimage const& inr) const
indicates wether inr has same size than this
Parameters:
inr - image to compare

void crop(unsigned int x1, unsigned int y1, unsigned int z1, unsigned int x2, unsigned int y2, unsigned int z2) throw(Inrimage::InvalidArguments)
crops region between (x1, y1, z1) and (x2, y2, z2) in inrimage Crop expects x1 < x2, y1 < y2 and z1 < z2
Throws:
InvalidArgument x1 >= x2 or y1 >= y2 or z1 >= z2 or x2 >= xdim or y2 >= ydim or z2 >= zdim
Parameters:
x1 - first crop box corner X coordinate
y1 - first crop box corner Y coordinate
z1 - first crop box corner Z coordinate
x2 - second crop box corner X coordinate (x1 should be < x2)
y2 - secont crop box corner Y coordinate (y1 should be < y2)
z2 - second crop box corner Z coordinate (z1 should be < z2)

void isolateRegion(unsigned int x1, unsigned int y1, unsigned int z1, unsigned int x2, unsigned int y2, unsigned int z2) throw(Inrimage::InvalidArguments)
put to 0 all voxels outside region between (x1, y1, z1) and (x2, y2, z2) in inrimage it expects x1 < x2, y1 < y2 and z1 < z2
Throws:
InvalidArgument x1 >= x2 or y1 >= y2 or z1 >= z2 or x2 >= xdim or y2 >= ydim or z2 >= zdim
Parameters:
x1 - first crop box corner X coordinate
y1 - first crop box corner Y coordinate
z1 - first crop box corner Z coordinate
x2 - second crop box corner X coordinate (x1 should be < x2)
y2 - secont crop box corner Y coordinate (y1 should be < y2)
z2 - second crop box corner Z coordinate (z1 should be < z2)

void zeroRegion(unsigned int x1, unsigned int y1, unsigned int z1, unsigned int x2, unsigned int y2, unsigned int z2) throw(Inrimage::InvalidArguments)
put to 0 all voxels inside region between (x1, y1, z1) and (x2, y2, z2) in inrimage it expects x1 < x2, y1 < y2 and z1 < z2
Throws:
InvalidArgument x1 >= x2 or y1 >= y2 or z1 >= z2 or x2 >= xdim or y2 >= ydim or z2 >= zdim
Parameters:
x1 - first crop box corner X coordinate
y1 - first crop box corner Y coordinate
z1 - first crop box corner Z coordinate
x2 - second crop box corner X coordinate (x1 should be < x2)
y2 - secont crop box corner Y coordinate (y1 should be < y2)
z2 - second crop box corner Z coordinate (z1 should be < z2)

void getBounds(Voxel *min, Voxel *max, bool vectorNorm = true) const
compute inrimage grey level bounds
Parameters:
min - min GL voxel value (min should have been allocated with inrimage dynamic type)
max - max GL voxel value (max should have been allocated with inrimage dynamic type)
vectorNorm - if true, this method returns min and max vector norm for vectorial inrimages, otherwise it returns min and max vector component

void setBounds(Voxel *min, Voxel *max, int z = -1)
Set inrimage grey level bounds (rescales GL window). If z is >= 0, only one slice is set, otherwise the wall image buffer is set.
Parameters:
min - min GL value (min should have been allocated with inrimage dynamic type)
max - max GL value (max should have been allocated with inrimage dynamic type)
z - (if >= 0) slice number to modify

static bool vectorial(WORD_TYPE)
returns true if type is WT_FLOAT_VECTOR, WT_DOUBLE_VECTOR, WT_RGB or WT_RGBA, false otherwise

static bool floating(WORD_TYPE)
returns true if type is WT_FLOAT, WT_DOUBLE, WT_FLOAT_VECTOR or WT_DOUBLE_VECTOR, false otherwise

Inrimage** splitVectors(void) const
Split a vectorial inrimage in one inrimage per component. The inrimage array returned is a WT_FLOAT inrimages array if input image is WT_FLOAT_VECTOR, a WT_DOUBLE inrimages array if input is WT_DOUBLE_VECTOR, and WT_UNSIGNED_CHAR if input image is WT_RGB or WT_RGBA. Non vectorial inrimages lead to a copy. Input image is not modified
Returns:
inrimage array (one inrimage per vectorial dimension

void setComponentsFrom(Inrimage **inrs) throw(Inrimage::InvalidSize, InvalidArguments)
Set vectorial components from an array of scalar inrimages
Throws:
InvalidSize one of the inrimages size does not match this size
InvalidArguments one of the inrimages is vectorial
Parameters:
inrs - inrimages array (there should be one inrimage per vectorial dimension of this)

void flip(SLICE_ORIENTATION geom)
flip an inrimage in given direction
Parameters:
geom - flip axis

void switchGeometry(SLICE_ORIENTATION geom1, SLICE_ORIENTATION geom2)
switch two inrimage dimensions
Parameters:
geom1 - first dimension to switch
geom2 - second dimension to switch

void mel(const Inrimage *inr, int xdest, int ydest, int zdest, int xorg, int yorg, int zorg, unsigned int dx, unsigned int dy, unsigned int dz) throw(Inrimage::InvalidArguments)
mel given inrimage with this by substituing a box from this with a box from inr
Throws:
InvalidArguments inr type does not match this type or xorg > inr->xdim or yorg > inr->ydim or zorg > inr->zdim or xdest > xdim or ydest > ydim or zdest > zdim
Parameters:
inr - inrimage to mel with this
xdest - X coordinate of destination box
ydest - Y coordinate of destination box
zdest - Z coordinate of destination box
xorg - X coordinate of source box
yorg - Y coordinate of source box
zorg - Z coordinate of source box
dx - X size of box to mel
dy - Y size of box to mel
dz - Z size of box to mel

GenericHistogram* createHistogram() const
creates and return the Histogram of this image

enum Noise
noise kinds

WHITE_NOISE
white Gaussian noise

GAUSSIAN_NOISE
Gaussian noise on image

US_NOISE
ultrasond-like

void noise(unsigned int x1, unsigned int y1, unsigned int z1, unsigned int x2, unsigned int y2, unsigned int z2, Noise kind, double mean, double dev) throw(Inrimage::InvalidArguments )
creates a noisy cube inside this inrimage
Throws:
InvalidArguments given box exceeds image size
Parameters:
x1 - first noisy box corner X coordinate
y1 - first noisy box corner Y coordinate
z1 - first noisy box corner Z coordinate
x2 - second noisy box corner X coordinate
y2 - second noisy box corner Y coordinate
z2 - second noisy box corner Z coordinate
kind - noise kind
mean - noise value (if fromImage == false)
dev - mean dev value

void convertCast(WORD_TYPE type)
converts inrimage to any type
Parameters:
type - new inrimage type

void convertScale(WORD_TYPE type)
converts inrimage to any type, resizing grey-levels
Parameters:
type - new inrimage type

void eval(char *func, int nmbr, Var_list *op) throw(Inrimage::InvalidArguments)
Evaluates expression in function string. Supports the following arithmetic operators in the following order: ^(power),/(division) or *(multiplication) and +(addition) or -(subtraction) Operators with the same priority are processed from left to right. All other operators have lowest priority and therefor processed from left to right as well. Special operators: |<(minimum), |>(maximum) Logical Operators(returns 1=true,0=false): <=(Smaller or equal), >=(Larger or equal), ==(equal), >(larger), <(smaller), &&(and), ||(or). Standard functions (angles are in radians): abs(), exp(), ceil()(rounds upwards), floor()(rounds downwards), log(), sqrt(), sin(), cos(), tan(), asin(), acos(), atan(), sinh(), cosh(), tanh(). Global functions (returns a scalar and calculates value based on the expression given as input to the function)): mean, min(minimum value), max(maximum value), m ed(median), std(estimated standard deviation), var(estimated variance). Variables: x,y,z (pixel positions), inrX(X can be any number of a valid image). Examples: inr3 -eval inr1|

static Vec3 * createDirectionArray(int frequency = DEFAULT_SPHERE_FREQUENCY)
Creates a vector array corresponding to the position of unit vector on a spherical dome of frequency "frequency". The size of the array is 20 * frequency *frequency
Parameters:
frequency - sphere tesselation level

void underSample(unsigned int sx = 2, unsigned int sy = 2, unsigned int sz = 1)
Undersamples image by an integer coefficient. Only scalar and interlaced vectorial images are handled.
Parameters:
sx - X sampling step (1 or more)
sy - Y sampling step (1 or more)
sz - Z sampling step (1 or more)

void overSample(unsigned int sx, unsigned int sy, unsigned int sz) throw(Inrimage::InvalidSize)
Oversample an image. New image should be greater than original image or an exception is thrown.
Throws:
InvalidSize (sx < xdim) || (sy < ydim) || (sz < zdim)
Parameters:
sx - new image X dimension
sy - new image Y dimension
sz - new image Z dimension

void resample(unsigned int sx, unsigned int sy, unsigned int sz)
Resamples an image to given image size. Undersampling is approximated by picking on trilinearly interpolated grey-level value in the image (i.e. no image averaging is computed).
Parameters:
sx - new image X dimension
sy - new image Y dimension
sz - new image Z dimension

void setRegion(int x1, int y1, int z1, int x2, int y2, int z2)
set region in which operations are performed. not used by all operations. negative values mean lower or higher bound, as appropriate.
Parameters:
x1 - lower box x coordinate
y1 - lower box y coordinate
z1 - lower box z coordinate
x2 - higher box x coordinate
y2 - higher box y coordinate
z2 - higher box z coordinate

void getRegion(int& x1, int& y1, int& z1, int& x2, int& y2, int& z2)
get region in which operations are performed
Parameters:
x1 - lower box x coordinate
y1 - lower box y coordinate
z1 - lower box z coordinate
x2 - higher box x coordinate
y2 - higher box y coordinate
z2 - higher box z coordinate

void getWorkRegion(unsigned int& x1, unsigned int& y1, unsigned int& z1, unsigned int& x2, unsigned int& y2, unsigned int& z2) const
get region [(x1,y1,z1),(x2,y2,z2)) in which operations are should be performed. Region returned is always valid, ie values >= 0 and < get[XYZ]().
Returns:
the old region in r
Parameters:
x1 -
y1 -
z1 -
x2 -
y2 -
z2 - the bounding box

void copyRegion(Inrimage const& img)
copy region from another image
Parameters:
img - the image to copy the region from. *

bool regionIsWholeImage() const
test if region is the whole image
Returns:
true if it is so, false otherwise *

TclString name
image file name

WORD_TYPE type
inrimage type

GEOMETRY geom
inrimage geometry

Interpolator const* interpolator
interpolator object used for image values at real coordinates inside the image.

void**** fourD
3D array on each image voxel -> array[z][y][x]

4D array on each vector component when vectors are not interlaced -> varray[v][z][y][x]

Extrapolator const* extrapolator
extrapolator object used for image values at real coordinates outside the image.

float region[6]
region in which operations are performed, in world coordinates. not used by all operations.

void setType(void) throw(Inrimage::UnknownType)
set initial image type
Parameters:
UnknownType - unsuported inrimage type

void index3D(void) throw(Inrimage::NotEnoughMemory)
builds 3D index (array buffer, standard inrimage)
Parameters:
NotEnoughMemory - unable to allocate memory to store index

void index4D(void) throw(Inrimage::NotEnoughMemory)
builds 4D index (varray buffer, non-interlaced vectorial inrimage)
Parameters:
NotEnoughMemory - unable to allocate memory to store index

void buildIndex() throw(Inrimage::NotEnoughMemory)
builds 3D or 4D index depending on vectorial mode
Parameters:
NotEnoughMemory - unable to allocate memory to store index

void deleteArray(void)
deletes array buffer

void queryGeometry(void)
set image geometry field looking at inrimage header tags

void convertFromRGBToRGBABuffer(void)
buffer convertion routine

void convertFromRGBAToRGBBuffer(void)
buffer convertion routine

friend class TclInrimage
buffer convertion routine


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de