Skip to content

Commit

Permalink
DOC: Update documentation files
Browse files Browse the repository at this point in the history
  • Loading branch information
andinet committed May 20, 2022
1 parent 4151f1b commit 9bb1dec
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 76 deletions.

Large diffs are not rendered by default.

23 changes: 15 additions & 8 deletions src/Bridge/NumPy/ConvertNumPyArrayToitkImage/Documentation.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
:name: ConvertNumPyArrayToitkImage

Interface ITK with NumPy Array
=============================
===============================

.. index::
single: Image
single: instantiate

Synopsis
--------

This example illustrates interfacing ITK Image data with NumPy array. While doing this, there are two key issues to
to keep in mind. One, the order of indexes is different between ITK image data class and NumPy array.
Second, there are two ways to access ITK image data as a NumPy array. i) Get direct access to memory with the data called
"View" functions (array_view_from_image and image_view_from_array), or ii) Copy the data (array_from_image and image_from_array).
If the view functions are used, the data can't be modified.
This example illustrates interfacing ITK Image data with NumPy array.
While doing this, there are two key issues to keep in mind. One, the order of
indexes is different between ITK image data class and NumPy array.
Second, there are two ways to access ITK image data as a NumPy array.
i) Get direct access to memory with the data called"View" functions, or
ii) Copy the data using array_from_image function. If the view functions are used,
the data can't be modified.

Results
-------
The size of the ITK image data read from the input file = itkSize2 ([221, 257])

NA
The size of the NumPy array viewed from itk::Image = (257, 221)
The size of the NumPy array copied from itk::Image = (257, 221)
ITK image data size after convesion from NumPy = itkSize2 ([221, 257])

ITK image data pixel value at [2,1] = 6
NumPy array pixel value at [2,1] = 8


Code
Expand Down
7 changes: 7 additions & 0 deletions src/Bridge/NumPy/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NumPy
======

.. toctree::
:maxdepth: 1

ConvertNumPyArrayToitkImage/Documentation.rst
1 change: 1 addition & 0 deletions src/Bridge/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Bridge
:maxdepth: 2

VtkGlue/index.rst
NumPy/index.rst

0 comments on commit 9bb1dec

Please sign in to comment.