<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to fabio</title><link>https://sourceforge.net/p/fable/wiki/fabio/</link><description>Recent changes to fabio</description><atom:link href="https://sourceforge.net/p/fable/wiki/fabio/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 07 Jul 2014 17:27:11 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/fable/wiki/fabio/feed" rel="self" type="application/rss+xml"/><item><title>fabio modified by &lt;REDACTED&gt;</title><link>https://sourceforge.net/p/fable/wiki/fabio/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="fabio"&gt;FabIO&lt;/h1&gt;
&lt;p&gt;FabIO is an I/O library for diffraction images written in python. It combines the functionalities which evolved in &lt;a class="" href="/p/fable/wiki/fabian/"&gt;Fabian&lt;/a&gt; and &lt;a class="" href="/p/fable/wiki/imaged11/"&gt;ImageD11&lt;/a&gt;. &lt;br /&gt;
The design specification can be viewed at: &lt;a class="" href="../pyimageio"&gt;PyImageIO&lt;/a&gt;. &lt;br /&gt;
Changelog from FabIO-0.0.4 to FabIO-0.0.6: - Support for CBF files from Pilatus detectors - Support for KCD files from Nonius Kappa CCD images - write EDF with their native data type (instead of uint16 by default) &lt;/p&gt;
&lt;h1 id="installation"&gt;Installation?&lt;/h1&gt;
&lt;h2 id="installation_1"&gt;Installation&lt;/h2&gt;
&lt;p&gt;fabio can be downloaded from the &lt;a class="" href="http://sourceforge.net/project/showfiles.php?group_id=82044&amp;amp;package_id=248946"&gt;fable download&lt;/a&gt; page on sourceforge.net. Presently the source code has been distributed as a zip package and a compressed tarball. Download either one and unpack it. &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;tar&lt;/span&gt; &lt;span class="n"&gt;xvzf&lt;/span&gt; &lt;span class="n"&gt;fabio&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.0.6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gz&lt;/span&gt;
&lt;span class="n"&gt;or&lt;/span&gt;
&lt;span class="n"&gt;unzip&lt;/span&gt; &lt;span class="n"&gt;fabio&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.0.6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zip&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;all files are unpacked into the directory fabio-0.0.6. To install these do &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;cd&lt;/span&gt; &lt;span class="n"&gt;fabio&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.0.6&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and install fabio with &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;most likely you will need to do this with root privileges (e.g. put sudo in front of the command). &lt;br /&gt;
The newest development version can be obtained by checking it out from the subversion (SVN) repository. Do &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;svn&lt;/span&gt; &lt;span class="n"&gt;checkout&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//fable.svn.sourceforge.net/svnroot/fable/fabio/ fabio&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt; &lt;span class="n"&gt;fabio&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trunk&lt;/span&gt;
&lt;span class="n"&gt;sudo&lt;/span&gt; &lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you are using &lt;strong&gt;MS Windows&lt;/strong&gt; you also download a binary version packaged as executable installation files. Dependant on your python version open either &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;fabio&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.0.6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;win32&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;py2&lt;/span&gt;&lt;span class="mf"&gt;.5&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exe&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;fabio&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.0.6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;win32&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;py2&lt;/span&gt;&lt;span class="mf"&gt;.6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exe&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h1 id="python_and_python_modules_needed_by_fabio"&gt;Python_and_python_modules_needed_by_fabio?&lt;/h1&gt;
&lt;h3 id="python-and-python-modules-needed-by-fabio"&gt;Python and python modules needed by fabio&lt;/h3&gt;
&lt;p&gt;The installation of modules is easiest if &lt;strong&gt;Python 2.5&lt;/strong&gt; or later (but not Python 3.00 is installed. Since precompiled and installation ready versions are available of all the needed python modules. &lt;br /&gt;
For full functionality of &lt;strong&gt;fabio&lt;/strong&gt; the following modules need to be installed. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;PIL (python imaging library) - &lt;a class="" href="http://www.pythonware.com/" rel="nofollow"&gt;http://www.pythonware.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;numpy - &lt;a class="" href="http://www.numpy.org/" rel="nofollow"&gt;http://www.numpy.org&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id="ubuntu_specific_installation_details-ubuntu-specific-installation-details"&gt;Ubuntu_specific_installation_details? Ubuntu specific installation details&lt;/h1&gt;
&lt;p&gt;To use fabio on &lt;a class="" href="http://www.ubuntu.com/" rel="nofollow"&gt;Ubuntu&lt;/a&gt; (a linux distribution based on Debian) the needed python modules can be installed either through the Synaptic Package Manager (found in System -&amp;gt; Administration) or using apt-get on from the command line in a terminal. &lt;br /&gt;
The extra ubuntu packages needed are: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;python-imaging &lt;/li&gt;
&lt;li&gt;python-imaging-tk &lt;/li&gt;
&lt;li&gt;python-numpy &lt;/li&gt;
&lt;li&gt;python-dev (at least in Ubuntu 8.10, Intrepid Ibex) &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;using apt-get these can be installed as: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;sudo&lt;/span&gt; &lt;span class="n"&gt;apt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;imaging&lt;/span&gt; &lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;imaging&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;tk&lt;/span&gt; &lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;numpy&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;using Synaptic Package Manager: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;find&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;specific&lt;/span&gt; &lt;span class="n"&gt;ubuntu&lt;/span&gt; &lt;span class="n"&gt;packages&lt;/span&gt; &lt;span class="n"&gt;instead&lt;/span&gt;
&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;mark&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;them&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;installation&lt;/span&gt;
&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;Apply&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h1 id="using_fabio_in_your_own_python_programs"&gt;Using_fabio_in_your_own_python_programs?&lt;/h1&gt;
&lt;h2 id="transparent-handling-of-compressed-files"&gt;Transparent handling of compressed files&lt;/h2&gt;
&lt;p&gt;Fabio is expected to handle gzip and bzip2 compressed files transparently. Perhaps also zip if someone adds it. Following a query about the performance of reading compressed data, some benchmarking details have been collected at &lt;a class="alink" href="/p/fable/wiki/fabio_compressed_speed/"&gt;[fabio_compressed_speed]&lt;/a&gt;. This means that when your python was configured and built you needed the bzip and gzip modules to be present (eg libbz2-dev package for ubuntu) &lt;/p&gt;
&lt;h2 id="using-fabio-in-your-own-python-programs"&gt;Using fabio in your own python programs&lt;/h2&gt;
&lt;p&gt;Example: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;import&lt;/span&gt; &lt;span class="n"&gt;fabio&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fabio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;edfimage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;mydata0000.edf&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2048&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2048&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Omega&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="mf"&gt;23.5&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="adding-new-file-formats"&gt;Adding new file formats&lt;/h2&gt;
&lt;p&gt;We hope it will be relatively easy to add new file formats to fabio in the future. The basic idea is the following: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;inherit from fabioimage overriding the methods _readheader, read and optionally write. Name your new module XXXimage where XXX means something (eg tifimage). &lt;/li&gt;
&lt;li&gt;readheader fills in a dictionary of "name":"value" pairs in self.header. No one expects to find anything much in there. &lt;/li&gt;
&lt;li&gt;read fills in self.data with a numpy array holding the image. Some redundant info which also appears are self.dim1 and self.dim2: the image dimensions, self.bpp is the bytes per pixel and self.bytecode is the numpy.dtype.type of the data. &lt;/li&gt;
&lt;li&gt;The member variables "_need_a_seek_to_read" and "_need_a_real_file" are there in case you have trouble with the transparent handling of bz2 and gz files. &lt;/li&gt;
&lt;li&gt;Register the file type (extension naming) in init__.py:FILETYPES &lt;/li&gt;
&lt;li&gt;Add your new module as an import into fabio.openimage &lt;/li&gt;
&lt;li&gt;Fill out the magic numbers for your format in fabio.openimage if you know them (the characteristic first few bytes in the file) &lt;/li&gt;
&lt;li&gt;Upload a testimage to the file release system and create a unittest testcase which opens an example of your new format, confirming the image has actually been read in successfully (eg check the mean, max, min and esd are all correct, perhaps orientation too) &lt;/li&gt;
&lt;li&gt;Run pylint on your code and then please go clean it up. Have a go at mine while you are at it. &lt;/li&gt;
&lt;li&gt;Bask in the warm glow of appreciation when someone unexpectedly learns they don't need to convert their data into another format &lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;</description><pubDate>Mon, 07 Jul 2014 17:27:11 -0000</pubDate><guid>https://sourceforge.net072beb611d2ebb89e994712928c128ebda88b8c3</guid></item></channel></rss>