API reference - Class ImageNotation used in Ruby API documentation Description: An image to be stored as a layout annotation
Images can be put onto the layout canvas as annotations, along with rulers and markers. Images can be monochrome (represent scalar data) as well as color (represent color images). The display of images can be adjusted in various ways, i.e. color mapping (translation of scalar values to colors), geometrical transformations (including rotation by arbitrary angles) and similar. Images are always based on floating point data. The actual data range is not fixed and can be adjusted to the data set (i.e. 0..255 or -1..1). This gives a great flexibility when displaying data which is the result of some measurement or calculation for example. The basic parameters of an image are the width and height of the data set, the width and height of one pixel, the geometrical transformation to be applied, the data range (min_value to max_value) and the data mapping which is described by an own class, ImageDataMapping. Starting with version 0.22, the basic transformation is a 3x3 matrix rather than the simple affine transformation. This matrix includes the pixel dimensions as well. One consequence of that is that the magnification part of the matrix and the pixel dimensions are no longer separated. That has certain consequences, i.e. setting an affine transformation with a magnification scales the pixel sizes as before but an affine transformation returned will no longer contain the pixel dimensions as magnification because it only supports isotropic scaling. For backward compatibility, the rotation center for the affine transformations while the default center and the center for matrix transformations is the image center. Public constructors
Public methods
Deprecated methods (protected, public, static, non-static and constructors)
Detailed descriptionvoid _createDescription: Ensures the C++ object is created Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created. void _destroyDescription: Explicitly destroys the object Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing. [const] bool _destroyed?Description: Returns a value indicating whether the object was already destroyed This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself. [const] bool _is_const_object?Description: Returns a value indicating whether the reference is a const reference This method returns true, if self is a const reference. In that case, only const methods may be called on self. void _manageDescription: Marks the object as managed by the script side. After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required. Usually it's not required to call this method. It has been introduced in version 0.24. void _unmanageDescription: Marks the object as no longer owned by the script side. Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur. Usually it's not required to call this method. It has been introduced in version 0.24. void assign(const Image other)Description: Assigns another object to self [const] DBox boxDescription: Get the bounding box of the image
void createDescription: Ensures the C++ object is created Use of this method is deprecated. Use _create instead [const] ImageDataMapping data_mappingDescription: Get the data mapping
The data mapping describes the transformation of a pixel value (any double value) into pixel data which can be sent to the graphics cards for display. See ImageDataMapping for a more detailed description. Python specific notes:The object exposes a readable attribute 'data_mapping'. This is the getter. void data_mapping=(const ImageDataMapping data_mapping)Description: Set the data mapping object The data mapping describes the transformation of a pixel value (any double value) into pixel data which can be sent to the graphics cards for display. See ImageDataMapping for a more detailed description. Python specific notes:The object exposes a writable attribute 'data_mapping'. This is the setter. void destroyDescription: Explicitly destroys the object Use of this method is deprecated. Use _destroy instead [const] bool destroyed?Description: Returns a value indicating whether the object was already destroyed Use of this method is deprecated. Use _destroyed? instead [const] new Image ptr dupDescription: Creates a copy of self [const] string filenameDescription: Get the name of the file loaded of an empty string if not file is loaded
[const] double get_pixel(unsigned long x,unsigned long y)Description: Accessor to one pixel (monochrome and color)
If the component index, x or y value exceeds the image bounds, this method returns 0.0. For monochrome images, the component index is ignored. [const] double get_pixel(unsigned long x,unsigned long y,unsigned int component)Description: Accessor to one pixel (monochrome and color)
If the component index, x or y value exceeds the image bounds, this method returns 0.0. For monochrome images, the component index is ignored. [const] unsigned long heightDescription: Get the height of the image in pixels
[const] int idDescription: Get the Id The Id is an arbitrary integer that can be used to track the evolution of an image object. The Id is not changed when the object is edited. On initialization, a unique Id is given to the object. The Id cannot be changed. This behaviour has been modified in version 0.20. [const] bool is_color?Description: Returns true, if the image is a color image
[const] bool is_const_object?Description: Returns a value indicating whether the reference is a const reference Use of this method is deprecated. Use _is_const_object? instead [const] bool is_empty?Description: Returns true, if the image does not contain any data (i.e. is default constructed)
[const] bool is_visible?Description: Gets a flag indicating whether the image object is visible An image object can be made invisible by setting the visible property to false. This method has been introduced in version 0.20. [const] bool mask(unsigned long x,unsigned long y)Description: Gets the mask for one pixel
See set_mask for details about the mask. This method has been introduced in version 0.23. [const] Matrix3d matrixDescription: Return the pixel-to-micron transformation matrix This transformation matrix converts pixel coordinates (0,0 being the center and each pixel having the dimension of pixel_width and pixel_height) to micron coordinates. The coordinate of the pixel is the lower left corner of the pixel. The matrix is more general than the transformation used before and supports shear and perspective transformation. This property replaces the trans property which is still functional, but deprecated. This method has been introduced in version 0.22. Python specific notes:The object exposes a readable attribute 'matrix'. This is the getter. void matrix=(const Matrix3d t)Description: Set the transformation matrix This transformation matrix converts pixel coordinates (0,0 being the center and each pixel having the dimension of pixel_width and pixel_height) to micron coordinates. The coordinate of the pixel is the lower left corner of the pixel. The matrix is more general than the transformation used before and supports shear and perspective transformation. This property replaces the trans property which is still functional, but deprecated. This method has been introduced in version 0.22. Python specific notes:The object exposes a writable attribute 'matrix'. This is the setter. [const] double max_valueDescription: Set the maximum value See the max_value method for the description of the maximum value property. Python specific notes:The object exposes a readable attribute 'max_value'. This is the getter. void max_value=(double v)Description: Get the upper limit of the values in the data set This value determines the upper end of the data mapping (i.e. white value etc.). It does not necessarily correspond to the maximum value of the data set but it must be larger than that. Python specific notes:The object exposes a writable attribute 'max_value'. This is the setter. [const] double min_valueDescription: Get the upper limit of the values in the data set This value determines the upper end of the data mapping (i.e. white value etc.). It does not necessarily correspond to the minimum value of the data set but it must be larger than that. Python specific notes:The object exposes a readable attribute 'min_value'. This is the getter. void min_value=(double v)Description: Set the minimum value See min_value for the description of the minimum value property. Python specific notes:The object exposes a writable attribute 'min_value'. This is the setter. [static] new Image ptr newDescription: Create a new image with the default attributes This will create an empty image without data and no particular pixel width or related. Use the read_file or set_data methods to set image properties and pixel values. Python specific notes:This method is the default initializer of the object [static] new Image ptr new(string filename)Description: Constructor from a image file
This constructor creates an image object from a file (which can have any format supported by Qt) and a unit transformation. The image will originally be put to position 0,0 (lower left corner) and each pixel will have a size of 1 (micron). Python specific notes:This method is the default initializer of the object [static] new Image ptr new(string filename,const DCplxTrans trans)Description: Constructor from a image file
This constructor creates an image object from a file (which can have any format supported by Qt) and a transformation. The image will originally be put to position 0,0 (lower left corner) and each pixel will have a size of 1. The transformation describes how to transform this image into micron space. Python specific notes:This method is the default initializer of the object [static] new Image ptr new(unsigned long w,unsigned long h,double[] data)Description: Constructor for a monochrome image with the given pixel values
This constructor creates an image from the given pixel values. The values have to be organized line by line. Each line must consist of "w" values where the first value is the leftmost pixel. Note, that the rows are oriented in the mathematical sense (first one is the lowest) contrary to the common convention for image data. Initially the pixel width and heigt will be 1 micron and the data range will be 0 to 1.0 (black to white level). To adjust the data range use the min_value and max_value properties. Python specific notes:This method is the default initializer of the object [static] new Image ptr new(unsigned long w,unsigned long h,const DCplxTrans trans,double[] data)Description: Constructor for a monochrome image with the given pixel values
This constructor creates an image from the given pixel values. The values have to be organized line by line. Each line must consist of "w" values where the first value is the leftmost pixel. Note, that the rows are oriented in the mathematical sense (first one is the lowest) contrary to the common convention for image data. Initially the pixel width and heigt will be 1 micron and the data range will be 0 to 1.0 (black to white level). To adjust the data range use the min_value and max_value properties. Python specific notes:This method is the default initializer of the object [static] new Image ptr new(unsigned long w,unsigned long h,double[] red,double[] green,double[] blue)Description: Constructor for a color image with the given pixel values
This constructor creates an image from the given pixel values. The values have to be organized line by line and separated by color channel. Each line must consist of "w" values where the first value is the leftmost pixel. Note, that the rows are oriented in the mathematical sense (first one is the lowest) contrary to the common convention for image data. Initially the pixel width and heigt will be 1 micron and the data range will be 0 to 1.0 (black to white level). To adjust the data range use the min_value and max_value properties. Python specific notes:This method is the default initializer of the object [static] new Image ptr new(unsigned long w,unsigned long h,const DCplxTrans trans,double[] red,double[] green,double[] blue)Description: Constructor for a color image with the given pixel values
This constructor creates an image from the given pixel values. The values have to be organized line by line and separated by color channel. Each line must consist of "w" values where the first value is the leftmost pixel. Note, that the rows are oriented in the mathematical sense (first one is the lowest) contrary to the common convention for image data. Initially the pixel width and heigt will be 1 micron and the data range will be 0 to 1.0 (black to white level). To adjust the data range use the min_value and max_value properties. Python specific notes:This method is the default initializer of the object [const] double pixel_heightDescription: Get the pixel height See pixel_height= for a description of that property. Starting with version 0.22, this property is incorporated into the transformation matrix. This property is provided for convenience only. Python specific notes:The object exposes a readable attribute 'pixel_height'. This is the getter. void pixel_height=(double h)Description: Set the pixel height The pixel height determines the height of on pixel in the original space which is transformed to micron space with the transformation. Starting with version 0.22, this property is incorporated into the transformation matrix. This property is provided for convenience only. Python specific notes:The object exposes a writable attribute 'pixel_height'. This is the setter. [const] double pixel_widthDescription: Get the pixel width See pixel_width= for a description of that property. Starting with version 0.22, this property is incorporated into the transformation matrix. This property is provided for convenience only. Python specific notes:The object exposes a readable attribute 'pixel_width'. This is the getter. void pixel_width=(double w)Description: Set the pixel width The pixel width determines the width of on pixel in the original space which is transformed to micron space with the transformation. Starting with version 0.22, this property is incorporated into the transformation matrix. This property is provided for convenience only. Python specific notes:The object exposes a writable attribute 'pixel_width'. This is the setter. void set_data(unsigned long w,unsigned long h,double[] d)Description: Write the image data field (monochrome)
See the constructor description for the data organisation in that field. void set_data(unsigned long w,unsigned long h,double[] r,double[] g,double[] b)Description: Write the image data field (color)
See the constructor description for the data organisation in that field. void set_mask(unsigned long x,unsigned long y,bool m)Description: Set the mask for a pixel
If the mask of a pixel is set to false, the pixel is not drawn. The default is true for all pixels. This method has been introduced in version 0.23. void set_pixel(unsigned long x,unsigned long y,double v)Description: Set one pixel (monochrome)
If the component index, x or y value exceeds the image bounds of the image is a color image, this method does nothing. void set_pixel(unsigned long x,unsigned long y,double r,double g,double b)Description: Set one pixel (color)
If the component index, x or y value exceeds the image bounds of the image is not a color image, this method does nothing. [const] string to_sDescription: Conver the image to a string
Python specific notes:This method is also available as 'str(object)' [const] DCplxTrans transDescription: Return the pixel-to-micron transformation This transformation converts pixel coordinates (0,0 being the lower left corner and each pixel having the dimension of pixel_width and pixel_height) to micron coordinates. The coordinate of the pixel is the lower left corner of the pixel. The general property is matrix which also allows perspective and shear transformation. This property will only work, if the transformation does not include perspective or shear components. Therefore this property is deprecated. Please note that for backward compatibility, the rotation center is pixel 0,0 (lowest left one), while it is the image center for the matrix transformation. Python specific notes:The object exposes a readable attribute 'trans'. This is the getter. void trans=(const DCplxTrans t)Description: Set the transformation This transformation converts pixel coordinates (0,0 being the lower left corner and each pixel having the dimension of pixel_width and pixel_height) to micron coordinates. The coordinate of the pixel is the lower left corner of the pixel. The general property is matrix which also allows perspective and shear transformation. Please note that for backward compatibility, the rotation center is pixel 0,0 (lowest left one), while it is the image center for the matrix transformation. Python specific notes:The object exposes a writable attribute 'trans'. This is the setter. [const] Image transformed(const DTrans t)Description: Transform the image with the given simple transformation
[const] Image transformed(const Matrix3d t)Description: Transform the image with the given matrix transformation
This method has been introduced in version 0.22. [const] Image transformed(const DCplxTrans t)Description: Transform the image with the given complex transformation
[const] Image transformed_cplx(const DCplxTrans t)Description: Transform the image with the given complex transformation
[const] Image transformed_matrix(const Matrix3d t)Description: Transform the image with the given matrix transformation
This method has been introduced in version 0.22. void visible=(bool v)Description: Set the visibility See the is_visible? method for a description of this property. This method has been introduced in version 0.20. Python specific notes:The object exposes a writable attribute 'visible'. This is the setter. [const] unsigned long widthDescription: Get the width of the image in pixels
|