Example of use of dcoordinates
This is a toy example to illustrate the conversion of volumes into spherical coordinates through the command dcoordinates.
We will create a small virus model by attaching a regular distribution of spikes (cylinders) to a virus (a sphere)
vol = dsphere(30,256); v = dmodels.vesicle(); v.center = 128.5*[1,1,1]; v.separation = 20; v.radius = 40; v.updateCrop; t = v.grepTable(); myTemplate = dcylinder([4,12],24); mask = myTemplate; for i=1:size(t,1); rotTemplate = dynamo_rot(myTemplate,t(i,7:9)); rotMask = dynamo_rot(mask,t(i,7:9)); vol = dpkvol.embed(rotTemplate,vol,t(i,24:26),rotMask); end
We can quickly check how our "virus" looks like:
Remember that disoview is a very basic renderer of isosurfaces. We use it as a fallback when Chimera is not performing in the system.
Alternatively we can visualize the grey map:
Now we can perform the coordinate conversion:
vols = dcoordinates(vol,'cart2sph');
After this transform, the radial direction is stored along the first dimension of vols. Second and third dimension correspond to the spherical angles.
We can now check the surface of the virus at the radial distance 30 (the "surface" of the virus in this example), adding layers 28 to 32.
- vols(28:32,:,:); corresponds to extracting the layers 28 to 32 in the volume vols
- the sum command adds all the layers of the argument along the direction 1 (the radial direction in this case)
- the squeeze command is just Matlab formating: it converts the (nominal) volume created by sum (with dimensions 1 x 256 x512) into an image 256 x 512 that can then be fed into show;
A clearer view can be gained by averaging some pixels away from the surface: