Skip to content
Snippets Groups Projects
Commit 79d0105c authored by valerio's avatar valerio
Browse files

Work on img docs

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2407 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent d3818c2d
No related branches found
No related tags found
No related merge requests found
...@@ -85,20 +85,23 @@ Every 2D or 3D image in OpenStructure has some basic properties, which are discu ...@@ -85,20 +85,23 @@ Every 2D or 3D image in OpenStructure has some basic properties, which are discu
Point Point
^^^^^^^^ ^^^^^^^^
This class represents an image pixel. It is defined using three integer numbers, corresponding to the pixel’s indexes along the weight and depth dimensions respectively. For 2-dimensional images, the 3rd index can be omitted. .. class:: Point(x=0, y=0, z=0)
Point(x=0, y=0)
This class represents an image pixel. It is defined using three integer numbers, corresponding to the pixel’s indexes along the weight and depth dimensions respectively.
For 2-dimensional images, the 3rd index can be omitted.
.. class:: ost.img.Point(x=0, y=0, z=0)¶
.. class:: ost.img.Point(x=0, y=0)
Size Size
^^^^^^^^ ^^^^^^^^
This property describes the size of an image. It is defined using three integer numbers: When depth is not specified, the size is assumed to refer to a 2D image two-dimensional (depth=1). .. class:: Size(width, height, depth)
Size(width, height)
.. class:: ost.img.Size(width, height, depth)¶ This property describes the size of an image. It is defined using three integer numbers: When depth is not specified, the size is assumed to refer to a 2D image
.. class:: ost.img.Size(width, height) two-dimensional (depth=1).
The Size class can be passed to the CreateImage function to define the size of the image being created. The Size class can be passed to the CreateImage function to define the size of the image being created.
.. code-block:: python .. code-block:: python
...@@ -111,15 +114,15 @@ The Size class can be passed to the CreateImage function to define the size of t ...@@ -111,15 +114,15 @@ The Size class can be passed to the CreateImage function to define the size of t
Extent Extent
^^^^^^^^ ^^^^^^^^
This property describes the extent of an image in pixels. The image extent is a rectangle in 2d and a cuboid in 3d, and can be defined in a number of ways: giving the first and the last point of the extent, specifying the first point and the size of the extent, or listing the size of the extent and its central point. .. class:: Extent(first and last point)
Extent(first point, size)
Extent(size, central point)
.. code-block:: python This property describes the extent of an image in pixels. The image extent is a rectangle in 2d and a cuboid in 3d, and can be defined in a number of ways: giving the first
and the last point of the extent, specifying the first point and the size of the extent, or listing the size of the extent and its central point.
.. class:: ost.img.Extent(first and last point)¶
.. class:: ost.img.Extent(first point, size)
.. class:: ost.img.Extent(size, central point)
Some examples: Some examples:
.. code-block:: python .. code-block:: python
...@@ -130,7 +133,7 @@ Some examples: ...@@ -130,7 +133,7 @@ Some examples:
# again the same extent using its size and central pixel # again the same extent using its size and central pixel
s=img.Extent(img.Size(4,7),img.Point(3,7)) s=img.Extent(img.Size(4,7),img.Point(3,7))
The Extent class can be passed to the CreateImage function to create an image with a specific extent. The Extent class can be passed to the CreateImage function to create an image with a specific extent.
.. code-block:: python .. code-block:: python
...@@ -140,9 +143,9 @@ The Extent class can be passed to the CreateImage function to create an image wi ...@@ -140,9 +143,9 @@ The Extent class can be passed to the CreateImage function to create an image wi
# uses a temporary instance of the Extent class # uses a temporary instance of the Extent class
i=img.CreateImage(img.Extent(img.Point(2,4),img.Size(4,7))) i=img.CreateImage(img.Extent(img.Point(2,4),img.Size(4,7)))
Given an Extent, is it possible to recover its full size, and also the length of each of its dimensions separately. Given an Extent, is it possible to recover its full size, and also the length of each of its dimensions separately.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -153,7 +156,7 @@ Examples: ...@@ -153,7 +156,7 @@ Examples:
h=e.GetHeight() h=e.GetHeight()
d=e.GetDepth() d=e.GetDepth()
When one needs to visit all the image pixels belonging to an Extent in sequence, one can use an ExtentIterator: When one needs to visit all the image pixels belonging to an Extent in sequence, one can use an ExtentIterator:
.. code-block:: python .. code-block:: python
...@@ -169,15 +172,15 @@ When one needs to visit all the image pixels belonging to an Extent in sequence, ...@@ -169,15 +172,15 @@ When one needs to visit all the image pixels belonging to an Extent in sequence,
DataType DataType
^^^^^^^^ ^^^^^^^^
The DataType of an image represents the nature of the data it contains. An image can contain 'REAL' or 'COMPLEX' values. The DataType of an image represents the nature of the data it contains. An image can contain 'REAL' or 'COMPLEX' values.
.. _data-domain: .. _data-domain:
DataDomain DataDomain
^^^^^^^^^^ ^^^^^^^^^^
The DataDomain of an image specifies wether the image contains data in the 'SPATIAL' domain or in the 'FREQUENCY' domain. A 'HALF_FREQUENCY' domain also exists, The DataDomain of an image specifies wether the image contains data in the 'SPATIAL' domain or in the 'FREQUENCY' domain. A 'HALF_FREQUENCY' domain also exists,
representing centrosymmetric frequency data (such as the data coming from the Fourier transform of an image from the real spatial domain) representing centrosymmetric frequency data (such as the data coming from the Fourier transform of an image from the real spatial domain)
.. _spatial-origin: .. _spatial-origin:
...@@ -186,7 +189,8 @@ SpatialOrigin ...@@ -186,7 +189,8 @@ SpatialOrigin
Type: :class:`Point` Type: :class:`Point`
The Spatial Origin of an image is the first pixel of its extent. Specifically, this is the top left pixel for 2D images and the top-top-left for 3D images. The Spatial Origin of an image is the first pixel of its extent. Specifically, this is the top left pixel for 2D images
and the top-top-left for 3D images.
.. _absolute-origin: .. _absolute-origin:
...@@ -195,7 +199,8 @@ AbsoluteOrigin ...@@ -195,7 +199,8 @@ AbsoluteOrigin
Type: :class:`~ost.geom.Vec3` Type: :class:`~ost.geom.Vec3`
The Absolute Origin of an image describes the coordinates, in the absolute reference system used by OpenStructure, of the pixel in with all indexes equal to 0. Please notice that the pixel does not necessarily need to belong to the extent of the image. The Absolute Origin of an image describes the coordinates, in the absolute reference system used by OpenStructure, of the pixel in with all indexes equal to 0. Please notice
that the pixel does not necessarily need to belong to the extent of the image.
.. _pixel-sampling: .. _pixel-sampling:
...@@ -204,11 +209,8 @@ PixelSampling ...@@ -204,11 +209,8 @@ PixelSampling
Type: :class:`~ost.geom.Vec3` Type: :class:`~ost.geom.Vec3`
The PixelSampling property of an image describes the size of its pixels. For the same image, the size of pixels in the 'SPATIAL' and in the 'FREQUENCY' :ref:`data-domain` are obviously interdependent. OpenStructure takes care of the transformation and allows access to both pixel sampling irrespective of the current image domain. The PixelSampling property of an image describes the size of its pixels. For the same image, the size of pixels in the 'SPATIAL' and in the 'FREQUENCY' :ref:`data-domain` are
obviously interdependent. OpenStructure takes care of the transformation and allows access to both pixel sampling irrespective of the current image domain.
ImageHandle ImageHandle
----------- -----------
...@@ -224,7 +226,7 @@ ImageHandle class. ...@@ -224,7 +226,7 @@ ImageHandle class.
the modified image. See :doc:`../alg/alg` the modified image. See :doc:`../alg/alg`
:param algorithm: algorithm :param algorithm: algorithm
:type algorithm: Instance of an algorithm class (:doc:`../alg/alg`) :type algorithm: Instance of an algorithm class - See :doc:`../alg/alg`.
:rtype: :class:`ImageHandle` :rtype: :class:`ImageHandle`
.. method:: ApplyIP(algorithm) .. method:: ApplyIP(algorithm)
...@@ -233,7 +235,7 @@ ImageHandle class. ...@@ -233,7 +235,7 @@ ImageHandle class.
`:doc:`../alg/alg` `:doc:`../alg/alg`
:param algorithm: algorithm :param algorithm: algorithm
:type algorithm: Instance of an algorithm class (:doc:`../alg/alg`) :type algorithm: Instance of an algorithm class - See: doc:`../alg/alg`.
.. method:: CenterSpatialOrigin() .. method:: CenterSpatialOrigin()
...@@ -269,7 +271,7 @@ ImageHandle class. ...@@ -269,7 +271,7 @@ ImageHandle class.
extracted 'FREQUENCY' sub-image is centered around the origin and hence extracted 'FREQUENCY' sub-image is centered around the origin and hence
back-transformable to 'SPATIAL'. back-transformable to 'SPATIAL'.
:param extent: :param extent: Portion of the image to extract
:type extent: :class:`Extent` :type extent: :class:`Extent`
:rtype: :class:`ImageHandle` :rtype: :class:`ImageHandle`
...@@ -279,7 +281,7 @@ ImageHandle class. ...@@ -279,7 +281,7 @@ ImageHandle class.
accepting fractional numbers for pixel indexes. accepting fractional numbers for pixel indexes.
:param frac_pixel: Fractional pixel indexes :param frac_pixel: Fractional pixel indexes
:type frac_pixel: :class:`~ost.geomVec3` :type frac_pixel: :class:`~ost.geom.Vec3`
:rtype: :class:`~ost.geom.Vec3` :rtype: :class:`~ost.geom.Vec3`
.. method:: GetAbsoluteOrigin() .. method:: GetAbsoluteOrigin()
...@@ -293,7 +295,7 @@ ImageHandle class. ...@@ -293,7 +295,7 @@ ImageHandle class.
Returns the complex value of the specified image pixel. If the image holds data of the 'REAL' :ref:`data-type`, the method return s complex value with the pixel content Returns the complex value of the specified image pixel. If the image holds data of the 'REAL' :ref:`data-type`, the method return s complex value with the pixel content
as real part and a null imaginary part. as real part and a null imaginary part.
:param pixel: :param pixel: Image pixel
:type pixel: :class:`Point` :type pixel: :class:`Point`
:rtype: complex :rtype: complex
...@@ -307,7 +309,7 @@ ImageHandle class. ...@@ -307,7 +309,7 @@ ImageHandle class.
Returns the :class:`Extent` of an image. Returns the :class:`Extent` of an image.
:rtype: class:`Extent` :rtype: :class:`Extent`
.. method:: GetFrequencySampling() .. method:: GetFrequencySampling()
...@@ -345,8 +347,8 @@ ImageHandle class. ...@@ -345,8 +347,8 @@ ImageHandle class.
Returns the value of the specified image pixel. If the image holds data of the 'COMPLEX' :ref:`data-type`, the method return the amplitude of the pixel content. Returns the value of the specified image pixel. If the image holds data of the 'COMPLEX' :ref:`data-type`, the method return the amplitude of the pixel content.
:param arg2: :param pixel: Image pixel
:type arg2: :class:`Point` :type pixel: :class:`Point`
:rtype: float :rtype: float
.. method:: GetSize() .. method:: GetSize()
...@@ -366,7 +368,7 @@ ImageHandle class. ...@@ -366,7 +368,7 @@ ImageHandle class.
Return the :ref:`pixel-sampling` of the image in the 'SPATIAL' Return the :ref:`pixel-sampling` of the image in the 'SPATIAL'
:ref:`data-domain`. :ref:`data-domain`.
:rtype: :class:`~ost.geom.Vec3` :rtype: :class:`~ost.geom.Vec3`
.. method:: GetType() .. method:: GetType()
...@@ -382,9 +384,9 @@ ImageHandle class. ...@@ -382,9 +384,9 @@ ImageHandle class.
sub-pixel precision is needed, the method :meth:`FractionalIndexToCoord` sub-pixel precision is needed, the method :meth:`FractionalIndexToCoord`
can be used. can be used.
:param pixel: :param pixel:
:type pixel: :class:`Point` :type pixel: :class:`Point`
:rtype: :class:`~ost.geom.Vec3` :rtype: :class:`~ost.geom.Vec3`
.. method:: IsFrequency() .. method:: IsFrequency()
...@@ -405,7 +407,7 @@ ImageHandle class. ...@@ -405,7 +407,7 @@ ImageHandle class.
to call any method on the image handle other than `IsValid` when this to call any method on the image handle other than `IsValid` when this
method returns false. method returns false.
:rtype: bool :rtype: bool
.. method:: Paste(source_image) .. method:: Paste(source_image)
...@@ -416,14 +418,14 @@ ImageHandle class. ...@@ -416,14 +418,14 @@ ImageHandle class.
not exist in both are ignored. Please notice that this method only copies not exist in both are ignored. Please notice that this method only copies
the pixel content: all other properties of the image are left untouched. the pixel content: all other properties of the image are left untouched.
:param source_image: :param source_image: Source image that gets pasted into the current one
:type data: :class:`ImageHandle` :type source_image: :class:`ImageHandle`
.. method:: SetAbsoluteOrigin(coord) .. method:: SetAbsoluteOrigin(coord)
Sets the :ref:`absolute-origin` of the image to the specified coordinates Sets the :ref:`absolute-origin` of the image to the specified coordinates
:param coord: :param coord: Absolute coordinates
:type coord: :class:`~ost.geom.Vec3` :type coord: :class:`~ost.geom.Vec3`
.. method:: SetComplex(pixel, value) .. method:: SetComplex(pixel, value)
...@@ -433,33 +435,34 @@ ImageHandle class. ...@@ -433,33 +435,34 @@ ImageHandle class.
to the amplitude of the provided. to the amplitude of the provided.
value. value.
:param pixel: :param pixel: Image pixel
:type pixe;: Point :type pixel: :class:`Point`
:param value: :param value: Value
:type value: complex :type value: complex
.. method:: SetPixelSampling(sampling) .. method:: SetPixelSampling(sampling)
Sets the :ref:`pixel-sampling` of the image to the provided values in the current :ref:`data-domain`. Sets the :ref:`pixel-sampling` of the image to the provided values in the current :ref:`data-domain`.
:param sampling: :param sampling: Size of a pixel in x,y and z direction respectively
:type sampling: :class:`~ost.geom.Vec3` :type sampling: :class:`~ost.geom.Vec3`
.. method:: SetReal(pixel, value) .. method:: SetReal(pixel, value)
Sets the content of the specified pixel to the provided value. If the image holds data of the 'COMPLEX' :ref:`data-type`, the method sets the pixel to a value has a real Sets the content of the specified pixel to the provided value. If the image holds data of the 'COMPLEX'
part equal to the provided value and a null complex part. :ref:`data-type`, the method sets the pixel to a value has a real part equal to the provided value and a null
complex part.
:param pixel: :param pixel: Image pixel
:type pixel: :class:`Point` :type pixel: :class:`Point`
:param value: :param value: Value
:type value: float :type value: float
.. method:: SetSpatialOrigin(pixel_indexes) .. method:: SetSpatialOrigin(pixel_indexes)
Sets the :ref:`spatial-origin` of the image to the provided indexes. Sets the :ref:`spatial-origin` of the image to the provided indexes.
:param pixel_indexes: :param pixel_indexes: Indexes of the first pixel of the image
:type pixel_indexes: :class:`Point` :type pixel_indexes: :class:`Point`
:rtype: None :rtype: None
...@@ -467,7 +470,7 @@ ImageHandle class. ...@@ -467,7 +470,7 @@ ImageHandle class.
Sets the :ref:`pixel-sampling` if the image to the provided values in the spatial :ref:`data-domain` Sets the :ref:`pixel-sampling` if the image to the provided values in the spatial :ref:`data-domain`
:param sampl: :param sampl: Size of a pixel in x,y and z direction respectively
:type sampl: :class:`~ost.geom.Vec3` :type sampl: :class:`~ost.geom.Vec3`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment