diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2019-03-21 16:41:50 +0000 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2019-03-21 16:41:50 +0000 |
commit | 311a5a82e4ae5bd7bc5661c4e441458deabc17d6 (patch) | |
tree | 05d6106abcf71c3a8ce0c6963faa7d1e5a0cdbeb /Wrappers/Python | |
parent | 4f4303a5d49e8d330442c74d710b98bd14bb78c0 (diff) | |
download | framework-311a5a82e4ae5bd7bc5661c4e441458deabc17d6.tar.gz framework-311a5a82e4ae5bd7bc5661c4e441458deabc17d6.tar.bz2 framework-311a5a82e4ae5bd7bc5661c4e441458deabc17d6.tar.xz framework-311a5a82e4ae5bd7bc5661c4e441458deabc17d6.zip |
use class strings
Diffstat (limited to 'Wrappers/Python')
-rwxr-xr-x | Wrappers/Python/ccpi/framework/framework.py | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/Wrappers/Python/ccpi/framework/framework.py b/Wrappers/Python/ccpi/framework/framework.py index 3707c07..7afd2c1 100755 --- a/Wrappers/Python/ccpi/framework/framework.py +++ b/Wrappers/Python/ccpi/framework/framework.py @@ -896,32 +896,36 @@ class ImageData(DataContainer): if channels > 1: if vert > 1: shape = (channels, vert, horiz_y, horiz_x) - dim_labels = ['channel' ,'vertical' , 'horizontal_y' , - 'horizontal_x'] + dim_labels = [ImageGeometry.CHANNEL, + ImageGeometry.VERTICAL, + ImageGeometry.HORIZONTAL_Y, + ImageGeometry.HORIZONTAL_X] else: shape = (channels , horiz_y, horiz_x) - dim_labels = ['channel' , 'horizontal_y' , - 'horizontal_x'] + dim_labels = [ImageGeometry.CHANNEL, + ImageGeometry.HORIZONTAL_Y, + ImageGeometry.HORIZONTAL_X] else: if vert > 1: shape = (vert, horiz_y, horiz_x) - dim_labels = ['vertical' , 'horizontal_y' , - 'horizontal_x'] + dim_labels = [ImageGeometry.VERTICAL, + ImageGeometry.HORIZONTAL_Y, + ImageGeometry.HORIZONTAL_X] else: shape = (horiz_y, horiz_x) - dim_labels = ['horizontal_y' , - 'horizontal_x'] + dim_labels = [ImageGeometry.HORIZONTAL_Y, + ImageGeometry.HORIZONTAL_X] dimension_labels = dim_labels else: shape = [] for dim in dimension_labels: - if dim == 'channel': + if dim == ImageGeometry.CHANNEL: shape.append(channels) - elif dim == 'horizontal_y': + elif dim == ImageGeometry.HORIZONTAL_Y: shape.append(horiz_y) - elif dim == 'vertical': + elif dim == ImageGeometry.VERTICAL: shape.append(vert) - elif dim == 'horizontal_x': + elif dim == ImageGeometry.HORIZONTAL_X: shape.append(horiz_x) if len(shape) != len(dimension_labels): raise ValueError('Missing {0} axes'.format( @@ -956,14 +960,17 @@ class ImageData(DataContainer): if dimension_labels is None: if array.ndim == 4: - dimension_labels = ['channel' ,'vertical' , 'horizontal_y' , - 'horizontal_x'] + dimension_labels = [ImageGeometry.CHANNEL, + ImageGeometry.VERTICAL, + ImageGeometry.HORIZONTAL_Y, + ImageGeometry.HORIZONTAL_X] elif array.ndim == 3: - dimension_labels = ['vertical' , 'horizontal_y' , - 'horizontal_x'] + dimension_labels = [ImageGeometry.VERTICAL, + ImageGeometry.HORIZONTAL_Y, + ImageGeometry.HORIZONTAL_X] else: - dimension_labels = ['horizontal_y' , - 'horizontal_x'] + dimension_labels = [ ImageGeometry.HORIZONTAL_Y, + ImageGeometry.HORIZONTAL_X] #DataContainer.__init__(self, array, deep_copy, dimension_labels, **kwargs) super(ImageData, self).__init__(array, deep_copy, @@ -979,6 +986,10 @@ class ImageData(DataContainer): self.spacing = value def subset(self, dimensions=None, **kw): + # FIXME: this is clearly not rigth + # it should be something like + # out = DataContainer.subset(self, dimensions, **kw) + # followed by regeneration of the proper geometry. out = super(ImageData, self).subset(dimensions, **kw) #out.geometry = self.recalculate_geometry(dimensions , **kw) out.geometry = self.geometry |