Skip to content

Commit e36c630

Browse files
committed
Update documentation
1 parent a6a20b8 commit e36c630

File tree

4 files changed

+99
-10
lines changed

4 files changed

+99
-10
lines changed

doc/api.rst

+72-5
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,13 @@ Functions of the plugin
8383
Colons are interpreted as TagGroup path separators. If invalid characters, e.g. "[" or "]", occur in the attribute name,
8484
the attributes are not read.
8585

86-
.. note::
87-
8886
DigitalMicrograph only supports 8 bit tag names, but it is undocumented how these tag names are
8987
encoded. The attribute names on the other side, might contain unicode characters. This function
90-
encodes the attribute name in UTF8 (See :ref:`string-encoding-label`
91-
92-
.. note::
88+
encodes the attribute name in UTF8 (See :ref:`string-encoding-label`)
9389

9490
Integer/float/complex arrays are read as lists of the scalar values. Multidimensional arrays are read as list of lists.
91+
92+
The sizes compared to the HDF5 file are reported in reversed order (see :ref:`data-spaces-label`).
9593

9694
.. cpp:function:: bool h5_exists_attr(string filename, string location, string attr)
9795

@@ -110,6 +108,75 @@ Functions of the plugin
110108

111109
Scalar dataspaces (rank 0) are returned as one dimensional image with one element.
112110

111+
.. cpp:function:: image h5_read_dataset_slice1(string filename, string location, TagGroup offset, number dim0, number count0, number stride0)
112+
113+
Reads 1D subset of dataset *location* from *filename*. This method can be used to read a one
114+
dimensional slice along an arbitrary dimension from a higher dimensional dataset.
115+
116+
*offset* is a TagList of numbers, where the index of the first element of the returned
117+
array for all dimensions of the dataset is given. The tag list must have a size corresponding
118+
to the number of dimensions.
119+
120+
*dim0* is the dimension along which the slice is returned, *count0* the number of elements
121+
in the slice. *stride0* the distance between adjacent elements in the returned slice (e.g. a
122+
*stride0* of 2 will return only every second element).
123+
124+
Only some data types are supported (see :ref:`data-types-label`). For order of
125+
dimensions see :ref:`data-spaces-label`. Strides must be > 0.
126+
127+
On failure an invalid image is returned.
128+
129+
.. cpp:function:: image h5_read_dataset_slice2(string filename, string location, TagGroup offset, number dim0, number count0, number stride0, number dim1, number count1, number stride1)
130+
131+
Reads 2D subset of dataset *location* from *filename*. This method can be used to read a two
132+
dimensional slice along an arbitrary dimension from a higher dimensional dataset.
133+
134+
*offset* is a TagList of numbers, where the index of the first element of the returned
135+
array for all dimensions of the dataset is given. The tag list must have a size corresponding
136+
to the number of dimensions.
137+
138+
*dim0* is the X-dimension along which the slice is returned, *count0* the number of elements
139+
in the slice. *stride0* the distance between adjacent elements in the returned slice (e.g. a
140+
*stride0* of 2 will return only every second element).
141+
142+
*dim1* is the Y-dimension along which the slice is returned, *count1* the number of elements
143+
in this direction. *stride1* the distance between adjacent elements.
144+
145+
Due to a limitation of the underlying HDF5 library the order of the dimensions must be
146+
increasing, i.e. *dim0* < *dim1*. Using this call to transpose the dataset is not possible.
147+
148+
Only some data types are supported (see :ref:`data-types-label`). For order of
149+
dimensions see :ref:`data-spaces-label`. Strides must be > 0.
150+
151+
On failure an invalid image is returned.
152+
153+
.. cpp:function:: image h5_read_dataset_slice3(string filename, string location, TagGroup offset, number dim0, number count0, number stride0, number dim1, number count1, number stride1, number dim2, number count2, number stride2)
154+
155+
Reads 3D subset of dataset *location* from *filename*. This method can be used to read a three
156+
dimensional slice along an arbitrary dimension from a higher dimensional dataset.
157+
158+
*offset* is a TagList of numbers, where the index of the first element of the returned
159+
array for all dimensions of the dataset is given. The tag list must have a size corresponding
160+
to the number of dimensions.
161+
162+
*dim0* is the X-dimension along which the slice is returned, *count0* the number of elements
163+
in the slice. *stride0* the distance between adjacent elements in the returned slice (e.g. a
164+
*stride0* of 2 will return only every second element).
165+
166+
*dim1* is the Y-dimension along which the slice is returned, *count1* the number of elements
167+
in this direction. *stride1* the distance between adjacent elements.
168+
169+
*dim2* is the Z-dimension along which the slice is returned, *count2* the number of elements
170+
in this direction. *stride2* the distance between adjacent elements.
171+
172+
Due to a limitation of the underlying HDF5 library the order of the dimensions must be
173+
increasing, i.e. *dim0* < *dim1* < *dim2*. Using this call to transpose the dataset is not possible.
174+
175+
Only some data types are supported (see :ref:`data-types-label`). For order of
176+
dimensions see :ref:`data-spaces-label`. Strides must be > 0.
177+
178+
On failure an invalid image is returned.
179+
113180
.. cpp:function:: string h5_read_string_dataset(string filename, string location)
114181

115182
Reads string dataset *location* from *filename*. This only works with datasets

doc/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
# built documents.
4949
#
5050
# The short X.Y version.
51-
version = '1.1.0'
51+
version = '1.2.0'
5252
# The full version, including alpha/beta/rc tags.
53-
release = '1.1.0'
53+
release = '1.2.0'
5454

5555
# The language for content autogenerated by Sphinx. Refer to documentation
5656
# for a list of supported languages.

doc/index.rst

-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,3 @@ Contents:
99
api
1010
remarks
1111
license
12-
13-
* :ref:`genindex`
14-

doc/remarks.rst

+25
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,31 @@ Data types
6464
|40 |Integer 8 Unsigned |HDF_NATIVE_UINT64 |Only supported in GMS versions >= 2.0 |
6565
+-------+-------------------+-------------------+-------------------------------------------+
6666

67+
.. _data-spaces-label:
68+
69+
Dataspaces
70+
----------
71+
72+
Multidimensional datasets in HDF5 files are stored in a column-major (a.k.a. C style) order.
73+
This means that items with successive indices in the last dimension are stored in adjacent
74+
file positions, while items with successive indices in the non-last dimensions are
75+
stored non-adjacently.
76+
77+
Digital Micrograph on the opposite has a row-major (a.k.a. Fortran style) order. Items with
78+
successive indices in the first dimension are stored in adjacent memory positions, while
79+
items with successive indices in the non-first dimensions are stored non-adjacently.
80+
81+
Typical 3D datasets are stored in a way, that adjacent items in X direction are stored adjacently,
82+
while adjacent items in Y direction are stored farer apart, and adjacent items in Z direction are
83+
stored even farer apart. For HDF5 storage such a dataset is indexed as ``[Z,Y,X]`` while for
84+
Digital Micrograph it is indexed as ``[X,Y,Z]``.
85+
86+
In order to adjust for this differences, the order of all indices is reversed by the
87+
plugin. The first dimension in a plugin call, always refers to the last dimension in the
88+
HDF5 dataset and vice-versa.
89+
90+
For more details on ordering see for instance the `Wikipedia article <https://en.wikipedia.org/wiki/Row-_and_column-major_order>`_.
91+
6792
.. _string-encoding-label:
6893

6994
String encoding and file names

0 commit comments

Comments
 (0)