• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nipy / nibabel / 30
93%

Build:
DEFAULT BRANCH: master
Ran 09 Dec 2013 05:10PM UTC
Jobs 1
Files 128
Run time –
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
30

push

travis-ci

matthew-brett
Merge pull request #213 from matthew-brett/zero-offset-on-load

MRG: reset file offset to zero creating image

This is a minor API break.

Before this PR, you would read an image, and the header would contain the data
offset value. For single file images, the data offset would typically point to
the end of the header, but it's also possible to have data at the beginning of
a file that is not part of the image. So the 'offset' field would be non-zero -
say 400.

When using this header to write out an image, or initialize a new image, the
offset field gets maintained - so the newly written image, and any image based
on the same header, also have an offset of e.g. 400.

This doesn't make much sense usually - because - if we save images to
filenames, we open 'wb' and write the whole file, so even if an existing output
image file had something interesting from 0-400, it would get overwritten with
zeros in the default write process.

The only time this doesn't happen is if you open the file object in append mode
and pass that into the image creation - but this is obviously rather rare.

This PR sets the offset to 0 in the header each time we create a new image or
load an image. The 0 signifies 'modify at will' to the code. The writing code
then sets the offset to whatever value is necessary.

If you really want to set the offset to a specific value, you can do that by
hand with:

img.header.set_data_offset(400)

in which case the writing code uses that offset, or raises an error if the
offset is too low.

This PR addresses : #105

13716 of 15188 relevant lines covered (90.31%)

0.9 hits per line

Jobs
ID Job ID Ran Files Coverage
4 30.4 (COVERAGE=--with-coverage) 09 Dec 2013 05:10PM UTC 0
90.31
Travis Job 30.4
Source Files on build 30
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #30
  • d9482eeb on github
  • Prev Build on master (#28)
  • Next Build on master (#34)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc