Lynkeos
Instance Methods | Class Methods | Public Attributes | Protected Attributes | Related Functions | List of all members
LynkeosStandardImageBuffer Class Reference

Class used for floating precision images. More...

#import <LynkeosStandardImageBuffer.h>

Inheritance diagram for LynkeosStandardImageBuffer:
Inheritance graph
[legend]
Collaboration diagram for LynkeosStandardImageBuffer:
Collaboration graph
[legend]

Instance Methods

(id) - initWithNumberOfPlanes:width:height:
 Allocates a new empty buffer. More...
 
(id) - initWithData:copy:freeWhenDone:numberOfPlanes:width:paddedWidth:height:
 Initialize a new buffer with preexisting data. More...
 
(void) - setOperatorsStrategy:
 Change the strategy of arithmetic operators. More...
 
(void) - resetMinMax
 Reset the min and max to unset values.
 
(void) - getMinLevel:maxLevel:
 Get the minimum and maximum pixels value. More...
 
(void) - getMinLevel:maxLevel:forPlane:
 Get the minimum and maximum pixels value for a given plane. More...
 
(void *const *const) - colorPlanes
 Access to the color planes. More...
 
(void) - extractSample:atX:Y:withWidth:height:withPlanes:lineWidth:
 Extract a rectangle in the image.
 
(void) - substract:
 Substract an image from another. More...
 
(void) - add:withOffsets:withExpansion:
 Shifts another image and add it to this one. More...
 
(void) - multiplyWith:result:
 Multiplication. More...
 
(void) - substractBias:andScale:
 Substract and multiply with scalars. More...
 
(void) - multiplyWithScalar:
 Multiplication with a scalar. More...
 
(void) - divideBy:result:
 Division. More...
 
- Instance Methods inherited from <LynkeosImageBuffer>
(size_t) - memorySize
 The memory size occupied by this item. More...
 
(u_short) - width
 Get the image pixels width. More...
 
(u_short) - height
 Get the image pixels height. More...
 
(u_short) - numberOfPlanes
 Get the number of color planes. More...
 
(NSBitmapImageRep *) - getNSImageWithBlack:white:gamma:
 Retrieve a Cocoa 24 bits RGB bitmap representation. More...
 
(void) - add:
 Add another image buffer. More...
 
(void) - calibrateWithDarkFrame:flatField:atX:Y:
 Calibrate the image with the calibration images. More...
 
(void) - normalizeWithFactor:mono:
 Multiplies all values with a scalar. More...
 
(void) - convertToPlanar:withPrecision:withPlanes:lineWidth:
 Convert the image buffer data to a floating precision planar representation. More...
 
(void) - clear
 Clear the image contents ; all samples are zeroes.
 

Class Methods

(LynkeosStandardImageBuffer *) + imageBufferWithNumberOfPlanes:width:height:
 Convenience empty image buffer creator. More...
 
(LynkeosStandardImageBuffer *) + imageBufferWithData:copy:freeWhenDone:numberOfPlanes:width:paddedWidth:height:
 Convenience initialized image buffer creator. More...
 

Public Attributes

u_short _nPlanes
 Number of color planes.
 
u_short _w
 Image pixels width.
 
u_short _h
 Image pixels width.
 
u_short _padw
 Padded line width (>= width)
 
void * _data
 Pixel buffer, the planes are consecutive.
 

Protected Attributes

void * _planes [3]
 Shortcuts to the color planes.
 
BOOL _freeWhenDone
 Whether to free the planes on dealloc.
 
double _min [4]
 The image minimum value.
 
double _max [4]
 The image maximum value.
 
ImageProcessOneLine_t _mul_one_image_line
 Strategy method for multiplying a line, with vectorization, or not.
 
ImageProcessOneLine_t _scale_one_image_line
 Strategy method for scaling a line, with vectorization, or not.
 
ImageProcessOneLine_t _div_one_image_line
 Strategy method for dividing a line, with vectorization, or not.
 
ImageProcessOneLine_t _bias_scale_one_image_line
 Strategy method for substract and multiply, with vectorization, or not.
 
SEL _process_image_selector
 Strategy method for processing an image, actually for debug.
 
void(* _process_image )(id, SEL, ArithmeticOperand_t *, LynkeosStandardImageBuffer *res, ImageProcessOneLine_t)
 Strategy method for processing an image, func pointer which is called.
 

Related Functions

(Note that these are not member functions.)

#define stdColorValue(buf, prec, x, y, c)
 Access to one color component of a pixel. More...
 

Detailed Description

Class used for floating precision images.

For optimization purposes, the methods for accessing pixels value are implemented as macros

Method Documentation

- (void) add: (LynkeosStandardImageBuffer*)  image
withOffsets: (const NSPoint*)  offsets
withExpansion: (u_short)  expand 

Shifts another image and add it to this one.

Parameters
imageThe other image to add
offsetsAn array of offsets (one per plane) expressed in the coordinate system of "image".
expandThe pixel expansion of the resulting image

Only images of the same size can be added (so far). The offsets array is required to have as many elements as image has planes.

References _data, _h, _nPlanes, _padw, _planes, _w, imageBufferWithData:copy:freeWhenDone:numberOfPlanes:width:paddedWidth:height:, and resetMinMax.

Referenced by MyChromaticAlignerView(Private)::applyOffsetsTo:.

- (void *const *const) colorPlanes

Access to the color planes.

Returns
An array of pointer to the color planes

References _planes.

Referenced by MyChromaticAlignerView::automaticOffsets:.

- (void) divideBy: (LynkeosStandardImageBuffer*)  denom
result: (LynkeosStandardImageBuffer*)  result 

Division.

term shall either have the same number of planes as the receiver or only one plane. In the latter case, the plane is applied to each planes of the receiver.

Parameters
denomDenominator of the division
resultwhere the result is stored, can be one of the terms

References _div_one_image_line, _h, _nPlanes, _process_image, _process_image_selector, _w, resetMinMax, and ArithmeticOperand_t::term.

- (void) getMinLevel: (double*)  vmin
maxLevel: (double*)  vmax 

Get the minimum and maximum pixels value.

Parameters
[out]vminMinimum pixel value
[out]vmaxMaximum pixel value

References _h, _max, _min, _nPlanes, _w, and colorValue.

Referenced by filterImageForAnalysis(), and getMinLevel:maxLevel:forPlane:.

- (void) getMinLevel: (double*)  vmin
maxLevel: (double*)  vmax
forPlane: (u_short)  plane 

Get the minimum and maximum pixels value for a given plane.

Parameters
[out]vminMinimum pixel value
[out]vmaxMaximum pixel value
planehe plane for which min and max will be returned

References _max, _min, and getMinLevel:maxLevel:.

+ (LynkeosStandardImageBuffer *) imageBufferWithData: (void*)  data
copy: (BOOL)  copy
freeWhenDone: (BOOL)  freeWhenDone
numberOfPlanes: (u_short)  nPlanes
width: (u_short)  w
paddedWidth: (u_short)  padw
height: (u_short)  h 

Convenience initialized image buffer creator.

Parameters
dataImage data
copyWether to copy the data
freeWhenDoneWhether to free the planes on dealloc (relevant only when copy is NO)
nPlanesNumber of color planes for this image
wImage pixels width
padwPadded width of the data
hImage pixels height
Returns
The allocated and initialized LynkeosStandardImageBuffer.

References <LynkeosImageBuffer>::height, <LynkeosImageBuffer>::numberOfPlanes, and <LynkeosImageBuffer>::width.

Referenced by add:withOffsets:withExpansion:, and MyChromaticAlignerView::automaticOffsets:.

+ (LynkeosStandardImageBuffer *) imageBufferWithNumberOfPlanes: (u_short)  nPlanes
width: (u_short)  w
height: (u_short)  h 

Convenience empty image buffer creator.

Parameters
nPlanesNumber of color planes for this image
wImage pixels width
hImage pixels height
Returns
The allocated and initialized LynkeosStandardImageBuffer.

References <LynkeosImageBuffer>::height, and <LynkeosImageBuffer>::width.

Referenced by MyChromaticAlignerView(Private)::applyOffsetsTo:.

- (id) initWithData: (void*)  data
copy: (BOOL)  copy
freeWhenDone: (BOOL)  freeWhenDone
numberOfPlanes: (u_short)  nPlanes
width: (u_short)  w
paddedWidth: (u_short)  padw
height: (u_short)  h 

Initialize a new buffer with preexisting data.

Parameters
dataImage data
copyWhether to copy the data
freeWhenDoneWhether to free the planes on dealloc (relevant only when copy is NO)
nPlanesNumber of color planes for this image
wImage pixels width
padwPadded width of the data
hImage pixels height
Returns
The initialized buffer.

References _data, _freeWhenDone, _h, _mul_one_image_line, _nPlanes, _padw, _planes, _scale_one_image_line, and _w.

- (id) initWithNumberOfPlanes: (u_short)  nPlanes
width: (u_short)  w
height: (u_short)  h 

Allocates a new empty buffer.

Parameters
nPlanesNumber of color planes for this image
wImage pixels width
hImage pixels height
Returns
The initialized buffer.

References <LynkeosImageBuffer>::height, <LynkeosImageBuffer>::numberOfPlanes, and <LynkeosImageBuffer>::width.

- (void) multiplyWith: (LynkeosStandardImageBuffer*)  term
result: (LynkeosStandardImageBuffer*)  result 

Multiplication.

Term shall either have the same number of planes as the receiver or only one plane. In the latter case, the plane is applied to each planes of the receiver.

Parameters
termother term
resultwhere the result is stored, can be one of the terms.

References _h, _mul_one_image_line, _nPlanes, _process_image, _process_image_selector, _w, resetMinMax, and ArithmeticOperand_t::term.

Referenced by filterImageForAnalysis().

- (void) multiplyWithScalar: (double)  scalar

Multiplication with a scalar.

Parameters
scalarThe scalar by wich all pixels are multiplied

References _process_image, _process_image_selector, _scale_one_image_line, ArithmeticOperand_t::dscalar, and resetMinMax.

- (void) setOperatorsStrategy: (ImageOperatorsStrategy_t strategy

Change the strategy of arithmetic operators.

The images are always created with the standard strategy (no parallelization).

Parameters
strategyThe new strategy

References _process_image, _process_image_selector, ParallelizedStrategy, and StandardStrategy.

- (void) substract: (LynkeosStandardImageBuffer*)  image

Substract an image from another.

Parameters
imageThe other image to substract

References _h, _nPlanes, _w, and colorValue.

- (void) substractBias: (double)  bias
andScale: (double)  scale 

Substract and multiply with scalars.

Parameters
biasThe bias to substract
scaleThe scalar by which all pixels are multiplied

References _bias_scale_one_image_line, _process_image, _process_image_selector, ArithmeticOperand_t::dscalar, and resetMinMax.

Referenced by filterImageForAnalysis().

Friends And Related Function Documentation

- (#define) stdColorValue (   buf,
  prec,
  x,
  y,
 
)
related
Value:
(prec==SINGLE_PRECISION ? \
(((float*)(buf)->_data)[((y)+(c)*(buf)->_h)*(buf)->_padw+(x)]) : \
(((double*)(buf)->_data)[((y)+(c)*(buf)->_h)*(buf)->_padw+(x)]) )

Access to one color component of a pixel.

This method is implemented as a macro for speed purpose

Parameters
bufAn instance of LynkeosStandardImageBuffer
precThe precision in which we are working
xPixel's x coordinate
yPixel's y coordinate
cColor plane
Returns
The access for this pixel (it can be used as an lvalue)

The documentation for this class was generated from the following files: