Skip to main content


Project description

h1. pfile-tools: GE P-File Utilities

This package provides a library refrence to GE's proprietary P-file format for their MR scanners. This is not a translation of their copyrighted header files, but a re-implementation. It's designed to let you catalog and anonymize your raw data, and hopefully provide enough information to run your own reconstruction.

In addition to the library, pfile-tools provides small scripts to display pfile header values and do an anomymization.

h2. Status

Header support is limited to stuff we've needed in-house or stuff that's really obvious. If you need something added, let me know.

Also, we currently only support reading revision 20 of the files. I suspect that it'll also effectively work on other revisions (particularly 22), but I don't know for sure which. Let me know!

h2. Installation

$ easy_install pfile_tools
$ cd pfile-tools
$ python install

Installation via easy_install and pip is coming.

h2. API Usage

>>> from pfile_tools import headers
>>> pfile = headers.Pfile.from_file('/path/to/PXXXX.7')
>>> print(pfile.revision)
>>> print(pfile.header.exam_number)
>>> print(pfile.header.exam_datetime)
datetime(2012, 3, 6, 10, 47, 42)

Pfile.header is a Python "ctypes Structure":

h2. dump_pfile_header

Does what it says on the tin -- dumps a p-file's header to standard out, in a delimited (by default, tab-delimited) format.

Usage: dump_pfile_header [OPTIONS] pfile

Dumps header information from a GE P-file

-h, --help show this help message and exit
-r REVISION, --revision=REVISION
Force a header revision (available: 20)
--offsets Show offsets to data elements
--sizes Show data element sizes
--show-padding Print unknown 'padding' elements
Output field separator (default: \t)

h2. anonymize_pfile

Strips personally-identifying information from a p-file.

Usage: [OPTIONS] pfile pfile_out

Removes personally-identifying information from a GE P-file

-h, --help show this help message and exit
-r REVISION, --revision=REVISION
Force a header revision (available: 20)
--inplace Edit file in-place. Ignores pfile_out.
-v, --verbose Print lots of extra debugging.

Anonymization options:
--name=yes/no Set patient name to 'ANONYMIZED' (yes)
--id=yes/no Set patient ID to 'ANONYMIZED' (yes)
Set date of birth to '' (yes)
--age=yes/no Set age to 0 (yes)
--weight=yes/no Set weight to 0 (yes)
--sex=yes/no Set sex to 0 (yes)

h2. License

pfile_tools is provided under the short-and-sweet BSD license. See LICENSE.txt for more information.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pfile-tools-0.1.1dev2.tar.gz (7.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page