Skip to content

Commit

Permalink
Fixed documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dmpelt committed Nov 25, 2013
1 parent ade1b2b commit 6cf2f28
Show file tree
Hide file tree
Showing 58 changed files with 8,374 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build/
dist/
docSRC/_build/
docSRC/_build/doctrees

*.c
*.cpp
Expand Down
8 changes: 8 additions & 0 deletions astra/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ def add_noise_to_sino(sinogram_in, I0):
return sinogram_out

def geom_size(geom, dim=None):
"""Returns the size of a volume or sinogram, based on the projection or volume geometry.
:param geom: Geometry to calculate size from
:type geometry: :class:`dict`
:param dim: Optional axis index to return
:type dim: :class:`int`
"""

if 'GridSliceCount' in geom:
# 3D Volume geometry?
s = (geom['GridSliceCount'],geom['GridRowCount'], geom['GridColCount'])
Expand Down
4 changes: 4 additions & 0 deletions docSRC/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: e394042b7a9410f685c0cc28e3fcd28e
tags: fbb0d17656682115ca4d033fb2f83ba1
224 changes: 224 additions & 0 deletions docSRC/_build/html/ASTRAProjector.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Helper class: the ASTRAProjector module &mdash; PyASTRAToolbox 1.0 documentation</title>

<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="PyASTRAToolbox 1.0 documentation" href="index.html" />
<link rel="next" title="MATLAB compatibility interface: the matlab module" href="matlab.html" />
<link rel="prev" title="Additional functions: the functions module" href="functions.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="matlab.html" title="MATLAB compatibility interface: the matlab module"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="functions.html" title="Additional functions: the functions module"
accesskey="P">previous</a> |</li>
<li><a href="index.html">PyASTRAToolbox 1.0 documentation</a> &raquo;</li>
</ul>
</div>

<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">

<div class="section" id="module-astra.ASTRAProjector">
<span id="helper-class-the-astraprojector-module"></span><h1>Helper class: the <tt class="xref py py-mod docutils literal"><span class="pre">ASTRAProjector</span></tt> module<a class="headerlink" href="#module-astra.ASTRAProjector" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="astra.ASTRAProjector.ASTRAProjector2D">
<em class="property">class </em><tt class="descclassname">astra.ASTRAProjector.</tt><tt class="descname">ASTRAProjector2D</tt><big>(</big><em>proj_geom</em>, <em>vol_geom</em>, <em>proj_type</em>, <em>useCUDA=False</em><big>)</big><a class="reference internal" href="_modules/astra/ASTRAProjector.html#ASTRAProjector2D"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astra.ASTRAProjector.ASTRAProjector2D" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Helps with various common ASTRA Toolbox 2D operations.</p>
<p>This class can perform several often used toolbox operations, such as:</p>
<ul class="simple">
<li>Forward projecting</li>
<li>Back projecting</li>
<li>Reconstructing</li>
</ul>
<p>Note that this class has a some computational overhead, because it
copies a lot of data. If you use many repeated operations, directly
using the PyAstraToolbox methods directly is faster.</p>
<p>You can use this class as an abstracted weight matrix <span class="math">\(W\)</span>: multiplying an instance
<tt class="docutils literal"><span class="pre">proj</span></tt> of this class by an image results in a forward projection of the image, and multiplying
<tt class="docutils literal"><span class="pre">proj.T</span></tt> by a sinogram results in a backprojection of the sinogram:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">proj</span> <span class="o">=</span> <span class="n">ASTRAProjector2D</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
<span class="n">fp</span> <span class="o">=</span> <span class="n">proj</span><span class="o">*</span><span class="n">image</span>
<span class="n">bp</span> <span class="o">=</span> <span class="n">proj</span><span class="o">.</span><span class="n">T</span><span class="o">*</span><span class="n">sinogram</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>proj_geom</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/stdtypes.html#dict" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></a>) &#8211; The projection geometry.</li>
<li><strong>vol_geom</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/stdtypes.html#dict" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></a>) &#8211; The volume geometry.</li>
<li><strong>proj_type</strong> (<tt class="xref py py-class docutils literal"><span class="pre">string</span></tt>) &#8211; Projector type, such as <tt class="docutils literal"><span class="pre">'line'</span></tt>, <tt class="docutils literal"><span class="pre">'linear'</span></tt>, ...</li>
<li><strong>useCUDA</strong> (<tt class="xref py py-class docutils literal"><span class="pre">bool</span></tt>) &#8211; If <tt class="docutils literal"><span class="pre">True</span></tt>, use CUDA for calculations, when possible.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="astra.ASTRAProjector.ASTRAProjector2D.backProject">
<tt class="descname">backProject</tt><big>(</big><em>data</em><big>)</big><a class="reference internal" href="_modules/astra/ASTRAProjector.html#ASTRAProjector2D.backProject"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astra.ASTRAProjector.ASTRAProjector2D.backProject" title="Permalink to this definition"></a></dt>
<dd><p>Backproject a sinogram.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<a class="reference external" href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.8)"><tt class="xref py py-class docutils literal"><span class="pre">numpy.ndarray</span></tt></a> or <tt class="xref py py-class docutils literal"><span class="pre">int</span></tt>) &#8211; The sinogram data or ID.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference external" href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.8)"><tt class="xref py py-class docutils literal"><span class="pre">numpy.ndarray</span></tt></a> &#8211; The backprojection.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="astra.ASTRAProjector.ASTRAProjector2D.forwardProject">
<tt class="descname">forwardProject</tt><big>(</big><em>data</em><big>)</big><a class="reference internal" href="_modules/astra/ASTRAProjector.html#ASTRAProjector2D.forwardProject"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astra.ASTRAProjector.ASTRAProjector2D.forwardProject" title="Permalink to this definition"></a></dt>
<dd><p>Forward project an image.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<a class="reference external" href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.8)"><tt class="xref py py-class docutils literal"><span class="pre">numpy.ndarray</span></tt></a> or <tt class="xref py py-class docutils literal"><span class="pre">int</span></tt>) &#8211; The image data or ID.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference external" href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.8)"><tt class="xref py py-class docutils literal"><span class="pre">numpy.ndarray</span></tt></a> &#8211; The forward projection.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="astra.ASTRAProjector.ASTRAProjector2D.reconstruct">
<tt class="descname">reconstruct</tt><big>(</big><em>data</em>, <em>method</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/astra/ASTRAProjector.html#ASTRAProjector2D.reconstruct"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astra.ASTRAProjector.ASTRAProjector2D.reconstruct" title="Permalink to this definition"></a></dt>
<dd><p>Reconstruct an image from a sinogram.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data</strong> (<a class="reference external" href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.8)"><tt class="xref py py-class docutils literal"><span class="pre">numpy.ndarray</span></tt></a> or <tt class="xref py py-class docutils literal"><span class="pre">int</span></tt>) &#8211; The sinogram data or ID.</li>
<li><strong>method</strong> (<tt class="xref py py-class docutils literal"><span class="pre">string</span></tt>) &#8211; Name of the reconstruction algorithm.</li>
<li><strong>kwargs</strong> &#8211; Additional named parameters to pass to <a class="reference internal" href="creators.html#astra.creators.create_reconstruction" title="astra.creators.create_reconstruction"><tt class="xref py py-func docutils literal"><span class="pre">astra.creators.create_reconstruction()</span></tt></a>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><a class="reference external" href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.8)"><tt class="xref py py-class docutils literal"><span class="pre">numpy.ndarray</span></tt></a> &#8211; The reconstruction.</p>
</td>
</tr>
</tbody>
</table>
<p>Example of a SIRT reconstruction using CUDA:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">proj</span> <span class="o">=</span> <span class="n">ASTRAProjector2D</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
<span class="n">rec</span> <span class="o">=</span> <span class="n">proj</span><span class="o">.</span><span class="n">reconstruct</span><span class="p">(</span><span class="n">sinogram</span><span class="p">,</span><span class="s">&#39;SIRT_CUDA&#39;</span><span class="p">,</span><span class="n">iterations</span><span class="o">=</span><span class="mi">1000</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="astra.ASTRAProjector.ASTRAProjector2DTranspose">
<em class="property">class </em><tt class="descclassname">astra.ASTRAProjector.</tt><tt class="descname">ASTRAProjector2DTranspose</tt><big>(</big><em>parentProj</em><big>)</big><a class="reference internal" href="_modules/astra/ASTRAProjector.html#ASTRAProjector2DTranspose"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astra.ASTRAProjector.ASTRAProjector2DTranspose" title="Permalink to this definition"></a></dt>
<dd><p>Implements the <tt class="docutils literal"><span class="pre">proj.T</span></tt> functionality.</p>
<p>Do not use directly, since it can be accessed as member <tt class="docutils literal"><span class="pre">.T</span></tt> of
an <a class="reference internal" href="#astra.ASTRAProjector.ASTRAProjector2D" title="astra.ASTRAProjector.ASTRAProjector2D"><tt class="xref py py-class docutils literal"><span class="pre">ASTRAProjector2D</span></tt></a> object.</p>
</dd></dl>

</div>


</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="functions.html"
title="previous chapter">Additional functions: the <tt class="docutils literal"><span class="pre">functions</span></tt> module</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="matlab.html"
title="next chapter">MATLAB compatibility interface: the <tt class="docutils literal"><span class="pre">matlab</span></tt> module</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/ASTRAProjector.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="matlab.html" title="MATLAB compatibility interface: the matlab module"
>next</a> |</li>
<li class="right" >
<a href="functions.html" title="Additional functions: the functions module"
>previous</a> |</li>
<li><a href="index.html">PyASTRAToolbox 1.0 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2013, Centrum Wiskunde &amp; Informatica, Amsterdam.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
Loading

0 comments on commit 6cf2f28

Please sign in to comment.