Ejemplo n.º 1
0
def fitToSegment(monomer_file):
    """
    Fits the monomer to each of the segments maps in segmentationsDir
    """
    os.system("rm -r fitDir ; mkdir fitDir")
    i=0
    for segmentedMapFile in os.listdir( "segmentationsDir" ) :
        rc( "open " + monomer_file)
        v= VolumeViewer.open_volume_file("segmentationsDir/" + segmentedMapFile)[0]
        d=v.data
        #We move the monomer close to the segmented-region map to improve FitMap, so we measure the position of the monomer in atomic coordinates
        #measure the position of the segmented-map in grid indices, convert it to atomic corrdinates, and move the monomer in the coordinates       
        #difference axis, then running fitmap to fit the monomer to the region-map when they are closed to each other
        rc( "measure center #0")
        rc( "measure center #1")
        saveReplyLog("log.txt")
        log= open("log.txt", 'r')
        lines=log.readlines()
        centerLine1=lines[len(lines)-2]
        centerLine0=lines[len(lines)-3] 
        line0Array=centerLine0.split()
        line1Array=centerLine1.split()
        monomerCenter= (float(line0Array[-3][1:-1]), float(line0Array[-2][:-1]), float(line0Array[-1][:-1]))
        segmentCenter= (float(line1Array[-3][1:-1]), float(line1Array[-2][:-1]), float(line1Array[-1][:-1]))
        x,y,z= d.ijk_to_xyz(segmentCenter) 
        moveAxis= (x-monomerCenter[0], y-monomerCenter[1], z-monomerCenter[2])
        rc("move "+str(moveAxis[0]) +","+ str(moveAxis[1]) + "," + str(moveAxis[2])
        + " models #0")
        rc( "fitmap #0 #1" )
        rc("write format pdb #0 fitDir/model" + str(i)+".pdb")
        rc("close all")
        i+=1
Ejemplo n.º 2
0
def scaled_volume(v = None, scale = 1, shift = 0, type = None,
                 step = None, subregion = None, model_id = None):

  if v is None:
    from VolumeViewer import active_volume
    v = active_volume()
    if v is None:
      return

  sd = scaled_grid(v, scale, shift, type, subregion, step)
  import VolumeViewer
  sv = VolumeViewer.volume_from_grid_data(sd, model_id = model_id)
  return sv
Ejemplo n.º 3
0
def export_mask(segmentation,
                savePath=None,
                format='mrc',
                binSize=(1, 1, 1),
                sequentialIds=True):

    m = segmentation.mask
    origin = segmentation.grid_origin()
    step = segmentation.grid_step()

    # Include only id numbers of top-level region groups.
    from numpy import zeros, empty
    parent = zeros((segmentation.max_region_id + 1, ), dtype=m.dtype)
    for r in segmentation.all_regions():
        parent[r.rid] = r.top_parent().rid
    if sequentialIds:
        used_ids = list(set(parent))
        used_ids.sort()
        seq_id = zeros((used_ids[-1] + 1, ), dtype=m.dtype)
        for i, id in enumerate(used_ids):
            seq_id[id] = i
        parent = seq_id[parent]
    array = parent[m]

    # Expand array to match unbinned density map size.
    if tuple(binSize) != (1, 1, 1):
        step = [float(s) / b for s, b in zip(step, binSize)]
        shape = [a * b for a, b in zip(array.shape, binSize[::-1])]
        aub = empty(shape, array.dtype)
        b2, b1, b0 = binSize
        for o0 in range(b0):
            for o1 in range(b1):
                for o2 in range(b2):
                    aub[o0::b0, o1::b1, o2::b2] = array
        array = aub

    from VolumeData import Array_Grid_Data
    g = Array_Grid_Data(array, origin, step)
    g.name = segmentation.name + ' region ids'

    if savePath is None:
        # Open mask map as a volume.
        import VolumeViewer
        v = VolumeViewer.volume_from_grid_data(g)
        v.openState.xform = segmentation.openState.xform
    else:
        # Write map file.
        from VolumeData import save_grid_data
        save_grid_data(g, savePath, format)

    return g
Ejemplo n.º 4
0
def permute_axes(v = None, axis_order = (0,1,2),
                 step = None, subregion = None, model_id = None):

  if v is None:
    from VolumeViewer import active_volume
    v = active_volume()
    if v is None:
      return

  d = v.grid_data(subregion, step, mask_zone = False)
  pd = Permuted_Grid(d, axis_order)
  import VolumeViewer
  pv = VolumeViewer.volume_from_grid_data(pd, model_id = model_id)
  return pv
Ejemplo n.º 5
0
def sphere_volume(n, r, noise = 1.0):

  from numpy import indices, single as floatc
  o = 0.5*(n-1)
  i = indices((n,n,n), floatc) - o
  a = (i[0,...]*i[0,...] + i[1,...]*i[1,...] + i[2,...]*i[2,...] < r*r).astype(floatc)

  if noise > 0:
    from numpy.random import normal
    a += normal(0, noise, a.shape)

  import VolumeData, VolumeViewer
  g = VolumeData.Array_Grid_Data(a, origin = (-o,-o,-o), step = (1,1,1),
                                 name = 'sphere')
  v = VolumeViewer.volume_from_grid_data(g)
  return v
Ejemplo n.º 6
0
def zflip_operation(v, subregion, step, in_place, model_id):

    g = v.grid_data(subregion=subregion, step=step, mask_zone=False)
    if in_place:
        m = g.full_matrix()
        import zflip
        zflip.zflip(m)
        v.data.values_changed()
        v.show()
    else:
        import zflip
        zfg = zflip.Z_Flip_Grid(g)
        import VolumeViewer
        fv = VolumeViewer.volume_from_grid_data(zfg, model_id=model_id)
        fv.copy_settings_from(v, copy_region=False)
        fv.show()
        v.unshow()
Ejemplo n.º 7
0
def zflip_operation(v, subregion, step, in_place, model_id):

    g = v.grid_data(subregion = subregion, step = step, mask_zone = False)
    if in_place:
        m = g.full_matrix()
        import zflip
        zflip.zflip(m)
        v.data.values_changed()
        v.show()
    else:
        import zflip
        zfg = zflip.Z_Flip_Grid(g)
        import VolumeViewer
        fv = VolumeViewer.volume_from_grid_data(zfg, model_id = model_id)
        fv.copy_settings_from(v, copy_region = False)
        fv.show()
        v.unshow()
Ejemplo n.º 8
0
def bin(v = None, bin_size = (2,2,2),
        step = None, subregion = None, model_id = None):

  if v is None:
    from VolumeViewer import active_volume
    v = active_volume()
    if v is None:
      return None

  bd = bin_grid(v, bin_size, step, subregion)
  import VolumeViewer
  bv = VolumeViewer.volume_from_grid_data(bd, model_id = model_id)

  bv.copy_settings_from(v, copy_region = False)
  v.unshow()          # Hide original map

  return bv
Ejemplo n.º 9
0
def permute_axes(v=None,
                 axis_order=(0, 1, 2),
                 step=None,
                 subregion=None,
                 model_id=None):

    if v is None:
        from VolumeViewer import active_volume
        v = active_volume()
        if v is None:
            return

    d = v.grid_data(subregion, step, mask_zone=False)
    pd = Permuted_Grid(d, axis_order)
    import VolumeViewer
    pv = VolumeViewer.volume_from_grid_data(pd, model_id=model_id)
    return pv
Ejemplo n.º 10
0
def scaled_volume(v=None,
                  scale=1,
                  shift=0,
                  type=None,
                  step=None,
                  subregion=None,
                  model_id=None):

    if v is None:
        from VolumeViewer import active_volume
        v = active_volume()
        if v is None:
            return

    sd = scaled_grid(v, scale, shift, type, subregion, step)
    import VolumeViewer
    sv = VolumeViewer.volume_from_grid_data(sd, model_id=model_id)
    return sv
Ejemplo n.º 11
0
def read_hkl_map(path):

    # Sum values for h,k,l grid points
    f = open(path, 'r')
    m = {}
    c = 0
    while True:
        line = f.readline()

        if c % 1000000 == 0 and c > 0:
            print c
        c += 1
        if line == '':
            break
        fields = line.split()
        ijk = tuple(int(i) for i in fields[:3])
        v = float(fields[3])
        if ijk in m:
            m[ijk] += v
        else:
            m[ijk] = v
    f.close()

    # Find h,k,l bounds
    from numpy import array, int32, zeros, float32
    ijk = array(tuple(m.keys()), int32)
    ijk_min = ijk.min(axis=0)
    ijk_max = ijk.max(axis=0)
    print ijk_min, ijk_max

    # Create numpy array
    isz, jsz, ksz = ijk_max - ijk_min + 1
    a = zeros((ksz, jsz, isz), float32)
    imin, jmin, kmin = ijk_min
    for (i, j, k), v in m.items():
        a[k - kmin, j - jmin, i - imin] = v

    # Create volume model
    import VolumeData, VolumeViewer
    g = VolumeData.Array_Grid_Data(a, origin=tuple(ijk_min))
    v = VolumeViewer.volume_from_grid_data(g)
    from os.path import basename
    v.name = basename(path)
Ejemplo n.º 12
0
    def setTarget(self, target):
        """This will determine the class of the target, and setup the list of available
		keys appropriately. The keys list is [type,label,active flag]"""
        t = target
        self.target = t
        if isinstance(t, Molecule):
            self.pkeys = {
                "xform": ["matrix", "Orientation", 1],
                "color": ["color", "Model Color", 1],
                "display": ["int", "Display", 1],
            }
        elif isinstance(t, Volume_Model):
            self.pkeys = {
                "xform": ["matrix", "Orientation", 1],
                "display": ["int", "Display", 1],
                "clip": ["int", "Use Clip", 1],
            }
        elif isinstance(t, VRMLModel):
            self.pkeys = {"xform": ["matrix", "Orientation", 1], "display": ["int", "Display", 1]}
        elif isinstance(t, Surface_Model) and t.name.endswith(" surfaces"):
            # Multiscale model.
            self.pkeys = {"xform": ["matrix", "Orientation", 1], "display": ["int", "Display", 1]}
        elif isinstance(t, Volume):
            self.pkeys = {
                "xform": ["matrix", "Orientation", 1],
                "color": ["color", "Model Color", 1],
                "display": ["int", "Display", 1],
                "isothr": ["float", "Isosurf Thr.", 1],
                "clip": ["int", "Use Clip", 1],
                "clipnorm": ["vector", "Clip Dir.", 1],
                "cliploc": ["vector", "Clip Loc.", 1],
            }
            for r in VolumeViewer.volume_list():
                if target in r.models():
                    self.region = r
        elif isinstance(t, LensViewer):
            self.pkeys = {"zoom": ["float", "Zoom", 1]}
            target.name = "Camera"
        else:
            print "Unknown model type ", str(t.__class__)
Ejemplo n.º 13
0
def makeMap(sel_str, res, gridSpacing, clr, map_name):

    cmd = "molmap %s %.3f sigmaFactor 0.187 gridSpacing %.3f replace false" % (
        sel_str, res, gridSpacing)
    #print ">>>", cmd
    chimera.runCommand(cmd)

    mv = None
    for mod in chimera.openModels.list():
        ts = mod.name.split()
        if len(ts) > 1 and mod.name.find("map") >= 0 and mod.name.find(
                "res") >= 0:
            #print " - found", mod.name
            mv = mod
            mv.name = map_name
            if 0:
                #print " - saving to:", map_name
                mv.write_file(map_name, "mrc")
                xf = mv.openState.xform
                #print " - closing:", map_name
                chimera.openModels.close(mv)
                mv = VolumeViewer.open_volume_file(map_name)[0]
                #print " - opened:", mv.name
                mv.openState.xform = xf
            break

    if mv == None:
        umsg("Map not generated.")
        return

    mv.surface_levels[0] = 0.001

    ro = VolumeViewer.volume.Rendering_Options()
    mv.update_surface(False, ro)
    for sp in mv.surfacePieces:
        v, t = sp.geometry
        if len(v) == 8 and len(t) == 12: sp.display = False
        sp.color = (clr[0], clr[1], clr[2], clr[3])

    return mv
Ejemplo n.º 14
0
def runSegment(map_file):
    """Segments the map from the given path and saves the results in
    the directory segmentationsDir.
    """
    chimeraMap = VolumeViewer.open_volume_file(map_file)[0] #opens the map
    dialog = SD.Volume_Segmentation_Dialog() #creates a segmentor object
    trsh = dialog.Segment() #segments the map

    #code for saving the results
    dmap = dialog.SegmentationMap()
    smod = dialog.CurrentSegmentation()
    regs = smod.selected_regions()
    if len(regs)==0 :
            regs = smod.regions
    dir = os.path.dirname ( dmap.data.path )
    fprefix = os.path.splitext ( dmap.name ) [0]
    fname = fprefix + "_region_%d.mrc"
    path = "segmentationsDir/"+fname
    os.system("rm -r segmentationsDir ; mkdir segmentationsDir")
    for reg in regs : #save each result in a different file
        dialog.SaveRegsToMRC ( [reg], dmap, path % (reg.rid,) )
    #end of code for saving the results
        
    rc("close all")
Ejemplo n.º 15
0
from FitMap.fitcmd import fitmap
from Measure import measure
import Midas

# Parsing 
parser = argparse.ArgumentParser(description="Fits model in EM map using a reference pdb")
parser.add_argument("model", help="Path to model PDB")
parser.add_argument("reference", help="Path to reference PDB")
parser.add_argument("em_map", help="Path to experimental EM density map")
parser.add_argument("resolution", help="EM map resolution")
args = parser.parse_args()


model = chimera.openModels.open(args.model)[0]
ref = chimera.openModels.open(args.reference)[0]
em_map = VolumeViewer.open_volume_file(args.em_map)[0]
res = float(args.resolution)

model_list = []
ref_list = []

# Lists of CA atoms are generated as the number of atoms for aligment has to be equal 

for atom in model.atoms:
    if "CA" == atom.name:
        model_list.append(atom)
        

for atom in ref.atoms:
    if len(ref_list) == len(model_list):
        continue   
Ejemplo n.º 16
0
    def computeVolume(self, atoms, frame_ids, volumeName=None, spacing=0.5, radiiTreatment="ignored"):
        #function taken from Movie/gui.py and tweaked to compute volume based on an array of frame_ids
        from Matrix import xform_matrix
        gridData = {}
        from math import floor
        from numpy import array, float32, concatenate
        from _contour import affine_transform_vertices
        insideDeltas = {}
        include = {}
        sp2 = spacing * spacing
        for fn in frame_ids:
            cs = self.movie.findCoordSet(fn)
            if not cs:
                self.movie.status("Loading frame %d" % fn)
                self.movie._LoadFrame(int(fn), makeCurrent=False)
                cs = self.movie.findCoordSet(fn)

            self.movie.status("Processing frame %d" % fn)
            pts = array([a.coord(cs) for a in atoms], float32)
            if self.movie.holdingSteady:
                if bound is not None:
                    steadyPoints = array([a.coord(cs)
                        for a in steadyAtoms], float32)
                    closeIndices = find_close_points(
                        BOXES_METHOD, steadyPoints,
                        #otherPoints, bound)[1]
                        pts, bound)[1]
                    pts = pts[closeIndices]
                try:
                    xf, inv = self.movie.transforms[fn]
                except KeyError:
                    xf, inv = self.movie.steadyXform(cs=cs)
                    self.movie.transforms[fn] = (xf, inv)
                xf = xform_matrix(xf)
                affine_transform_vertices(pts, xf)
                affine_transform_vertices(pts, inverse)
            if radiiTreatment != "ignored":
                ptArrays = [pts]
                for pt, radius in zip(pts, [a.radius for a in atoms]):
                    if radius not in insideDeltas:
                        mul = 1
                        deltas = []
                        rad2 = radius * radius
                        while mul * spacing <= radius:
                            for dx in range(-mul, mul+1):
                                for dy in range(-mul, mul+1):
                                    for dz in range(-mul, mul+1):
                                        if radiiTreatment == "uniform" \
                                        and min(dx, dy, dz) > -mul and max(dx, dy, dz) < mul:
                                            continue
                                        key = tuple(sorted([abs(dx), abs(dy), abs(dz)]))
                                        if key not in include.setdefault(radius, {}):
                                            include[radius][key] = (dx*dx + dy*dy + dz*dz
                                                    ) * sp2 <= rad2
                                        if include[radius][key]:
                                            deltas.append([d*spacing for d in (dx,dy,dz)])
                            mul += 1
                        insideDeltas[radius] = array(deltas)
                        if len(deltas) < 10:
                            print deltas
                    if insideDeltas[radius].size > 0:
                        ptArrays.append(pt + insideDeltas[radius])
                pts = concatenate(ptArrays)
            # add a half-voxel since volume positions are
            # considered to be at the center of their voxel
            from numpy import floor, zeros
            pts = floor(pts/spacing + 0.5).astype(int)
            for pt in pts:
                center = tuple(pt)
                gridData[center] = gridData.get(center, 0) + 1

        # generate volume
        self.movie.status("Generating volume")
        axisData = zip(*tuple(gridData.keys()))
        minXyz = [min(ad) for ad in axisData]
        maxXyz = [max(ad) for ad in axisData]
        # allow for zero-padding on both ends
        dims = [maxXyz[axis] - minXyz[axis] + 3 for axis in range(3)]
        from numpy import zeros, transpose
        volume = zeros(dims, int)
        for index, val in gridData.items():
            adjIndex = tuple([index[i] - minXyz[i] + 1
                            for i in range(3)])
            volume[adjIndex] = val
        from VolumeData import Array_Grid_Data
        gd = Array_Grid_Data(volume.transpose(),
                    # the "cushion of zeros" means d-1...
                    [(d-1) * spacing for d in minXyz],
                    [spacing] * 3)
        if volumeName is None:
            volumeName = self.movie.ensemble.name
        gd.name = volumeName

        # show volume
        self.movie.status("Showing volume")
        import VolumeViewer
        dataRegion = VolumeViewer.volume_from_grid_data(gd)
        vd = VolumeViewer.volumedialog.volume_dialog(create=True)
        vd.message("Volume can be saved from File menu")
        self.movie.status("Volume shown")
Ejemplo n.º 17
0
    def computeVolume(self,
                      atoms,
                      startFrame=None,
                      endFrame=None,
                      bound=None,
                      volumeName=None,
                      step=1,
                      spacing=0.5):
        # load and process frames
        if startFrame is None:
            startFrame = self.startFrame
        if endFrame is None:
            endFrame = self.endFrame
        if bound is not None:
            from _closepoints import find_close_points, BOXES_METHOD
        from Matrix import xform_matrix
        if self.holdingSteady:
            steadyAtoms, steadySel, steadyCS, inverse = \
                self.holdingSteady
            # all the above used later...
            inverse = xform_matrix(inverse)

        gridData = {}
        from math import floor
        from numpy import array, float32
        from _contour import affine_transform_vertices
        for fn in range(startFrame, endFrame + 1, step):
            cs = self.findCoordSet(fn)
            if not cs:
                self.status("Loading frame %d" % fn)
                self._LoadFrame(fn, makeCurrent=False)
                cs = self.findCoordSet(fn)

            self.status("Processing frame %d" % fn)
            pts = array([a.coord(cs) for a in atoms], float32)
            if self.holdingSteady:
                if bound is not None:
                    steadyPoints = array([a.coord(cs) for a in steadyAtoms],
                                         float32)
                    closeIndices = find_close_points(
                        BOXES_METHOD,
                        steadyPoints,
                        #otherPoints, bound)[1]
                        pts,
                        bound)[1]
                    pts = pts[closeIndices]
                try:
                    xf, inv = self.transforms[fn]
                except KeyError:
                    xf, inv = self.steadyXform(cs=cs)
                    self.transforms[fn] = (xf, inv)
                xf = xform_matrix(xf)
                affine_transform_vertices(pts, xf)
                affine_transform_vertices(pts, inverse)
            # add a half-voxel since volume positions are
            # considered to be at the center of their voxel
            from numpy import floor, zeros
            pts = floor(pts / spacing + 0.5).astype(int)
            for pt in pts:
                center = tuple(pt)
                gridData[center] = gridData.get(center, 0) + 1

        # generate volume
        self.status("Generating volume")
        axisData = zip(*tuple(gridData.keys()))
        minXyz = [min(ad) for ad in axisData]
        maxXyz = [max(ad) for ad in axisData]
        # allow for zero-padding on both ends
        dims = [maxXyz[axis] - minXyz[axis] + 3 for axis in range(3)]
        from numpy import zeros, transpose
        volume = zeros(dims, int)
        for index, val in gridData.items():
            adjIndex = tuple([index[i] - minXyz[i] + 1 for i in range(3)])
            volume[adjIndex] = val
        from VolumeData import Array_Grid_Data
        gd = Array_Grid_Data(
            volume.transpose(),
            # the "cushion of zeros" means d-1...
            [(d - 1) * spacing for d in minXyz],
            [spacing] * 3)
        if volumeName is None:
            volumeName = self.ensemble.name
        gd.name = volumeName

        # show volume
        self.status("Showing volume")
        import VolumeViewer
        dataRegion = VolumeViewer.volume_from_grid_data(gd)
        vd = VolumeViewer.volumedialog.volume_dialog(create=True)
        vd.message("Volume can be saved from File menu")

        self.status("Volume shown")
Ejemplo n.º 18
0
#----------------------------------------------------------------------------------------
# This script is called as:
#
#    chimera --nogui --script "CCcalculate <pdb file> <map> <resolution> <n searches>"
#
# A synthetic map of the PDB structure with the resolution of the experimental map
# will be generated and fitted on the experimental map with n searches.
# After fitting, the correlation of the best fitted structure is measured
#----------------------------------------------------------------------------------------

import chimera
import VolumeViewer
import sys
from MoleculeMap import molmap
from FitMap.fitcmd import fitmap
from Measure import measure

res = float(sys.argv[3])
search = int(sys.argv[4])

models = chimera.openModels.open(sys.argv[1])
model = models[0]
synth_map = molmap.molecule_map(model.atoms, res)

em_map = VolumeViewer.open_volume_file(sys.argv[2])[0]
select = chimera.selection.ItemizedSelection([synth_map])
fit_list = fitmap(select, em_map, search=search, listFits=False)

measure.correlation("correlation", [synth_map], [em_map])
Ejemplo n.º 19
0
	def computeVolume(self, atoms, startFrame=None, endFrame=None,
			bound=None, volumeName=None, step=1, spacing=0.5):
		# load and process frames
		if startFrame is None:
			startFrame = self.startFrame
		if endFrame is None:
			endFrame = self.endFrame
		if bound is not None:
			from _closepoints import find_close_points, BOXES_METHOD
		from Matrix import xform_matrix
		if self.holdingSteady:
			steadyAtoms, steadySel, steadyCS, inverse = \
							self.holdingSteady
			# all the above used later...
			inverse = xform_matrix(inverse)

		gridData = {}
		from math import floor
		from numpy import array, float32
		from _contour import affine_transform_vertices
		for fn in range(startFrame, endFrame+1, step):
			cs = self.findCoordSet(fn)
			if not cs:
				self.status("Loading frame %d" % fn)
				self._LoadFrame(fn, makeCurrent=False)
				cs = self.findCoordSet(fn)

			self.status("Processing frame %d" % fn)
			pts = array([a.coord(cs) for a in atoms], float32)
			if self.holdingSteady:
				if bound is not None:
					steadyPoints = array([a.coord(cs)
						for a in steadyAtoms], float32)
					closeIndices = find_close_points(
						BOXES_METHOD, steadyPoints,
						#otherPoints, bound)[1]
						pts, bound)[1]
					pts = pts[closeIndices]
				try:
					xf, inv = self.transforms[fn]
				except KeyError:
					xf, inv = self.steadyXform(cs=cs)
					self.transforms[fn] = (xf, inv)
				xf = xform_matrix(xf)
				affine_transform_vertices(pts, xf)
				affine_transform_vertices(pts, inverse)
			# add a half-voxel since volume positions are
			# considered to be at the center of their voxel
			from numpy import floor, zeros
			pts = floor(pts/spacing + 0.5).astype(int)
			for pt in pts:
				center = tuple(pt)
				gridData[center] = gridData.get(center, 0) + 1

		# generate volume
		self.status("Generating volume")
		axisData = zip(*tuple(gridData.keys()))
		minXyz = [min(ad) for ad in axisData]
		maxXyz = [max(ad) for ad in axisData]
		# allow for zero-padding on both ends
		dims = [maxXyz[axis] - minXyz[axis] + 3 for axis in range(3)]
		from numpy import zeros, transpose
		volume = zeros(dims, int)
		for index, val in gridData.items():
			adjIndex = tuple([index[i] - minXyz[i] + 1
							for i in range(3)])
			volume[adjIndex] = val
		from VolumeData import Array_Grid_Data
		gd = Array_Grid_Data(volume.transpose(),
					# the "cushion of zeros" means d-1...
					[(d-1) * spacing for d in minXyz],
					[spacing] * 3)
		if volumeName is None:
			volumeName = self.ensemble.name
		gd.name = volumeName

		# show volume
		self.status("Showing volume")
		import VolumeViewer
		dataRegion = VolumeViewer.volume_from_grid_data(gd)
		vd = VolumeViewer.volumedialog.volume_dialog(create=True)
		vd.message("Volume can be saved from File menu")

		self.status("Volume shown")