Skip to content

Commit bf53484

Browse files
committed
Merge branch 'doc-pre-release' into main-master
* doc-pre-release: (32 commits) RF: use long_description for README.rst DOC: proof reading corrections for nifti images DOC: fix see also sections for get/set q/s form DOC: correct form of Raises section DOC: clean up class and some function docstrings DOC: small rewrites / fix broken link DOC: warn about pending deprecation of data pkgs DOC: move image signature discussion up a level DOC: move / rewrite spm usecases doc DOC: remove filenames usecase document DOC: move io implementation doc to old stuff DOC: update data pkg doc for implementation RF: install sphinx in tests block DOC: document adding an image format DOC: page on adding / using test data DOC: add neuro / radio doc to tutorials RF: always close figures before plot directive DOC: add image orientation page DOC: add tutorials section DOC: add document on nifti format ... Conflicts: README.rst
2 parents adb15a3 + 7ace0af commit bf53484

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1233
-756
lines changed

.travis.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ matrix:
2626
- python: 2.7
2727
env:
2828
- DEPENDS="numpy==1.5.1 pydicom==0.9.7"
29+
# Documentation doctests
30+
- python: 2.7
31+
env:
32+
- DOC_DOC_TEST=1
2933
before_install:
3034
- virtualenv --python=python venv
3135
- source venv/bin/activate
@@ -59,6 +63,13 @@ script:
5963
cp ../.coveragerc .;
6064
COVER_ARGS="--with-coverage --cover-package nibabel";
6165
fi
62-
- nosetests --with-doctest $COVER_ARGS nibabel
66+
- if [ "$DOC_DOC_TEST" == "1" ]; then
67+
pip install sphinx;
68+
cd ../doc;
69+
make html;
70+
make doctest;
71+
else
72+
nosetests --with-doctest $COVER_ARGS nibabel;
73+
fi
6374
after_success:
6475
- if [ "${COVERAGE}" == "1" ]; then coveralls; fi

Changelog

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ NiBabel Development Changelog
99
NiBabel is the successor to the much-loved PyNifti package. Here we list the
1010
releases for both packages.
1111

12-
'Close gh-' statements refer to GitHub issues that are available at::
13-
14-
http://github.com/nipy/nibabel/issues
15-
1612
The full VCS changelog is available here:
1713

1814
http://github.com/nipy/nibabel/commits/master
@@ -23,8 +19,8 @@ Releases
2319
NiBabel
2420
+++++++
2521

26-
Most work on NiBabel so far has been by Matthew Brett (MB) and Michael Hanke
27-
(MH) and Stephan Gerhard (SG).
22+
Most work on NiBabel so far has been by Matthew Brett (MB), Michael Hanke (MH)
23+
and Stephan Gerhard (SG).
2824

2925
* 2.0.0 (soon)
3026

@@ -33,30 +29,35 @@ Most work on NiBabel so far has been by Matthew Brett (MB) and Michael Hanke
3329

3430
* New feature, bugfix release with minor API breakage;
3531
* Minor API breakage: default write of NIfTI / Analyze image data offset
36-
value changed from keeping the value as read from file, to shrinking the
37-
offset the minimum necessary to make room for the header and any
38-
extensions;
39-
* Minor API breakage: data scaling in NIfTI / Analyze now set to NaN when
40-
reading images. To read the original data scaling you need to look at the
41-
``slope`` and ``inter`` properties of the image ``dataobj`` attribute;
42-
* Minor API breakage: image data offset in NIfTI / Analyze now set to zero
43-
when reading images. TO read the original data offset use the ``offset``
32+
value. The data offset is the number of bytes from the beginning of file
33+
to skip before reading the image data. Nibabel behavior changed from
34+
keeping the value as read from file, to setting the offset to zero on
35+
read, and setting the offset when writing the header. The value of the
36+
offset will now be the minimum value necessary to make room for the header
37+
and any extensions when writing the file. You can override the default
38+
offset by setting value explicitly to some value other than zero. To read
39+
the original data offset as read from the header, use the ``offset``
4440
property of the image ``dataobj`` attribute;
41+
* Minor API breakage: data scaling in NIfTI / Analyze now set to NaN when
42+
reading images. Data scaling refers to the data intercept and slope
43+
values in the NIfTI / Analyze header. To read the original data scaling
44+
you need to look at the ``slope`` and ``inter`` properties of the image
45+
``dataobj`` attribute. You can set scaling explicitly by setting the
46+
slope and intercept values in the header to values other than NaN;
4547
* New API for managing image caching; images have an ``in_memory`` property
4648
that is true if the image data has been loaded into cache, or is already
4749
an array in memory; ``get_data`` has new keyword argument ``caching`` to
4850
specify whether the cache should be filled by ``get_data``;
49-
* Images now have properties ``dataobj``, ``affine``, ``header``; we will
51+
* Images now have properties ``dataobj``, ``affine``, ``header``. We will
5052
slowly phase out the ``get_affine`` and ``get_header`` image methods;
5153
* The image ``dataobj`` can be sliced using an efficient algorithm to avoid
52-
reading unneccesary data from disk. This makes it possible to do very
54+
reading unnecessary data from disk. This makes it possible to do very
5355
efficient reads of single volumes from a time series;
54-
* You can now set NIfTI / Analyze data scaling explicitly to force this
55-
scaling to be written into the header;
5656
* NIfTI2 read / write support;
5757
* Read support for MINC2;
58-
* Much extended read support for PAR / REC, largely due to the work of Eric
59-
Larson and Gregory R. Lee giving new code, advice and code review;
58+
* Much extended read support for PAR / REC, largely due to work from Eric
59+
Larson and Gregory R. Lee on new code, advice and code review. Thanks also
60+
to Jeff Stevenson and Bennett Landman for helpful discussion;
6061
* ``parrec2nii`` script outputs images in LAS voxel orientation, which
6162
appears to be necessary for compatibility with FSL ``dtifit`` /
6263
``fslview`` diffusion analysis pipeline;
@@ -65,19 +66,19 @@ Most work on NiBabel so far has been by Matthew Brett (MB) and Michael Hanke
6566
* New function to save Freesurfer annotation files (by Github user ohinds);
6667
* Method to return MGH format ``vox2ras_tkr`` affine (Eric Larson);
6768
* A new API for reading unscaled data from NIfTI and other images, using
68-
``img.dataobj.get_unscaled()``; deprecate previous way of doing this with
69-
``read_img_data`` function;
70-
* Bug fix replacing NaN values with zero when writing floating point data as
71-
integers. If the input floating point data range did not include zero,
72-
then NaN would not get written to a value corresponding to zero in the
73-
output;
69+
``img.dataobj.get_unscaled()``. Deprecate previous way of doing this,
70+
which was to read data with the ``read_img_data`` function;
71+
* Fix for bug when replacing NaN values with zero when writing floating
72+
point data as integers. If the input floating point data range did not
73+
include zero, then NaN would not get written to a value corresponding to
74+
zero in the output;
7475
* Improvements and bug fixes to image orientation calculation and DICOM
7576
wrappers by Brendan Moloney;
76-
* Bug fix writing GIfTI files with base64 encoding that didn't match the
77-
spec, and the wrong field name for the endian code. Thanks to Basile
78-
Pinsard and Russ Poldrack for diagnosis and fixes;
79-
* Bug fix in freesurfer.read_annot with orig_ids=False when annot contains
80-
vertices with no label (Alexandre Gramfort);
77+
* Bug fixes writing GIfTI files. We were using a base64 encoding that didn't
78+
match the spec, and the wrong field name for the endian code. Thanks to
79+
Basile Pinsard and Russ Poldrack for diagnosis and fixes;
80+
* Bug fix in ``freesurfer.read_annot`` with ``orig_ids=False`` when annot
81+
contains vertices with no label (Alexandre Gramfort);
8182
* More tutorials in the documentation, including introductory tutorial on
8283
DICOM, and on coordinate systems;
8384
* Lots of code refactoring, including moving to common code-base for Python

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,5 +281,8 @@ tox-stale:
281281
# installed)
282282
tox -e python25,python26,python27,python32,np-1.2.1
283283

284+
refresh-readme:
285+
$(PYTHON) tools/refresh_readme.py
286+
284287
.PHONY: orig-src pylint
285288

README.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
.. -*- rest -*-
2-
.. vim:syntax=rest
2+
.. vim:syntax=rst
33
4-
|Coveralls|_
5-
6-
.. |Coveralls| image:: https://coveralls.io/repos/nipy/nibabel/badge.png?branch=master
7-
.. _Coveralls: https://coveralls.io/r/nipy/nibabel?branch=master
4+
.. image:: https://coveralls.io/repos/nipy/nibabel/badge.png?branch=master
5+
:target: https://coveralls.io/r/nipy/nibabel?branch=master
86

7+
.. Following contents should be from LONG_DESCRIPTION in nibabel/info.py
98
109
=======
1110
NiBabel

doc/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ api-stamp:
4343
@echo "Build API docs...done."
4444
@touch $@
4545

46-
html: api-stamp
46+
html-only:
4747
mkdir -p $(BUILDROOT)/html $(BUILDROOT)/doctrees
4848
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDROOT)/html
4949
@echo
5050
@echo "Build finished. The HTML pages are in $(BUILDROOT)/html."
5151

52+
html: api-stamp html-only
53+
5254
pickle:
5355
mkdir -p $(BUILDROOT)/pickle $(BUILDROOT)/doctrees
5456
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDROOT)/pickle
@@ -87,7 +89,7 @@ linkcheck:
8789
@echo "Link check complete; look for any errors in the above output " \
8890
"or in $(BUILDROOT)/linkcheck/output.txt."
8991

90-
doctest:
92+
doctest: api-clean
9193
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDROOT)/doctest
9294
@echo "Testing of doctests in the sources finished, look at the " \
9395
"results in _build/doctest/output.txt."

doc/downloads

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source/downloads

doc/source/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.rst diff merge crlf

doc/source/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_long_description.inc

doc/source/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
rel = {}
3535
execfile('../../nibabel/info.py', rel)
3636

37+
# Write long description from info
38+
with open('_long_description.inc', 'wt') as fobj:
39+
fobj.write(rel['LONG_DESCRIPTION'])
40+
3741
# Add any Sphinx extension module names here, as strings. They can be extensions
3842
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
3943
extensions = ['sphinx.ext.autodoc',

doc/source/coordinate_systems.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ the array.
6060
We collected an anatomical image in the same session. We can load that image
6161
and look at slices in the three axes:
6262

63-
.. plot::
64-
:nofigs:
65-
:include-source: false
66-
67-
# This guy just closes the previous figure so we don't get it twice
68-
plt.close('all')
69-
7063
.. plot::
7164
:context:
7265

0 commit comments

Comments
 (0)