-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathday2.html
More file actions
237 lines (225 loc) · 12.3 KB
/
day2.html
File metadata and controls
237 lines (225 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!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>Course on Practical Neuroimaging in Python — Practical neuroimaging analysis</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</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="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="author" title="About these documents" href="about.html" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Day 3: version control / diagnostics" href="day3.html" />
<link rel="prev" title="Day 1 : introducing Python" href="day1.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<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="day3.html" title="Day 3: version control / diagnostics"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="day1.html" title="Day 1 : introducing Python"
accesskey="P">previous</a> |</li>
<big><big><big><li><a href="index.html">Home</a> | </li>
<li><a href="https://github.com/practical-neuroimaging/pna2015">Exercises</a> | </li>
<li><a href="https://calmail.berkeley.edu/manage/list/listinfo/practical_fmri@lists.berkeley.edu">Mailing list</a> | </li></big></big></big>
<li class="nav-item nav-item-1"><a href="schedule.html" accesskey="U">Schedule</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="day-2-images-as-arrays-and-plotting">
<h1>Day 2: images as arrays and plotting<a class="headerlink" href="#day-2-images-as-arrays-and-plotting" title="Permalink to this headline">¶</a></h1>
<p>2 / 27 / 2015</p>
<div class="section" id="prior">
<h2>Prior<a class="headerlink" href="#prior" title="Permalink to this headline">¶</a></h2>
<p>These two tutorial pages are from the <a class="reference external" href="http://scipy-lectures.github.io">scipy lecture notes</a>:</p>
<ul class="simple">
<li>The <a class="reference external" href="http://scipy-lectures.github.io/intro/numpy/array_object.html">numpy array object</a></li>
<li><a class="reference external" href="http://scipy-lectures.github.io/intro/numpy/operations.html">Array operations</a></li>
</ul>
</div>
<div class="section" id="day">
<h2>Day<a class="headerlink" href="#day" title="Permalink to this headline">¶</a></h2>
<div class="section" id="installing-scikit-image">
<h3>Installing scikit-image<a class="headerlink" href="#installing-scikit-image" title="Permalink to this headline">¶</a></h3>
<p>You might want to install scikit-image – the image processing toolkit for
Python. You will need it for the last (and optional) part of the last
exercise today.</p>
<ul>
<li><p class="first">If you have Anaconda, the package is already installed;</p>
</li>
<li><p class="first">If you have Python(X,Y) on Windows, download and run
<a class="reference external" href="http://nipy.bic.berkeley.edu/pna/archives/scikits.image-0.10.1-7_py27.exe">http://nipy.bic.berkeley.edu/pna/archives/scikits.image-0.10.1-7_py27.exe</a>;</p>
</li>
<li><p class="first">If you have OSX, and do not have Anaconda (for example, if you followed the
instructions for OSX install for this class) then:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">U</span> <span class="n">scikit</span><span class="o">-</span><span class="n">image</span>
</pre></div>
</div>
</li>
<li><p class="first">If you have Linux, first – ask your friendly instructor, because Linux
systems differ more from each other than OSX and Windows. If we aren’t
around for some reason, then:</p>
<blockquote>
<div><ul>
<li><p class="first">If you are on Ubuntu or Debian 64-bit, try:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">index</span> <span class="o">-</span><span class="n">f</span> <span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">travis</span><span class="o">-</span><span class="n">wheels</span><span class="o">.</span><span class="n">scikit</span><span class="o">-</span><span class="n">image</span><span class="o">.</span><span class="n">org</span> <span class="n">scikit</span><span class="o">-</span><span class="n">image</span>
</pre></div>
</div>
</li>
<li><p class="first">Otherwise, or if that doesn’t work:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">U</span> <span class="n">six</span>
<span class="n">sudo</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">U</span> <span class="n">scikit</span><span class="o">-</span><span class="n">image</span>
</pre></div>
</div>
</li>
</ul>
</div></blockquote>
<p>As usual, if you have any problems, we are very happy to help.</p>
</li>
</ul>
</div>
<div class="section" id="introduction-to-day-2">
<h3>Introduction to day 2<a class="headerlink" href="#introduction-to-day-2" title="Permalink to this headline">¶</a></h3>
<div class="section" id="to-get-started">
<h4>To get started<a class="headerlink" href="#to-get-started" title="Permalink to this headline">¶</a></h4>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">pna2015</span>
<span class="n">git</span> <span class="n">pull</span>
<span class="n">cd</span> <span class="n">day2</span>
<span class="n">ipython</span> <span class="n">notebook</span>
</pre></div>
</div>
</div>
<div class="section" id="some-new-python-stuff">
<h4>Some new Python stuff<a class="headerlink" href="#some-new-python-stuff" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Tuples are immutable lists;</li>
<li>Mutable and immutable in Python;</li>
<li>Making a tuple with a single element;</li>
<li>List comprehensions are short-cut for loops.</li>
</ul>
</div>
<div class="section" id="revision-from-homework">
<h4>Revision from homework<a class="headerlink" href="#revision-from-homework" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Numpy is a package (and a module);</li>
<li>Getting help with dot <tab> in IPython and <code class="docutils literal"><span class="pre">np.lookfor</span></code>;</li>
<li>Matplotlib is a package (and a module);</li>
<li>Showing an array as an image with <cite>imshow</cite>;</li>
<li>Plotting a line from an array with <cite>plot</cite>;</li>
<li>Slicing arrays;</li>
<li>Indexing arrays with masks;</li>
<li>Numerical operations in numpy;</li>
<li><code class="docutils literal"><span class="pre">+</span> <span class="pre">-</span> <span class="pre">*</span> <span class="pre">/</span> <span class="pre">==</span> <span class="pre">!=</span> <span class="pre">></span> <span class="pre"><</span> <span class="pre">>=</span> <span class="pre"><=</span></code> are always elementwise;</li>
<li>Transpose</li>
<li>Reshape</li>
</ul>
</div>
<div class="section" id="some-useful-background-resources">
<h4>Some useful background resources<a class="headerlink" href="#some-useful-background-resources" title="Permalink to this headline">¶</a></h4>
<p>There is a web page listing of the day 2 exercise files at
<a class="reference external" href="https://github.com/practical-neuroimaging/pna2015/tree/master/day2">https://github.com/practical-neuroimaging/pna2015/tree/master/day2</a></p>
<ul class="simple">
<li>What is an image? e.g.
<a class="reference external" href="http://nbviewer.ipython.org/urls/bitbucket.org/matthewbrett/talks/raw/master/processing_i/what_is_an_image.ipynb">http://nbviewer.ipython.org/urls/bitbucket.org/matthewbrett/talks/raw/master/processing_i/what_is_an_image.ipynb</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Day 2: images as arrays and plotting</a><ul>
<li><a class="reference internal" href="#prior">Prior</a></li>
<li><a class="reference internal" href="#day">Day</a><ul>
<li><a class="reference internal" href="#installing-scikit-image">Installing scikit-image</a></li>
<li><a class="reference internal" href="#introduction-to-day-2">Introduction to day 2</a><ul>
<li><a class="reference internal" href="#to-get-started">To get started</a></li>
<li><a class="reference internal" href="#some-new-python-stuff">Some new Python stuff</a></li>
<li><a class="reference internal" href="#revision-from-homework">Revision from homework</a></li>
<li><a class="reference internal" href="#some-useful-background-resources">Some useful background resources</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="day1.html"
title="previous chapter">Day 1 : introducing Python</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="day3.html"
title="next chapter">Day 3: version control / diagnostics</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/day2.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<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="day3.html" title="Day 3: version control / diagnostics"
>next</a> |</li>
<li class="right" >
<a href="day1.html" title="Day 1 : introducing Python"
>previous</a> |</li>
<big><big><big><li><a href="index.html">Home</a> | </li>
<li><a href="https://github.com/practical-neuroimaging/pna2015">Exercises</a> | </li>
<li><a href="https://calmail.berkeley.edu/manage/list/listinfo/practical_fmri@lists.berkeley.edu">Mailing list</a> | </li></big></big></big>
<li class="nav-item nav-item-1"><a href="schedule.html" >Schedule</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2013-2015, Matthew Brett and J-B Poline.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.5.1.
</div>
</body>
</html>