<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Python, filtering</title><link>https://sourceforge.net/p/mia/wiki/Python%252C%2520filtering/</link><description>Recent changes to Python, filtering</description><atom:link href="https://sourceforge.net/p/mia/wiki/Python,%20filtering/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 09 Jan 2015 17:34:21 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/mia/wiki/Python,%20filtering/feed" rel="self" type="application/rss+xml"/><item><title>Python, filtering modified by Gert Wollny</title><link>https://sourceforge.net/p/mia/wiki/Python%252C%2520filtering/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -4,24 +4,24 @@

 ### Filtering 

-The *mia.filter* function transparently distinguishes between 2D and 3D images. Filters are specified as strings like they are given on the [mia-2dimagefilter](http://mia.sourceforge.net/userref/Secmia2dimagefilter.html) and [mia-3dimagefilter](http://mia.sourceforge.net/userref/Secmia3dimagefilter.html) command line.
+The *pymia.filter* function transparently distinguishes between 2D and 3D images. Filters are specified as strings like they are given on the [mia-2dimagefilter](http://mia.sourceforge.net/userref/Secmia2dimagefilter.html) and [mia-3dimagefilter](http://mia.sourceforge.net/userref/Secmia3dimagefilter.html) command line.

 Filters can be run one at a time, or as a pipeline. To run a single filter, e.g. a *median* filter of *half filter width* 3 on an image *input* run 

     :::python 
-    filtered = mia.filter(input, "median:w=3")
+    filtered = pymia.filter(input, "median:w=3")

 To run a filter chain, e.g. the above median, followed by a *mean-least-variance* filter with a filter width parameter 5, provide the filters as a list: 

     :::python 
-    filtered = mia.filter(input, ["median:w=3", "mlv:w=5"])
+    filtered = pymia.filter(input, ["median:w=3", "mlv:w=5"])

 Note that the filters function converts the *input* to the internal MIA image format, creates and runs the filters, and then converts the images back to *numpy* arrays. Therefore, for performance reasons, it is best to run the filter chains instead of one filter at a time. 

 In order to avoid re-creating filters one can enable the filter cache by calling 

     :::python 
-    mia.set_filter_plugin_cache(True)
+    pymia.set_filter_plugin_cache(True)

-Then, filters with the same description are re-used  in subsequent calls to the *mia.filter* function. The filters in MIA normally work like functions, i.e. no state changes when it is called. *However, in some rare cases, when external data is loaded by means of a filter parameter, this may actually not work like expected (cf. [tickets:#134]).*
+Then, filters with the same description are re-used  in subsequent calls to the *pymia.filter* function. The filters in MIA normally work like functions, i.e. no state changes when it is called. *However, in some rare cases, when external data is loaded by means of a filter parameter, this may actually not work like expected (cf. [tickets:#134]).*

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gert Wollny</dc:creator><pubDate>Fri, 09 Jan 2015 17:34:21 -0000</pubDate><guid>https://sourceforge.net98de750f34487c2a5f6555bf2c305737233d5d8d</guid></item><item><title>Python, filtering modified by Gert Wollny</title><link>https://sourceforge.net/p/mia/wiki/Python%252C%2520filtering/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -1,6 +1,5 @@
 Navigation | | 
 -----------|-|-----------------
-
 [loading images](Python, loading images) | [Contents](Using mia from Python) | [image registration](Python, image registration)

 ### Filtering 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gert Wollny</dc:creator><pubDate>Thu, 12 Dec 2013 15:16:57 -0000</pubDate><guid>https://sourceforge.net8d2caecad45e0062f3a6af804236937619458cbf</guid></item><item><title>Python, filtering modified by Gert Wollny</title><link>https://sourceforge.net/p/mia/wiki/Python%252C%2520filtering/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -1,3 +1,8 @@
+Navigation | | 
+-----------|-|-----------------
+
+[loading images](Python, loading images) | [Contents](Using mia from Python) | [image registration](Python, image registration)
+
 ### Filtering

 The *mia.filter* function transparently distinguishes between 2D and 3D images. Filters are specified as strings like they are given on the [mia-2dimagefilter](http://mia.sourceforge.net/userref/Secmia2dimagefilter.html) and [mia-3dimagefilter](http://mia.sourceforge.net/userref/Secmia3dimagefilter.html) command line.
@@ -21,6 +26,3 @@

 Then, filters with the same description are re-used  in subsequent calls to the *mia.filter* function. The filters in MIA normally work like functions, i.e. no state changes when it is called. *However, in some rare cases, when external data is loaded by means of a filter parameter, this may actually not work like expected (cf. [tickets:#134]).*

------
-
-[loading images](Python, loading images) [top](Using mia from Python)  [image registration](Python, image registration)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gert Wollny</dc:creator><pubDate>Thu, 12 Dec 2013 15:16:46 -0000</pubDate><guid>https://sourceforge.netaff75b81aa0c8d30e75ffa282b4dc13a12fceb86</guid></item><item><title>Python, filtering modified by Gert Wollny</title><link>https://sourceforge.net/p/mia/wiki/Python%252C%2520filtering/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -23,4 +23,4 @@

 -----

-[back](Python, loading images) [top](Using mia from Python)  [forward](Python, image registration)
+[loading images](Python, loading images) [top](Using mia from Python)  [image registration](Python, image registration)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gert Wollny</dc:creator><pubDate>Thu, 12 Dec 2013 15:02:59 -0000</pubDate><guid>https://sourceforge.netb363821ebffe8fe110f07dd4efb8e55e2d757687</guid></item><item><title>Python, filtering modified by Gert Wollny</title><link>https://sourceforge.net/p/mia/wiki/Python%252C%2520filtering/</link><description>&lt;div class="markdown_content"&gt;&lt;h3 id="filtering"&gt;Filtering&lt;/h3&gt;
&lt;p&gt;The &lt;em&gt;mia.filter&lt;/em&gt; function transparently distinguishes between 2D and 3D images. Filters are specified as strings like they are given on the &lt;a class="" href="http://mia.sourceforge.net/userref/Secmia2dimagefilter.html"&gt;mia-2dimagefilter&lt;/a&gt; and &lt;a class="" href="http://mia.sourceforge.net/userref/Secmia3dimagefilter.html"&gt;mia-3dimagefilter&lt;/a&gt; command line.&lt;/p&gt;
&lt;p&gt;Filters can be run one at a time, or as a pipeline. To run a single filter, e.g. a &lt;em&gt;median&lt;/em&gt; filter of &lt;em&gt;half filter width&lt;/em&gt; 3 on an image &lt;em&gt;input&lt;/em&gt; run &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;filtered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mia&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;median:w=3&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To run a filter chain, e.g. the above median, followed by a &lt;em&gt;mean-least-variance&lt;/em&gt; filter with a filter width parameter 5, provide the filters as a list: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;filtered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mia&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;median:w=3&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;mlv:w=5&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that the filters function converts the &lt;em&gt;input&lt;/em&gt; to the internal MIA image format, creates and runs the filters, and then converts the images back to &lt;em&gt;numpy&lt;/em&gt; arrays. Therefore, for performance reasons, it is best to run the filter chains instead of one filter at a time. &lt;/p&gt;
&lt;p&gt;In order to avoid re-creating filters one can enable the filter cache by calling &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;mia&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set_filter_plugin_cache&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then, filters with the same description are re-used  in subsequent calls to the &lt;em&gt;mia.filter&lt;/em&gt; function. The filters in MIA normally work like functions, i.e. no state changes when it is called. &lt;em&gt;However, in some rare cases, when external data is loaded by means of a filter parameter, this may actually not work like expected (cf. &lt;a class="alink" href="/p/mia/tickets/134/"&gt;[tickets:#134]&lt;/a&gt;).&lt;/em&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;a class="" href="../Python,%20loading%20images"&gt;back&lt;/a&gt; &lt;a class="" href="/p/mia/wiki/Using%20mia%20from%20Python/"&gt;top&lt;/a&gt; &lt;a class="" href="../Python,%20image%20registration"&gt;forward&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gert Wollny</dc:creator><pubDate>Thu, 12 Dec 2013 14:46:46 -0000</pubDate><guid>https://sourceforge.netc57e98bd209cfecf388d5e554faf696cc6bc2f6e</guid></item></channel></rss>