Esempio n. 1
0
def subtract_op(vol1,
                vol2,
                onGrid=None,
                boundingGrid=False,
                subregion='all',
                step=1,
                gridSubregion='all',
                gridStep=1,
                inPlace=False,
                scaleFactors=None,
                minRMS=False,
                modelId=None):

    vol1 = filter_volumes(vol1)
    vol2 = filter_volumes(vol2)
    if len(vol1) != 1 or len(vol2) != 1:
        raise CommandError, 'vop subtract operation requires exactly two volumes'
    if minRMS and scaleFactors:
        raise CommandError, 'vop subtract cannot specify both minRMS and scaleFactors options.'
    if minRMS:
        mult = (1, 'minrms')
    elif scaleFactors:
        m0, m1 = parse_floats(scaleFactors, 'scaleFactors', 2)
        mult = (m0, -m1)
    else:
        mult = (1, -1)

    add_op(vol1 + vol2, onGrid, boundingGrid, subregion, step, gridSubregion,
           gridStep, inPlace, mult, modelId)
Esempio n. 2
0
def add_op(volumes,
           onGrid=None,
           boundingGrid=None,
           subregion='all',
           step=1,
           gridSubregion='all',
           gridStep=1,
           inPlace=False,
           scaleFactors=None,
           modelId=None):

    volumes = filter_volumes(volumes)
    if boundingGrid is None and not inPlace:
        boundingGrid = (onGrid is None)
    if onGrid is None:
        onGrid = volumes[:1]
    onGrid = filter_volumes(onGrid, 'onGrid')
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    gridSubregion = parse_subregion(gridSubregion, 'gridSubregion')
    gridStep = parse_step(gridStep, 'gridStep')
    if inPlace:
        if boundingGrid or gridStep != 1 or gridSubregion != 'all':
            raise CommandError, "Can't use inPlace option with boundingGrid or gridStep or gridSubregion options"
        for gv in onGrid:
            if not gv.data.writable:
                raise CommandError, "Can't modify volume in place: %s" % gv.name
            if not gv in volumes:
                raise CommandError, "Can't change grid in place"
    if isinstance(scaleFactors, basestring):
        scaleFactors = parse_floats(scaleFactors, 'scaleFactors', len(volumes))
    modelId = parse_model_id(modelId)
    for gv in onGrid:
        add_operation(volumes, subregion, step, gv, gridSubregion, gridStep,
                      boundingGrid, inPlace, scaleFactors, modelId)
Esempio n. 3
0
def add_op(volumes, onGrid = None, boundingGrid = None,
           subregion = 'all', step = 1,
           gridSubregion = 'all', gridStep = 1,
           inPlace = False, scaleFactors = None, modelId = None):

    volumes = filter_volumes(volumes)
    if boundingGrid is None and not inPlace:
        boundingGrid = (onGrid is None)
    if onGrid is None:
        onGrid = volumes[:1]
    onGrid = filter_volumes(onGrid, 'onGrid')
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    gridSubregion = parse_subregion(gridSubregion, 'gridSubregion')
    gridStep = parse_step(gridStep, 'gridStep')
    if inPlace:
        if boundingGrid or gridStep != 1 or gridSubregion != 'all':
            raise CommandError, "Can't use inPlace option with boundingGrid or gridStep or gridSubregion options"
        for gv in onGrid:
            if not gv.data.writable:
                raise CommandError, "Can't modify volume in place: %s" % gv.name
            if not gv in volumes:
                raise CommandError, "Can't change grid in place"
    if isinstance(scaleFactors, basestring):
        scaleFactors = parse_floats(scaleFactors, 'scaleFactors', len(volumes))
    modelId = parse_model_id(modelId)
    for gv in onGrid:
        add_operation(volumes, subregion, step,
                      gv, gridSubregion, gridStep,
                      boundingGrid, inPlace, scaleFactors, modelId)
Esempio n. 4
0
def cover_op(volumes, atomBox = None, pad = 5.0, 
             box = None, x = None, y = None, z = None,
             fBox = None, fx = None, fy = None, fz = None,
             iBox = None, ix = None, iy = None, iz = None,
             step = 1, modelId = None):

    volumes = filter_volumes(volumes)
    check_number(pad, 'pad')

    if not atomBox is None and len(atomBox) == 0:
        raise CommandError, 'No atoms specified'
    box = parse_box(box, x, y, z, 'box', 'x', 'y', 'z')
    fBox = parse_box(fBox, fx, fy, fz, 'fBox', 'fx', 'fy', 'fz')
    iBox = parse_box(iBox, ix, iy, iz, 'iBox', 'ix', 'iy', 'iz')
    bc = len([b for b in (box, fBox, iBox, atomBox) if b])
    if bc == 0:
        raise CommandError, 'Must specify box to cover'
    if bc > 1:
        raise CommandError, 'Specify covering box in one way'

    step = parse_step(step, require_3_tuple = True)
    modelId = parse_model_id(modelId)

    from VolumeViewer import volume, volume_from_grid_data
    for v in volumes:
        g = v.grid_data(subregion = 'all', step = step, mask_zone = False)
        ijk_min, ijk_max = cover_box_bounds(v, step,
                                            atomBox, pad, box, fBox, iBox)
        cg = volume.map_from_periodic_map(g, ijk_min, ijk_max)
        cv = volume_from_grid_data(cg, model_id = modelId)
        cv.copy_settings_from(v, copy_region = False)
        cv.show()
Esempio n. 5
0
def scale_op(volumes,
             shift=0,
             factor=1,
             type=None,
             subregion='all',
             step=1,
             modelId=None):

    volumes = filter_volumes(volumes)
    check_number(shift, 'shift')
    check_number(factor, 'factor')
    if not type is None:
        import numpy as n
        types = {
            'int8': n.int8,
            'uint8': n.uint8,
            'int16': n.int16,
            'uint16': n.uint16,
            'int32': n.int32,
            'uint32': n.uint32,
            'float32': n.float32,
            'float64': n.float64,
        }
        if type in types:
            type = types[type]
        else:
            raise CommandError, ('Unknown data value type "%s", use %s' %
                                 (type, ', '.join(types.keys())))
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from scale import scaled_volume
    for v in volumes:
        scaled_volume(v, factor, shift, type, step, subregion, modelId)
Esempio n. 6
0
def morph_op(volumes, frames = 25, start = 0, playStep = 0.04,
             playDirection = 1, playRange = None, addMode = False,
             constantVolume = False, scaleFactors = None,
             hideOriginalMaps = True, subregion = 'all', step = 1,
             modelId = None):

    volumes = filter_volumes(volumes)
    check_number(frames, 'frames', int, nonnegative = True)
    check_number(start, 'start')
    check_number(playStep, 'playStep', nonnegative = True)
    if playRange is None:
        if addMode:
            prange = (-1.0,1.0)
        else:
            prange = (0.0,1.0)
    else:
        prange = parse_floats(playRange, 'playRange', 2)
    check_number(playDirection, 'playDirection')
    sfactors = parse_floats(scaleFactors, 'scaleFactors', len(volumes))
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)
    vs = [tuple(v.matrix_size(step = step, subregion = subregion))
          for v in volumes]
    if len(set(vs)) > 1:
        sizes = ' and '.join([str(s) for s in vs])
        raise CommandError, "Volume grid sizes don't match: %s" % sizes
    from MorphMap import morph_maps
    morph_maps(volumes, frames, start, playStep, playDirection, prange,
               addMode, constantVolume, sfactors,
               hideOriginalMaps, subregion, step, modelId)
Esempio n. 7
0
def scale_op(volumes, shift = 0, factor = 1, type = None,
              subregion = 'all', step = 1, modelId = None):

    volumes = filter_volumes(volumes)
    check_number(shift, 'shift')
    check_number(factor, 'factor')
    if not type is None:
        import numpy as n
        types = {'int8': n.int8,
                 'uint8': n.uint8,
                 'int16': n.int16,
                 'uint16': n.uint16,
                 'int32': n.int32,
                 'uint32': n.uint32,
                 'float32': n.float32,
                 'float64': n.float64,
                 }
        if type in types:
            type = types[type]
        else:
            raise CommandError, ('Unknown data value type "%s", use %s'
                                 % (type, ', '.join(types.keys())))
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from scale import scaled_volume
    for v in volumes:
        scaled_volume(v, factor, shift, type, step, subregion, modelId)
Esempio n. 8
0
def laplacian_op(volumes, subregion = 'all', step = 1, modelId = None):

    volumes = filter_volumes(volumes)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)
    
    from laplace import laplacian
    for v in volumes:
        laplacian(v, step, subregion, modelId)
Esempio n. 9
0
def z_flip_op(volumes, subregion='all', step=1, inPlace=False, modelId=None):

    volumes = filter_volumes(volumes)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    check_in_place(inPlace, volumes[:1])
    modelId = parse_model_id(modelId)

    for v in volumes:
        zflip_operation(v, subregion, step, inPlace, modelId)
Esempio n. 10
0
def fourier_op(volumes, subregion='all', step=1, modelId=None):

    volumes = filter_volumes(volumes)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from fourier import fourier_transform
    for v in volumes:
        fourier_transform(v, step, subregion, modelId)
Esempio n. 11
0
def fourier_op(volumes, subregion = 'all', step = 1, modelId = None):

    volumes = filter_volumes(volumes)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from fourier import fourier_transform
    for v in volumes:
        fourier_transform(v, step, subregion, modelId)
Esempio n. 12
0
def resample_op(volumes, onGrid = None, boundingGrid = False,
                subregion = 'all', step = 1,
                gridSubregion = 'all', gridStep = 1,
                modelId = None):

    volumes = filter_volumes(volumes)
    if onGrid is None:
        raise CommandError, 'Resample operation must specify onGrid option'
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    gridSubregion = parse_subregion(gridSubregion, 'gridSubregion')
    gridStep = parse_step(gridStep, 'gridStep')
    onGrid = filter_volumes(onGrid, 'onGrid')
    modelId = parse_model_id(modelId)
    for v in volumes:
        for gv in onGrid:
            add_operation([v], subregion, step,
                          gv, gridSubregion, gridStep,
                          boundingGrid, False, None, modelId)
Esempio n. 13
0
def laplacian_op(volumes, subregion='all', step=1, modelId=None):

    volumes = filter_volumes(volumes)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from laplace import laplacian
    for v in volumes:
        laplacian(v, step, subregion, modelId)
Esempio n. 14
0
def z_flip_op(volumes, subregion = 'all', step = 1,
              inPlace = False, modelId = None):

    volumes = filter_volumes(volumes)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    check_in_place(inPlace, volumes[:1])
    modelId = parse_model_id(modelId)

    for v in volumes:
        zflip_operation(v, subregion, step, inPlace, modelId)
Esempio n. 15
0
def gaussian_op(volumes, sDev=1.0, subregion='all', step=1, modelId=None):

    volumes = filter_volumes(volumes)
    check_number(sDev, 'sDev', positive=True)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from gaussian import gaussian_convolve
    for v in volumes:
        gaussian_convolve(v, sDev, step, subregion, modelId)
Esempio n. 16
0
def gaussian_op(volumes, sDev = 1.0,
                subregion = 'all', step = 1, modelId = None):

    volumes = filter_volumes(volumes)
    check_number(sDev, 'sDev', positive = True)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from gaussian import gaussian_convolve
    for v in volumes:
        gaussian_convolve(v, sDev, step, subregion, modelId)
Esempio n. 17
0
def resample_op(volumes,
                onGrid=None,
                boundingGrid=False,
                subregion='all',
                step=1,
                gridSubregion='all',
                gridStep=1,
                modelId=None):

    volumes = filter_volumes(volumes)
    if onGrid is None:
        raise CommandError, 'Resample operation must specify onGrid option'
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    gridSubregion = parse_subregion(gridSubregion, 'gridSubregion')
    gridStep = parse_step(gridStep, 'gridStep')
    onGrid = filter_volumes(onGrid, 'onGrid')
    modelId = parse_model_id(modelId)
    for v in volumes:
        for gv in onGrid:
            add_operation([v], subregion, step, gv, gridSubregion, gridStep,
                          boundingGrid, False, None, modelId)
Esempio n. 18
0
def subtract_op(vol1, vol2, onGrid = None, boundingGrid = False,
                subregion = 'all', step = 1,
                gridSubregion = 'all', gridStep = 1,
                inPlace = False, scaleFactors = None, minRMS = False,
                modelId = None):

    vol1 = filter_volumes(vol1)
    vol2 = filter_volumes(vol2)
    if len(vol1) != 1 or len(vol2) != 1:
        raise CommandError, 'vop subtract operation requires exactly two volumes'
    if minRMS and scaleFactors:
        raise CommandError, 'vop subtract cannot specify both minRMS and scaleFactors options.'
    if minRMS:
        mult = (1,'minrms')
    elif scaleFactors:
        m0,m1 = parse_floats(scaleFactors, 'scaleFactors', 2)
        mult = (m0,-m1)
    else:
        mult = (1,-1)

    add_op(vol1+vol2, onGrid, boundingGrid, subregion, step,
           gridSubregion, gridStep, inPlace, mult, modelId)
Esempio n. 19
0
def boxes_op(volumes, markers, size = 0, useMarkerSize = False,
             subregion = 'all', step = 1, modelId = None):

    volumes = filter_volumes(volumes)
    check_number(size, 'size')
    if size <= 0 and not useMarkerSize:
        raise CommandError, 'Must specify size or enable useMarkerSize'
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from boxes import boxes
    for v in volumes:
        boxes(v, markers, size, useMarkerSize, step, subregion, modelId)
Esempio n. 20
0
def bin_op(volumes, subregion='all', step=1, binSize=(2, 2, 2), modelId=None):

    volumes = filter_volumes(volumes)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    if isinstance(binSize, int):
        binSize = (binSize, binSize, binSize)
    elif isinstance(binSize, basestring):
        binSize = parse_ints(binSize, 'binSize', 3)
    modelId = parse_model_id(modelId)

    from bin import bin
    for v in volumes:
        bin(v, binSize, step, subregion, modelId)
Esempio n. 21
0
def permute_axes_op(volumes, axisOrder = 'xyz',
                    subregion = 'all', step = 1, modelId = None):

    volumes = filter_volumes(volumes)
    ao = {'xyz':(0,1,2), 'xzy':(0,2,1), 'yxz':(1,0,2), 
          'yzx':(1,2,0), 'zxy':(2,0,1), 'zyx':(2,1,0)}
    if not axisOrder in ao:
        raise CommandError, 'Axis order must be xyz, xzy, zxy, zyx, yxz, or yzx'
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from permute import permute_axes
    for v in volumes:
        permute_axes(v, ao[axisOrder], step, subregion, modelId)
Esempio n. 22
0
def bin_op(volumes, subregion = 'all', step = 1,
           binSize = (2,2,2), modelId = None):

    volumes = filter_volumes(volumes)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    if isinstance(binSize, int):
        binSize = (binSize, binSize, binSize)
    elif isinstance(binSize, basestring):
        binSize = parse_ints(binSize, 'binSize', 3)
    modelId = parse_model_id(modelId)

    from bin import bin
    for v in volumes:
        bin(v, binSize, step, subregion, modelId)
Esempio n. 23
0
def octant_complement_op(volumes, center = None, iCenter = None,
              subregion = 'all', step = 1, inPlace = False,
              fillValue = 0, modelId = None):

    volumes = filter_volumes(volumes)
    center = parse_floats(center, 'center', 3)
    iCenter = parse_floats(iCenter, 'iCenter', 3)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    check_in_place(inPlace, volumes)
    check_number(fillValue, 'fillValue')
    modelId = parse_model_id(modelId)
    outside = False
    for v in volumes:
        octant_operation(v, outside, center, iCenter, subregion, step,
                         inPlace, fillValue, modelId)
Esempio n. 24
0
def median_op(volumes, binSize = 3, iterations = 1,
              subregion = 'all', step = 1, modelId = None):

    volumes = filter_volumes(volumes)
    check_number(iterations, 'iterations', positive = True)
    binSize = parse_step(binSize, 'binSize', require_3_tuple = True)
    for b in binSize:
        if b <= 0 or b % 2 == 0:
            raise CommandError, 'Bin size must be positive odd integer, got %d' % b
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from median import median_filter
    for v in volumes:
        median_filter(v, binSize, iterations, step, subregion, modelId)
Esempio n. 25
0
def cover_op(volumes,
             atomBox=None,
             pad=5.0,
             box=None,
             x=None,
             y=None,
             z=None,
             fBox=None,
             fx=None,
             fy=None,
             fz=None,
             iBox=None,
             ix=None,
             iy=None,
             iz=None,
             step=1,
             modelId=None):

    volumes = filter_volumes(volumes)
    check_number(pad, 'pad')

    if not atomBox is None and len(atomBox) == 0:
        raise CommandError, 'No atoms specified'
    box = parse_box(box, x, y, z, 'box', 'x', 'y', 'z')
    fBox = parse_box(fBox, fx, fy, fz, 'fBox', 'fx', 'fy', 'fz')
    iBox = parse_box(iBox, ix, iy, iz, 'iBox', 'ix', 'iy', 'iz')
    bc = len([b for b in (box, fBox, iBox, atomBox) if b])
    if bc == 0:
        raise CommandError, 'Must specify box to cover'
    if bc > 1:
        raise CommandError, 'Specify covering box in one way'

    step = parse_step(step, require_3_tuple=True)
    modelId = parse_model_id(modelId)

    from VolumeViewer import volume, volume_from_grid_data
    for v in volumes:
        g = v.grid_data(subregion='all', step=step, mask_zone=False)
        ijk_min, ijk_max = cover_box_bounds(v, step, atomBox, pad, box, fBox,
                                            iBox)
        cg = volume.map_from_periodic_map(g, ijk_min, ijk_max)
        cv = volume_from_grid_data(cg, model_id=modelId)
        cv.copy_settings_from(v, copy_region=False)
        cv.show()
Esempio n. 26
0
def boxes_op(volumes,
             markers,
             size=0,
             useMarkerSize=False,
             subregion='all',
             step=1,
             modelId=None):

    volumes = filter_volumes(volumes)
    check_number(size, 'size')
    if size <= 0 and not useMarkerSize:
        raise CommandError, 'Must specify size or enable useMarkerSize'
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from boxes import boxes
    for v in volumes:
        boxes(v, markers, size, useMarkerSize, step, subregion, modelId)
Esempio n. 27
0
def median_op(volumes,
              binSize=3,
              iterations=1,
              subregion='all',
              step=1,
              modelId=None):

    volumes = filter_volumes(volumes)
    check_number(iterations, 'iterations', positive=True)
    binSize = parse_step(binSize, 'binSize', require_3_tuple=True)
    for b in binSize:
        if b <= 0 or b % 2 == 0:
            raise CommandError, 'Bin size must be positive odd integer, got %d' % b
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from median import median_filter
    for v in volumes:
        median_filter(v, binSize, iterations, step, subregion, modelId)
Esempio n. 28
0
def octant_complement_op(volumes,
                         center=None,
                         iCenter=None,
                         subregion='all',
                         step=1,
                         inPlace=False,
                         fillValue=0,
                         modelId=None):

    volumes = filter_volumes(volumes)
    center = parse_floats(center, 'center', 3)
    iCenter = parse_floats(iCenter, 'iCenter', 3)
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    check_in_place(inPlace, volumes)
    check_number(fillValue, 'fillValue')
    modelId = parse_model_id(modelId)
    outside = False
    for v in volumes:
        octant_operation(v, outside, center, iCenter, subregion, step, inPlace,
                         fillValue, modelId)
Esempio n. 29
0
def morph_op(volumes,
             frames=25,
             start=0,
             playStep=0.04,
             playDirection=1,
             playRange=None,
             addMode=False,
             constantVolume=False,
             scaleFactors=None,
             hideOriginalMaps=True,
             subregion='all',
             step=1,
             modelId=None):

    volumes = filter_volumes(volumes)
    check_number(frames, 'frames', int, nonnegative=True)
    check_number(start, 'start')
    check_number(playStep, 'playStep', nonnegative=True)
    if playRange is None:
        if addMode:
            prange = (-1.0, 1.0)
        else:
            prange = (0.0, 1.0)
    else:
        prange = parse_floats(playRange, 'playRange', 2)
    check_number(playDirection, 'playDirection')
    sfactors = parse_floats(scaleFactors, 'scaleFactors', len(volumes))
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)
    vs = [
        tuple(v.matrix_size(step=step, subregion=subregion)) for v in volumes
    ]
    if len(set(vs)) > 1:
        sizes = ' and '.join([str(s) for s in vs])
        raise CommandError, "Volume grid sizes don't match: %s" % sizes
    from MorphMap import morph_maps
    morph_maps(volumes, frames, start, playStep, playDirection, prange,
               addMode, constantVolume, sfactors, hideOriginalMaps, subregion,
               step, modelId)
Esempio n. 30
0
def mask(volumes, surfaces, axis = None, fullMap = False,
         pad = 0., slab = None, sandwich = True, invertMask = False):

    from Commands import CommandError, filter_volumes, parse_floats
    vlist = filter_volumes(volumes)

    from Surface import selected_surface_pieces
    glist = selected_surface_pieces(surfaces, include_outline_boxes = False)
    if len(glist) == 0:
        raise CommandError, 'No surfaces specified'

    axis = parse_floats(axis, 'axis', 3, (0,1,0))

    if not isinstance(fullMap, (bool,int)):
        raise CommandError, 'fullMap option value must be true or false'

    if not isinstance(invertMask, (bool,int)):
        raise CommandError, 'invertMask option value must be true or false'

    if not isinstance(pad, (float,int)):
        raise CommandError, 'pad option value must be a number'

    if isinstance(slab, (float,int)):
        pad = (-0.5*slab, 0.5*slab)
    elif not slab is None:
        pad = parse_floats(slab, 'slab', 2)

    if not isinstance(sandwich, bool):
        raise CommandError, 'sandwich option value must be true or false'

    from depthmask import surface_geometry, masked_volume
    from Matrix import xform_matrix, invert_matrix
    for v in vlist:
        tf = invert_matrix(xform_matrix(v.model_transform()))
        surfs = surface_geometry(glist, tf, pad)
        masked_volume(v, surfs, axis, fullMap, sandwich, invertMask)
Esempio n. 31
0
def permute_axes_op(volumes,
                    axisOrder='xyz',
                    subregion='all',
                    step=1,
                    modelId=None):

    volumes = filter_volumes(volumes)
    ao = {
        'xyz': (0, 1, 2),
        'xzy': (0, 2, 1),
        'yxz': (1, 0, 2),
        'yzx': (1, 2, 0),
        'zxy': (2, 0, 1),
        'zyx': (2, 1, 0)
    }
    if not axisOrder in ao:
        raise CommandError, 'Axis order must be xyz, xzy, zxy, zyx, yxz, or yzx'
    subregion = parse_subregion(subregion)
    step = parse_step(step)
    modelId = parse_model_id(modelId)

    from permute import permute_axes
    for v in volumes:
        permute_axes(v, ao[axisOrder], step, subregion, modelId)