Skip to content

Commit 1964b07

Browse files
committed
DOC: move / rewrite spm usecases doc
Move description of SPM use-cases out of "usecases" directory, rewrite for modern nibabel API.
1 parent 80956a3 commit 1964b07

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

doc/source/devel/usecases/spm_use.rst renamed to doc/source/devel/spm_use.rst

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,14 @@ their call syntax is the same for example.
9494
mat0_intent: 'MNI152'
9595
descrip: 'NIFTI-1 Image'
9696

97-
97+
9898
So, in our (provisional) terms:
9999

100-
* vol.mat == img.affine
101-
* vol.dim == img.shape
102-
* vol.dt(1) (vol.dt[0] in Python) is equivalent to img.io_dtype
103-
* vol.fname == img.filename
100+
* ``vol.mat`` == ``img.affine``
101+
* ``vol.dim`` == ``img.shape``
102+
* ``vol.dt(1)`` (``vol.dt[0]`` in Python) is equivalent to
103+
``img.get_data_dtype()``
104+
* ``vol.fname`` == ``img.get_filename()``
104105

105106
SPM abstracts the implementation of the image to the ``vol.private``
106107
member, that is not in fact required by the image interface.
@@ -126,7 +127,6 @@ Images in SPM are always 3D. Note this behavior:
126127

127128
That is, one vol struct per 3D volume in a 4D dataset.
128129

129-
130130
SPM image methods / functions
131131
=============================
132132

@@ -176,18 +176,18 @@ Creating an image from scratch, and writing plane by plane (slice by slice):
176176

177177
.. sourcecode:: matlab
178178

179-
>> new_vol = struct();
179+
>> new_vol = struct();
180180
>> new_vol.fname = 'yet_another_image.nii';
181-
>> new_vol.dim = [91 109 91];
181+
>> new_vol.dim = [91 109 91];
182182
>> new_vol.dt = [spm_type('float32') 0]; % little endian (0)
183183
>> new_vol.mat = vol.mat;
184184
>> new_vol.pinfo = [1 0 0]';
185-
>> new_vol = spm_create_vol(new_vol);
185+
>> new_vol = spm_create_vol(new_vol);
186186
>> for vox_z = 1:new_vol.dim(3)
187-
new_vol = spm_write_plane(new_vol, img_arr(:,:,vox_z), vox_z);
187+
new_vol = spm_write_plane(new_vol, img_arr(:,:,vox_z), vox_z);
188188
end
189189

190-
I think it's true that writing the plane does not change the
190+
I think it's true that writing the plane does not change the image
191191
scalefactors, so it's only practical to use ``spm_write_plane`` for data
192192
for which you already know the dynamic range across the volume.
193193

@@ -268,7 +268,6 @@ world coordinates according to the affine looks like:
268268

269269
0.6792
270270

271-
272271
Odder sampling, often used, can be difficult to understand:
273272

274273
.. sourcecode:: matlab
@@ -288,14 +287,13 @@ Odder sampling, often used, can be difficult to understand:
288287

289288
This is the simplest use - but in general any affine transform can go in
290289
``slice_mat`` above, giving optimized (for speed) sampling of slices
291-
from volumes, as long as the transform is affine.
290+
from volumes, as long as the transform is an affine.
292291

293292
Miscellaneous functions operating on vol structs:
294293

295-
* spm_conv_vol - convolves volume with seperable functions in x, y, z
296-
* spm_render_vol - does a projection of a volume onto a surface
297-
* spm_vol_check - takes array of vol structs and checks for sameness of
294+
* ``spm_conv_vol`` - convolves volume with seperable functions in x, y, z
295+
* ``spm_render_vol`` - does a projection of a volume onto a surface
296+
* ``spm_vol_check`` - takes array of vol structs and checks for sameness of
298297
image dimensions and ``mat`` (affines) across the list.
299298

300-
And then, many SPM function accept vol structs are arguments.
301-
299+
And then, many SPM functions accept vol structs as arguments.

doc/source/devel/usecases/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
:maxdepth: 2
77

88
loading_saving
9-
spm_use

0 commit comments

Comments
 (0)