Difference between revisions of "Example of use of dcoordinates"
Jump to navigation
Jump to search
(Created page with "<pre>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],...") |
|||
Line 1: | Line 1: | ||
+ | This is a toy example to illustrate the conversion of volumes into spherical coordinates through the command <tt>dcoordinates</tt>. | ||
+ | |||
<pre>vol = dsphere(30,256); | <pre>vol = dsphere(30,256); | ||
v = dmodels.vesicle(); | v = dmodels.vesicle(); | ||
Line 14: | Line 16: | ||
end </pre> | end </pre> | ||
− | We can quickly check how our " virus" looks like: | + | We can quickly check how our "virus" looks like: |
<pre>disoview(vol); </pre> | <pre>disoview(vol); </pre> | ||
− | Remember that <tt>disoview</tt> is a very basic renderer of isosurfaces. | + | 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. |
− | vols = dcoordinates(vol,'cart2sph'); | + | Now we can perform the coordinate conversion: |
+ | <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. | ||
+ | |||
+ | We can now check the surface of the virus at the radial distance 30, adding layers 28 to 32. | ||
<pre> | <pre> | ||
figure; | figure; | ||
− | dshow(squeeze(sum(vols( | + | dshow(squeeze(sum(vols(28:32,:,:),1))); </pre> |
+ | |||
+ | Here, | ||
+ | * <tt>vols(28:32,:,:); </tt> corresponds to extracting the layers 28 to 32 in the volume <tt>vols</tt> | ||
+ | * the <tt>sum</tt> command adds all the layers of the argument along the direction 1 (the radial direction in this case) | ||
+ | * the <tt>squeeze</tt> command is just Matlab formating: it converts the (nominal) volume created by <tt>sum</tt> (with dimensions 1 x 256 x512) into an image 256 x 512 that can then be fed into <tt>show</tt>; | ||
<pre>figure; | <pre>figure; | ||
dshow(squeeze(sum(vols(35:40,:,:),1)));</pre> | dshow(squeeze(sum(vols(35:40,:,:),1)));</pre> |
Revision as of 18:19, 12 February 2019
This is a toy example to illustrate the conversion of volumes into spherical coordinates through the command dcoordinates.
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.
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, 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;
figure; dshow(squeeze(sum(vols(35:40,:,:),1)));