# Difference between revisions of "Example of use of dcoordinates"

Line 21: | Line 21: | ||

<pre>disoview(vol); </pre> | <pre>disoview(vol); </pre> | ||

Remember that <tt>disoview</tt> is a very basic renderer of isosurfaces. We use it as a fallback when Chimera is not performing in the system. | Remember that <tt>disoview</tt> is a very basic renderer of isosurfaces. We use it as a fallback when Chimera is not performing in the system. | ||

+ | |||

+ | [[File:ExampleTomoslice.png|center|right|400px| <tt>disoview</tt> ]] | ||

+ | |||

+ | Alternatively we can visualize the grey map | ||

+ | [[File:ExampleTomoslice.png|center|right|400px| <tt>dview</tt> ]] | ||

Now we can perform the coordinate conversion: | Now we can perform the coordinate conversion: | ||

<tt>vols = dcoordinates(vol,'cart2sph');</tt> | <tt>vols = dcoordinates(vol,'cart2sph');</tt> | ||

+ | |||

+ | |||

After this transform, the radial direction is stored along the first dimension of <tt>vols</tt>. Second and third dimension correspond to the spherical angles. | After this transform, the radial direction is stored along the first dimension of <tt>vols</tt>. Second and third dimension correspond to the spherical angles. | ||

Line 31: | Line 38: | ||

figure; | figure; | ||

dshow(squeeze(sum(vols(28:32,:,:),1))); </pre> | dshow(squeeze(sum(vols(28:32,:,:),1))); </pre> | ||

+ | |||

+ | [[File:ExampleTomoslice.png|centering|center|400px| <tt>dshow</tt> of surface of virus ]] | ||

Here, | Here, | ||

Line 40: | Line 49: | ||

<pre>figure; | <pre>figure; | ||

dshow(squeeze(sum(vols(35:40,:,:),1)));</pre> | dshow(squeeze(sum(vols(35:40,:,:),1)));</pre> | ||

+ | |||

+ | [[File:ExampleTomoslice.png|center|right|400px| <tt>dshow</tt> of spikes far away from radius of virus ]] |

## Revision as of 19:37, 12 February 2019

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:

disoview(vol);

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.

figure; dshow(squeeze(sum(vols(28:32,:,:),1)));

Here,

`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:

figure; dshow(squeeze(sum(vols(35:40,:,:),1)));