Skip to content

Commit

Permalink
deploy: 5908efc
Browse files Browse the repository at this point in the history
  • Loading branch information
alisterburt committed Jun 13, 2024
1 parent ad338f3 commit 3de2a89
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 6 deletions.
175 changes: 171 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,57 @@
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#imodmodel" class="md-nav__link">
<span class="md-ellipsis">
ImodModel
</span>
</a>

<nav class="md-nav" aria-label="ImodModel">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#my_modelid" class="md-nav__link">
<span class="md-ellipsis">
my_model.id
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#my_modelheader" class="md-nav__link">
<span class="md-ellipsis">
my_model.header
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#my_modelobjects" class="md-nav__link">
<span class="md-ellipsis">
my_model.objects
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#my_modelslicer_angles" class="md-nav__link">
<span class="md-ellipsis">
my_model.slicer_angles
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -345,6 +396,57 @@
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#imodmodel" class="md-nav__link">
<span class="md-ellipsis">
ImodModel
</span>
</a>

<nav class="md-nav" aria-label="ImodModel">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#my_modelid" class="md-nav__link">
<span class="md-ellipsis">
my_model.id
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#my_modelheader" class="md-nav__link">
<span class="md-ellipsis">
my_model.header
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#my_modelobjects" class="md-nav__link">
<span class="md-ellipsis">
my_model.objects
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#my_modelslicer_angles" class="md-nav__link">
<span class="md-ellipsis">
my_model.slicer_angles
</span>
</a>

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -396,20 +498,85 @@ <h2 id="usage">Usage</h2>
3 0 0 87.333336 49.666668 80.0
4 0 0 76.000000 82.000000 80.0
</code></pre></div>
<p>Annotations made in the <a href="https://bio3d.colorado.edu/imod/doc/3dmodHelp/slicer.html">slicer window</a> are stored in the IMOD binary file with both centerpoints and angles.</p>
<p>These annotations can be read in by setting <code>annotation='slan'</code> when calling <code>imodmodel.read()</code></p>
<p>Slicer angles saved in the <a href="https://bio3d.colorado.edu/imod/doc/3dmodHelp/slicer.html">slicer window</a>
are stored in the IMOD binary file with both centerpoints and angles.</p>
<p>These annotations can be read in by setting <code>annotation='slicer_angle'</code> when calling <code>imodmodel.read()</code></p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">imodmodel</span>

<span class="n">df</span> <span class="o">=</span> <span class="n">imodmodel</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="s1">&#39;file_with_slicer_angles.mod&#39;</span><span class="p">,</span> <span class="n">annotation</span><span class="o">=</span><span class="s1">&#39;slan&#39;</span><span class="p">)</span>
<span class="n">df</span> <span class="o">=</span> <span class="n">imodmodel</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="s1">&#39;file_with_slicer_angles.mod&#39;</span><span class="p">,</span> <span class="n">annotation</span><span class="o">=</span><span class="s1">&#39;slicer_angles&#39;</span><span class="p">)</span>
</code></pre></div>
<div class="highlight"><pre><span></span><code>In [3]: df.head()
Out[3]:
object_id slan_id time x_rot y_rot z_rot center_x center_y center_z label
object_id slicer_angle_id time x_rot y_rot z_rot center_x center_y center_z label
0 0 0 1 13.100000 0.0 -30.200001 235.519577 682.744141 302.0
0 0 1 1 -41.400002 0.0 -47.700001 221.942444 661.193237 327.0
0 0 2 1 -41.400002 0.0 -41.799999 232.790726 671.332031 327.0
0 0 3 1 -35.500000 0.0 -36.000000 240.129181 679.927795 324.0
</code></pre></div>
<h2 id="imodmodel">ImodModel</h2>
<p>The resulting dataframe from <code>imodmodel.read()</code> contains only information about the contours or slicer angles.
The full set of information from the imod model file can be parsed using <code>ImodModel</code></p>
<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">imodmodel</span> <span class="kn">import</span> <span class="n">ImodModel</span>

<span class="n">my_model</span> <span class="o">=</span> <span class="n">ImodModel</span><span class="o">.</span><span class="n">from_file</span><span class="p">(</span><span class="s2">&quot;my_model_file.mod&quot;</span><span class="p">)</span>
</code></pre></div>
<div class="highlight"><pre><span></span><code>in [3]: my_model.model_field_set
out[3]:
{&#39;id&#39;, &#39;extra&#39;, &#39;objects&#39;, &#39;slicer_angles&#39;, &#39;header&#39;}
</code></pre></div>
<h3 id="my_modelid">my_model.id</h3>
<p><code>my_model.id</code> contains the IMOD file id and the version id</p>
<div class="highlight"><pre><span></span><code>in [4]: my_model.id
out[4]:
ID(IMOD_file_id=&#39;IMOD&#39;, version_id=&#39;V1.2&#39;)
</code></pre></div>
<h3 id="my_modelheader">my_model.header</h3>
<p><code>my_model.header</code> is contains the model structure data mainly used by IMOD.</p>
<div class="highlight"><pre><span></span><code>in [5]: my_model.header
out[5]:
ModelHeader(name=&#39;IMOD-NewModel&#39;, xmax=956, ymax=924, zmax=300, objsize=3, flags=62976, drawmode=1,
mousemode=1, blacklevel=145, whitelevel=173, xoffset=0.0, yoffset=0.0, zoffset=0.0, xscale=1.0, yscale=10,
zscale=1.0, object=2, contour=-1, point=-1, res=3, thresh=128, pixelsize=1.9733333587646484, units=-9,
csum=704518946, alpha=0.0, beta=0.0, gamma=0.0)
</code></pre></div>
<h3 id="my_modelobjects">my_model.objects</h3>
<p><code>my_model.objects</code> is a <code>list</code> IMOD objects.</p>
<div class="highlight"><pre><span></span><code>in [6]: my_model.objects[0].header
out[6]:
ObjectHeader(name=&#39;&#39;, extra_data=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], contsize=0,
flags=402653184, axis=0, drawmode=1, red=0.0, green=1.0, blue=0.0, pdrawsize=0, symbol=1, symsize=3,
linewidth2=1, linewidth=1, linesty=0, symflags=0, sympad=0, trans=0, meshsize=0, surfsize=0)
</code></pre></div>
<p>This is where object values like contours, meshes, and IMAT information are located.</p>
<div class="highlight"><pre><span></span><code>in [7]: my_model.objects[1].meshes[0].indices
out[7]:
array([[38, 40, 52],
[38, 52, 50],
[50, 52, 64],
[50, 64, 60],
...,
[ 4, 10, 26],
[ 4, 26, 20],
[20, 26, 38],
[20, 38, 32]])
</code></pre></div>
<div class="highlight"><pre><span></span><code>in [8]: my_model.objects[1].imat
out[8]:
IMAT(ambient=102, diffuse=255, specular=127, shininess=4, fillred=0, fillgreen=0, fillblue=0,
quality=0, mat2=0, valblack=0, valwhite=255, matflags2=0, mat3b3=0)
</code></pre></div>
<div class="highlight"><pre><span></span><code>in [9]: my_model.objects[1].contours[0].points
out[9]:
array([[367.00006104, 661.83343506, 134. ],
[415.66674805, 667.83343506, 134. ],
[474.33340454, 662.50012207, 134. ]])
</code></pre></div>
<h3 id="my_modelslicer_angles">my_model.slicer_angles</h3>
<p><code>my_model.slicer_angles</code> is a <code>list</code> of slicer angles.</p>
<div class="highlight"><pre><span></span><code>in [10]: my_model.slicer_angles[0]
out[10]:
SLAN(time=1, angles=(0.0, 0.0, 0.0), center=(533.5, 717.0, 126.0), label=&#39;\x00&#39;)
</code></pre></div>
<p>That's it!</p>
<h2 id="installation">Installation</h2>
<p><code>imodmodel</code> can be installed from the <a href="https://pypi.org/">Python Package Index</a> (PyPI)</p>
Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Overview","text":"<p>Read IMOD model files as pandas dataframes in Python.</p>"},{"location":"#usage","title":"Usage","text":"<pre><code>import imodmodel\n\ndf = imodmodel.read('my_model_file.mod')\n</code></pre> <pre><code>In [3]: df.head()\nOut[3]: \n object_id contour_id x y z\n0 0 0 64.333336 64.666664 80.0\n1 0 0 47.000000 77.333336 80.0\n2 0 0 51.333332 45.666668 80.0\n3 0 0 87.333336 49.666668 80.0\n4 0 0 76.000000 82.000000 80.0\n</code></pre> <p>Annotations made in the slicer window are stored in the IMOD binary file with both centerpoints and angles.</p> <p>These annotations can be read in by setting <code>annotation='slan'</code> when calling <code>imodmodel.read()</code></p> <pre><code>import imodmodel\n\ndf = imodmodel.read('file_with_slicer_angles.mod', annotation='slan')\n</code></pre> <pre><code>In [3]: df.head()\nOut[3]:\n object_id slan_id time x_rot y_rot z_rot center_x center_y center_z label\n0 0 0 1 13.100000 0.0 -30.200001 235.519577 682.744141 302.0\n0 0 1 1 -41.400002 0.0 -47.700001 221.942444 661.193237 327.0\n0 0 2 1 -41.400002 0.0 -41.799999 232.790726 671.332031 327.0\n0 0 3 1 -35.500000 0.0 -36.000000 240.129181 679.927795 324.0\n</code></pre> <p>That's it!</p>"},{"location":"#installation","title":"Installation","text":"<p><code>imodmodel</code> can be installed from the Python Package Index (PyPI)</p> <pre><code>pip install imodmodel\n</code></pre> <p>We recommend installing into a clean virtual environment.</p>"}]}
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Overview","text":"<p>Read IMOD model files as pandas dataframes in Python.</p>"},{"location":"#usage","title":"Usage","text":"<pre><code>import imodmodel\n\ndf = imodmodel.read('my_model_file.mod')\n</code></pre> <pre><code>In [3]: df.head()\nOut[3]: \n object_id contour_id x y z\n0 0 0 64.333336 64.666664 80.0\n1 0 0 47.000000 77.333336 80.0\n2 0 0 51.333332 45.666668 80.0\n3 0 0 87.333336 49.666668 80.0\n4 0 0 76.000000 82.000000 80.0\n</code></pre> <p>Slicer angles saved in the slicer window are stored in the IMOD binary file with both centerpoints and angles.</p> <p>These annotations can be read in by setting <code>annotation='slicer_angle'</code> when calling <code>imodmodel.read()</code></p> <pre><code>import imodmodel\n\ndf = imodmodel.read('file_with_slicer_angles.mod', annotation='slicer_angles')\n</code></pre> <pre><code>In [3]: df.head()\nOut[3]:\n object_id slicer_angle_id time x_rot y_rot z_rot center_x center_y center_z label\n0 0 0 1 13.100000 0.0 -30.200001 235.519577 682.744141 302.0\n0 0 1 1 -41.400002 0.0 -47.700001 221.942444 661.193237 327.0\n0 0 2 1 -41.400002 0.0 -41.799999 232.790726 671.332031 327.0\n0 0 3 1 -35.500000 0.0 -36.000000 240.129181 679.927795 324.0\n</code></pre>"},{"location":"#imodmodel","title":"ImodModel","text":"<p>The resulting dataframe from <code>imodmodel.read()</code> contains only information about the contours or slicer angles. The full set of information from the imod model file can be parsed using <code>ImodModel</code></p> <pre><code>from imodmodel import ImodModel\n\nmy_model = ImodModel.from_file(\"my_model_file.mod\")\n</code></pre> <pre><code>in [3]: my_model.model_field_set\nout[3]: \n{'id', 'extra', 'objects', 'slicer_angles', 'header'}\n</code></pre>"},{"location":"#my_modelid","title":"my_model.id","text":"<p><code>my_model.id</code> contains the IMOD file id and the version id</p> <pre><code>in [4]: my_model.id\nout[4]: \nID(IMOD_file_id='IMOD', version_id='V1.2')\n</code></pre>"},{"location":"#my_modelheader","title":"my_model.header","text":"<p><code>my_model.header</code> is contains the model structure data mainly used by IMOD.</p> <pre><code>in [5]: my_model.header\nout[5]:\nModelHeader(name='IMOD-NewModel', xmax=956, ymax=924, zmax=300, objsize=3, flags=62976, drawmode=1,\nmousemode=1, blacklevel=145, whitelevel=173, xoffset=0.0, yoffset=0.0, zoffset=0.0, xscale=1.0, yscale=10,\nzscale=1.0, object=2, contour=-1, point=-1, res=3, thresh=128, pixelsize=1.9733333587646484, units=-9,\ncsum=704518946, alpha=0.0, beta=0.0, gamma=0.0)\n</code></pre>"},{"location":"#my_modelobjects","title":"my_model.objects","text":"<p><code>my_model.objects</code> is a <code>list</code> IMOD objects.</p> <pre><code>in [6]: my_model.objects[0].header\nout[6]: \nObjectHeader(name='', extra_data=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], contsize=0,\nflags=402653184, axis=0, drawmode=1, red=0.0, green=1.0, blue=0.0, pdrawsize=0, symbol=1, symsize=3,\nlinewidth2=1, linewidth=1, linesty=0, symflags=0, sympad=0, trans=0, meshsize=0, surfsize=0)\n</code></pre> <p>This is where object values like contours, meshes, and IMAT information are located.</p> <pre><code>in [7]: my_model.objects[1].meshes[0].indices\nout[7]: \narray([[38, 40, 52],\n [38, 52, 50],\n [50, 52, 64],\n [50, 64, 60],\n ...,\n [ 4, 10, 26],\n [ 4, 26, 20],\n [20, 26, 38],\n [20, 38, 32]])\n</code></pre> <pre><code>in [8]: my_model.objects[1].imat\nout[8]: \nIMAT(ambient=102, diffuse=255, specular=127, shininess=4, fillred=0, fillgreen=0, fillblue=0,\nquality=0, mat2=0, valblack=0, valwhite=255, matflags2=0, mat3b3=0)\n</code></pre> <pre><code>in [9]: my_model.objects[1].contours[0].points\nout[9]:\narray([[367.00006104, 661.83343506, 134. ],\n [415.66674805, 667.83343506, 134. ],\n [474.33340454, 662.50012207, 134. ]])\n</code></pre>"},{"location":"#my_modelslicer_angles","title":"my_model.slicer_angles","text":"<p><code>my_model.slicer_angles</code> is a <code>list</code> of slicer angles.</p> <pre><code>in [10]: my_model.slicer_angles[0]\nout[10]:\nSLAN(time=1, angles=(0.0, 0.0, 0.0), center=(533.5, 717.0, 126.0), label='\\x00')\n</code></pre> <p>That's it!</p>"},{"location":"#installation","title":"Installation","text":"<p><code>imodmodel</code> can be installed from the Python Package Index (PyPI)</p> <pre><code>pip install imodmodel\n</code></pre> <p>We recommend installing into a clean virtual environment.</p>"}]}
2 changes: 1 addition & 1 deletion sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://teamtomo.org/imodmodel/</loc>
<lastmod>2024-06-08</lastmod>
<lastmod>2024-06-13</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>
Binary file modified sitemap.xml.gz
Binary file not shown.

0 comments on commit 3de2a89

Please sign in to comment.