From 2f670853b4a0fda2f636cc2c41c905d787edffe9 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 22 Mar 2012 13:23:11 -0400 Subject: [PATCH] Add ecat to the list of known imageclasses to ease loading with .load() --- nibabel/imageclasses.py | 14 +++++++++++--- nibabel/loadsave.py | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/nibabel/imageclasses.py b/nibabel/imageclasses.py index ce62cd2a13..f10c416f33 100644 --- a/nibabel/imageclasses.py +++ b/nibabel/imageclasses.py @@ -14,6 +14,7 @@ from .minc import MincImage from .freesurfer import MGHImage from .volumeutils import Recoder +from .ecat import EcatImage # If we don't have scipy, then we cannot write SPM format files try: @@ -52,11 +53,16 @@ 'mgh':{'class': MGHImage, 'ext': '.mgh', 'has_affine': True, - 'rw':True}, + 'rw': True}, 'mgz':{'class': MGHImage, 'ext': '.mgz', 'has_affine': True, - 'rw':True}} + 'rw': True}, + 'ecat':{'class': EcatImage, + 'ext': '.v', + 'has_affine': True, + 'rw': False}, + } @@ -66,4 +72,6 @@ ('nifti_pair', '.img', '.hdr'), ('minc', '.mnc'), ('mgh', '.mgh'), - ('mgz', '.mgz'))) + ('mgz', '.mgz'), + ('ecat', '.v'), + )) diff --git a/nibabel/loadsave.py b/nibabel/loadsave.py index a9c8f3e9b8..43af7444e9 100644 --- a/nibabel/loadsave.py +++ b/nibabel/loadsave.py @@ -37,7 +37,7 @@ def load(filename): except KeyError: raise ImageFileError('Cannot work out file type of "%s"' % filename) - if ext in ('.nii', '.mnc', '.mgh', '.mgz'): + if ext in ('.nii', '.mnc', '.mgh', '.mgz', '.v'): klass = class_map[img_type]['class'] else: # might be nifti pair or analyze of some sort