<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Research: Math, Computing and MRI &#187; craig</title>
	<atom:link href="http://mri.brechmos.org/author/craig/feed/" rel="self" type="application/rss+xml" />
	<link>http://mri.brechmos.org</link>
	<description>by Craig Jones</description>
	<lastBuildDate>Wed, 10 Aug 2011 16:53:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Linux Virtualbox images</title>
		<link>http://mri.brechmos.org/2011/08/linux-virtualbox-images/</link>
		<comments>http://mri.brechmos.org/2011/08/linux-virtualbox-images/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 16:53:14 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/?p=661</guid>
		<description><![CDATA[A very cool website has a bunch of Virtualbox images of different linux distrbutions one can download and try out. http://virtualboxes.org/images/]]></description>
			<content:encoded><![CDATA[<p>A very cool website has a bunch of Virtualbox images of different linux distrbutions one can download and try out.</p>
<p>http://virtualboxes.org/images/</p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2011/08/linux-virtualbox-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To Do through GMail</title>
		<link>http://mri.brechmos.org/2011/03/to-do-through-gmail/</link>
		<comments>http://mri.brechmos.org/2011/03/to-do-through-gmail/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 01:46:07 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/?p=628</guid>
		<description><![CDATA[I am always trying to find a better way to create my To Do List. Years ago I kept a list in LaTeX and would print it out everyday. That worked well for quite a while. More recently I had &#8230; <a href="http://mri.brechmos.org/2011/03/to-do-through-gmail/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am always trying to find a better way to create my To Do List.  Years ago I kept a list in LaTeX and would print it out everyday. That worked well for quite a while. More recently I had been keeping an OpenOffice document and would print it out irregularly. It has sort of worked and it sort of doesn&#8217;t work. Just yesterday I ran into http://www.activeinboxhq.com/ which is a small framework around GMail that is interesting. I created a new email address and downloaded their free version and will probably play with it for a while. One quick interesting thing is that I would be able to email To Dos to myself when I think of them as it is all based on an email address.</p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2011/03/to-do-through-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mounting a Time Capsule under linux</title>
		<link>http://mri.brechmos.org/2011/01/mounting-a-time-capsule-under-linux/</link>
		<comments>http://mri.brechmos.org/2011/01/mounting-a-time-capsule-under-linux/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 01:20:12 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/?p=588</guid>
		<description><![CDATA[My Mac has taken a bit of a dive so I switched over to using the Ubuntu side exclusively. It has been great, Ubuntu has been very solid and I love all the applications. One thing I wanted to do &#8230; <a href="http://mri.brechmos.org/2011/01/mounting-a-time-capsule-under-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My Mac has taken a bit of a dive so I switched over to using the Ubuntu side exclusively.  It has been great, Ubuntu has been very solid and I love all the applications.  One thing I wanted to do was to mount my Time Capsule on the Linux side.  For the most part this should be really easy (either through fstab or through smbmount from the command line).  Well, I had lots of problems.</p>
<pre>retrying with upper case share name
mount error 6 = No such device or address
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)</pre>
<p>I worked on this for a while and looked all over for a solution.  It is 2011 (now) and surely this still can&#8217;t be an issue.  Well, finally figured it out.  Don&#8217;t include the Time Capsule name in the mount call, just include the directory name:</p>
<p>[cc lang="bash"]sudo mount -t smbfs -o user=craig,pass=
<pass>,rw,uid=503,gid=10000 &#8211;verbose //10.0.1.1/craigCapsule/data /media/capsule<br />
[/cc]</p>
<p>and remove the &#8220;craigCapsule&#8221; and so it is just:</p>
<p>[cc lang="bash"]sudo mount -t smbfs -o user=craig,pass=
<pass>,rw,uid=503,gid=10000 &#8211;verbose //10.0.1.1/data /media/capsule<br />
[/cc]</p>
<p>Make sure you use the uid and gid (set to your user account) otherwise you will not be able to write to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2011/01/mounting-a-time-capsule-under-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New theme &#8211; new hopes</title>
		<link>http://mri.brechmos.org/2011/01/new-theme-new-hopes/</link>
		<comments>http://mri.brechmos.org/2011/01/new-theme-new-hopes/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 01:09:20 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/?p=586</guid>
		<description><![CDATA[I am going to try and get back to this blog now. I put on a new theme, which is extremely appropriate for what I do.]]></description>
			<content:encoded><![CDATA[<p>I am going to try and get back to this blog now.  I put on a new theme, which is extremely appropriate for what I do.  </p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2011/01/new-theme-new-hopes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Python plots with no display</title>
		<link>http://mri.brechmos.org/2010/02/python-plots-with-no-display/</link>
		<comments>http://mri.brechmos.org/2010/02/python-plots-with-no-display/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 01:43:37 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/?p=577</guid>
		<description><![CDATA[I have been working on some offline processing of data and creating graphs on the fly which automatically get updated on a website. What has been problematic is to do this without a display (for example run from a cron &#8230; <a href="http://mri.brechmos.org/2010/02/python-plots-with-no-display/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have been working on some offline processing of data and creating graphs on the fly which automatically get updated on a website.  What has been problematic is to do this without a display (for example run from a cron job).  I <a href="http://www.dalkescientific.com/writings/diary/archive/2005/04/23/matplotlib_without_gui.html">found a solution</a> which seems to work with the EPD package I am using on a linux box.</p>
<p>[cc lang="python"]<br />
from matplotlib.figure import Figure<br />
from matplotlib.backends.backend_agg import FigureCanvasAgg</p>
<p>fig = Figure(figsize=(4,4))<br />
fig.gca().plot(range(1,10))<br />
canvas=FigureCanvasAgg(fig)<br />
canvas.print_figure(&#8216;bob.png&#8217;, dpi=150)<br />
[/cc]</p>
<p>There are likely some other ways to do it, but this works for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2010/02/python-plots-with-no-display/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Canada Men&#8217;s Olympic Hockey Team</title>
		<link>http://mri.brechmos.org/2010/02/canada-mens-olympic-hockey-team/</link>
		<comments>http://mri.brechmos.org/2010/02/canada-mens-olympic-hockey-team/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 18:12:40 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/2010/02/28/canada-mens-olympic-hockey-team/</guid>
		<description><![CDATA[Go Canada!!]]></description>
			<content:encoded><![CDATA[<p>Go Canada!!</p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2010/02/canada-mens-olympic-hockey-team/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Terminal from Finder</title>
		<link>http://mri.brechmos.org/2010/02/open-terminal-from-finder/</link>
		<comments>http://mri.brechmos.org/2010/02/open-terminal-from-finder/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 15:17:33 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/2010/02/18/open-terminal-from-finder/</guid>
		<description><![CDATA[I am always looking for ways of emulating many Linux things on the Mac. I must admit I use the Terminal window almost exclusively for doing my work but there are times that using the Finder is just faster. Then, &#8230; <a href="http://mri.brechmos.org/2010/02/open-terminal-from-finder/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am always looking for ways of emulating many Linux things on the Mac.  I must admit I use the Terminal window almost exclusively for doing my work but there are times that using the Finder is just faster.  </p>
<p>Then, often when I find the directory I have been looking for I want to get a Terminal window that is in that same directory.  Typically I have just opened a Terminal window and cd&#8217;ed to the location &#8211; which can be quite laborious.  So, finally, I looked around for a solution.  I found a nice little Finder button called <a href="http://code.google.com/p/cdto/">cdto</a>.  This will put a button on the Finder window and open a Terminal in the same directory as where the Finder is currently pointing.  </p>
<p>Nice&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2010/02/open-terminal-from-finder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interesting TED Talk</title>
		<link>http://mri.brechmos.org/2010/02/interesting-ted-talk/</link>
		<comments>http://mri.brechmos.org/2010/02/interesting-ted-talk/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 00:03:10 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/?p=569</guid>
		<description><![CDATA[I enjoy watching the TED talks. One that was really good was Keith Barry. The first part is a little slow (I found), but it is quite entertaining.]]></description>
			<content:encoded><![CDATA[<p>I enjoy watching the <a href="http://ted.com">TED</a> talks.  One that was really good was Keith Barry.  The first part is a little slow (I found), but it is quite entertaining.</p>
<p><center><br />
<!--copy and paste--><object width="446" height="326"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param><param name="flashvars" value="vu=http://video.ted.com/talks/dynamic/KeithBarry_2004-medium.flv&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/KeithBarry-2004.embed_thumbnail.jpg&#038;vw=432&#038;vh=240&#038;ap=0&#038;ti=310&#038;introDuration=16500&#038;adDuration=4000&#038;postAdDuration=2000&#038;adKeys=talk=keith_barry_does_brain_magic;year=2004;theme=spectacular_performance;theme=how_the_mind_works;event=TED2004;&#038;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="446" height="326" allowFullScreen="true" flashvars="vu=http://video.ted.com/talks/dynamic/KeithBarry_2004-medium.flv&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/KeithBarry-2004.embed_thumbnail.jpg&#038;vw=432&#038;vh=240&#038;ap=0&#038;ti=310&#038;introDuration=16500&#038;adDuration=4000&#038;postAdDuration=2000&#038;adKeys=talk=keith_barry_does_brain_magic;year=2004;theme=spectacular_performance;theme=how_the_mind_works;event=TED2004;"></embed></object></center></p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2010/02/interesting-ted-talk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In Our Time: Unintended Consequences of Mathematics</title>
		<link>http://mri.brechmos.org/2010/02/in-our-time-unintended-consequences-of-mathematics/</link>
		<comments>http://mri.brechmos.org/2010/02/in-our-time-unintended-consequences-of-mathematics/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 17:53:20 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/?p=567</guid>
		<description><![CDATA[Another interesting Podcast, this time by Melvyn Bragg in his In Our Time show. It is on Unintended Concsequences in Mathematics and talks about cubic equations, statistics and non-Euclidean geometry.]]></description>
			<content:encoded><![CDATA[<p>Another interesting Podcast, this time by Melvyn Bragg in his <a href="http://www.bbc.co.uk/radio4/features/in-our-time/">In Our Time</a> show.  It is on <a href="http://www.bbc.co.uk/programmes/b00qj2nq">Unintended Concsequences in Mathematics</a> and talks about cubic equations, statistics and non-Euclidean geometry. </p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2010/02/in-our-time-unintended-consequences-of-mathematics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>writeanalyze in Matlab</title>
		<link>http://mri.brechmos.org/2010/02/writeanalyze-in-matlab/</link>
		<comments>http://mri.brechmos.org/2010/02/writeanalyze-in-matlab/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 14:57:23 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Matlab]]></category>
		<category><![CDATA[MRI]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mri.brechmos.org/?p=565</guid>
		<description><![CDATA[I am always look for different MRI file readers and writers for the myriad of formats that we use in MRI research. One of the relatively simple and common ones is the Analyze fileformat. Some of the large packages have &#8230; <a href="http://mri.brechmos.org/2010/02/writeanalyze-in-matlab/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am always look for different MRI file readers and writers for the myriad of formats that we use in MRI research.  One of the relatively simple and common ones is the Analyze fileformat.  Some of the large packages have writers  (e.g., SPM) but I am typically wanting to do my own small processing and then write out the data.  So, I wrote up my own writeanalyze.m function.  It will do the basic formatting though the offsets etc don&#8217;t work.  Try it out but I can&#8217;t guarantee anything.</p>
<p>[cc lang="matlab"]<br />
function [] = writeanalyze(fname, data, ftype)</p>
<p>if( nargin == 2 )<br />
	ftype = &#8216;int16&#8242;;<br />
end</p>
<p>if( strcmp( ftype, &#8216;int16&#8242; ) == 1 )<br />
	file_type = 4; bpp = 16;<br />
elseif( strcmp( ftype, &#8216;uint16&#8242; ) == 1 )<br />
	file_type = 4; bpp = 16;<br />
elseif( strcmp( ftype, &#8216;int32&#8242; ) == 1 )<br />
	file_type = 8; bpp = 32;<br />
elseif( strcmp( ftype, &#8216;float&#8217; ) == 1 )<br />
	file_type = 16; bpp = 32;<br />
elseif( strcmp( ftype, &#8216;double&#8217; ) == 1 )<br />
	file_type = 64; bpp = 64;<br />
else<br />
	error(sprintf(&#8216;Unknown data type %s&#8217;, ftype));<br />
end</p>
<p>fp = fopen([fname '.hdr'], &#8216;wb&#8217;, &#8216;b&#8217;);</p>
<p>%%<br />
%%  Write the header_key part<br />
%%<br />
fwrite(fp, 348, &#8216;int32&#8242;);<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 10), &#8216;char&#8217;);<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 18), &#8216;char&#8217;);<br />
fwrite(fp, 16384, &#8216;int32&#8242;);<br />
fwrite(fp, 0, &#8216;int16&#8242;);<br />
fwrite(fp, &#8216;r &#8216;, &#8216;char&#8217;);</p>
<p>%%<br />
%% Write the image_dimension part.<br />
%%<br />
fwrite(fp, length( size(data) ), &#8216;int16&#8242;);<br />
for ii=1:length( size(data) )<br />
	fwrite(fp, size(data,ii), &#8216;int16&#8242;);<br />
end</p>
<p>for ii=length( size(data) )+1:7<br />
	fwrite(fp, 1, &#8216;int16&#8242;);<br />
end	</p>
<p>fwrite(fp, 0, &#8216;int16&#8242;);  % unused 8<br />
fwrite(fp, 0, &#8216;int16&#8242;);  % unused 9<br />
fwrite(fp, 0, &#8216;int16&#8242;);  % unused 10<br />
fwrite(fp, 0, &#8216;int16&#8242;);  % unused 11<br />
fwrite(fp, 0, &#8216;int16&#8242;);  % unused 12<br />
fwrite(fp, 0, &#8216;int16&#8242;);  % unused 13<br />
fwrite(fp, 0, &#8216;int16&#8242;);  % unused 14</p>
<p>% data type<br />
fwrite(fp, file_type, &#8216;int16&#8242;);   % 4 = signed short<br />
fwrite(fp, bpp, &#8216;int16&#8242;);   % bpp<br />
fwrite(fp, 0, &#8216;int16&#8242;);<br />
for ii=1:8<br />
	fwrite(fp, 1.0, &#8216;float32&#8242;);<br />
end<br />
fwrite(fp, 0, &#8216;float32&#8242;);<br />
fwrite(fp, 0, &#8216;float32&#8242;); % funused 1<br />
fwrite(fp, 0, &#8216;float32&#8242;); % funused 2<br />
fwrite(fp, 0, &#8216;float32&#8242;); % funused 3</p>
<p>fwrite(fp, max(data(:)), &#8216;float32&#8242;);<br />
fwrite(fp, min(data(:)), &#8216;float32&#8242;);<br />
fwrite(fp, 0, &#8216;float32&#8242;);<br />
fwrite(fp, 0, &#8216;float32&#8242;); </p>
<p>fwrite(fp, round(max(data(:))), &#8216;int32&#8242;);   % glmax<br />
fwrite(fp, round(min(data(:))), &#8216;int32&#8242;);   % glmin</p>
<p>%%<br />
%%  Data history<br />
%%<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 80), &#8216;char&#8217;); % descrip<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 24), &#8216;char&#8217;); % aux_file<br />
fwrite(fp, &#8217;3&#8242;, &#8216;char&#8217;); % aux_file<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 10), &#8216;char&#8217;); % originator<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 10), &#8216;char&#8217;); % originator<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 10), &#8216;char&#8217;); % originator<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 10), &#8216;char&#8217;); % originator<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 10), &#8216;char&#8217;); % originator<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 10), &#8216;char&#8217;); % originator<br />
fwrite(fp, repmat(&#8216; &#8216;, 1, 3), &#8216;char&#8217;); % originator</p>
<p>fwrite(fp, 0, &#8216;int32&#8242;); % views<br />
fwrite(fp, 0, &#8216;int32&#8242;); % vols_added<br />
fwrite(fp, 0, &#8216;int32&#8242;); % start_fiedl<br />
fwrite(fp, 0, &#8216;int32&#8242;); % field_skip<br />
fwrite(fp, 0, &#8216;int32&#8242;); % omax<br />
fwrite(fp, 0, &#8216;int32&#8242;); % omin<br />
fwrite(fp, 0, &#8216;int32&#8242;); % small_max<br />
fwrite(fp, 0, &#8216;int32&#8242;); % small_min</p>
<p>fclose(fp);</p>
<p>%%<br />
%%  Write the data<br />
%%<br />
fp = fopen([fname '.img'], &#8216;wb&#8217;, &#8216;b&#8217;);<br />
fwrite(fp, data, ftype);<br />
fclose(fp);<br />
[/cc]</p>
]]></content:encoded>
			<wfw:commentRss>http://mri.brechmos.org/2010/02/writeanalyze-in-matlab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

