Difference between revisions of "Volume center"

From Dynamo
Jump to navigation Jump to search
Line 34: Line 34:
 
When we depict a power spectrum, the center pixel <tt> [N/2+1,N/2+1,N/2+1]</tt> corresponds to the zero-th Fourier order. The magnitude of this pixel does not represent an oscillation, but just the average intensity of the volume in the current space. Luckily, this is a convention used in many EM packages an also in Matlab.
 
When we depict a power spectrum, the center pixel <tt> [N/2+1,N/2+1,N/2+1]</tt> corresponds to the zero-th Fourier order. The magnitude of this pixel does not represent an oscillation, but just the average intensity of the volume in the current space. Luckily, this is a convention used in many EM packages an also in Matlab.
  
Note that this implies that the Fourier pixels conveying the Nyquist frequency in a direction are NOT to be found at the most positive indices of the Fourier volume. For instance, you might expect the Nyquist frequency for waves in the x direction to be conveyed in the pixel <tt>[N,N/2+1,N/2+1]<tt>. That's wrong: this pixel is located at a distance (measured between pixel centers)  of N/2-1 pixels. The actual Nyquist frequency corresponds to pixel <tt>[0,N/2+1,N/2+1]<tt>, which is at the correct distance.  Remember, the theory of Discrete Fourier Transform on ''real'' volumes (as density maps are) tells us that all components of the power spectrum are center symmetric.... other than the Nyquist component, that appears only one for each direction (thus no redundancy)  
+
Note that this implies that the Fourier pixels conveying the Nyquist frequency in a direction are NOT to be found at the most positive indices of the Fourier volume. For instance, you might expect the Nyquist frequency for waves in the x direction to be conveyed in the pixel <tt>[N,N/2+1,N/2+1]</tt>. That's wrong: this pixel is located at a distance (measured between pixel centers)  of N/2-1 pixels. The actual Nyquist frequency corresponds to pixel <tt>[0,N/2+1,N/2+1]<tt>, which is at the correct distance.  Remember, the theory of Discrete Fourier Transform on ''real'' volumes (as density maps are) tells us that all components of the power spectrum are center symmetric.... other than the Nyquist component, that appears only one for each direction (thus no redundancy)  
  
  
 
When computing the [[Fourier Shell Correlation]] of two volumes, the central pixel is left aside from the computation.
 
When computing the [[Fourier Shell Correlation]] of two volumes, the central pixel is left aside from the computation.

Revision as of 08:58, 28 April 2016


The center of a discretized volume can be defined in different ways. Dynamo uses the same convention in all its functions. For the formulas in this page, remember also that Dynamo uses the convention of counting pixels with the index 1, (not 0). The pixel "on the corner" with the first coordinates in a volume V is thus denoted as V[1,1,1].

Pixels and continuous coordinates

Sometimes it is necessary to clearly distinguish between (discrete) pixel indices and (continuous) point coordinates.

We use the notation [i,j,k] for pixel indices, and the notation (x,y,z) for continuous coordinates (or simply coordinates). The origin of coordinates in a volume is the corner of the first pixel [1,1,1]. This way, the coordinate (N,N,N) is located exactly in the corner oposite to the origin of coordinates.


Direct space

For a volume of V NxNxN pixels, Dynamo considers by convention the pixel located at [N/2+1,N/2+1,N/2+1] as the central pixel of V.

Rotation

Rotation needs defining on a concrete point, not on a pixel (as a pixel is actually a square with an area). The convention in Dynamo is to define the rotation center point in the middle of the center pixel, thus at the continuous coordinate (N/2+1/2,N/2+1/2,N/2+1/2).

This might seem inelegant, as the geometrical center of the volume is clearly located at the position (N/2,N/2,N/2), (which is located in a corner shared by eight pixels). However, Dynamo skips to the (N/2+1/2,N/2+1/2,N/2+1/2) convention, as it keeps coherency with the definition of center in Fourier space (where it is important that the coordinate center falls in the middle of a fourier pixel), and it is also a convention widely used in EM software packages.


Placing templates in a Volume

Sometimes you need to place a template T inside a bigger volume V, by passing a pixel coordinate r inside the bigger volume. In such cases the placement follows by setting the central pixel [N/2+1,N/2+1,N/2+1] at the pixel position r in V, i.e.:

V[x-N/2 : x+N/2-1 , y-N/2 : y+N/2-1, z-N/2 : z+N/2-1] = T[:,:,:];


Fourier space

When we depict a power spectrum, the center pixel [N/2+1,N/2+1,N/2+1] corresponds to the zero-th Fourier order. The magnitude of this pixel does not represent an oscillation, but just the average intensity of the volume in the current space. Luckily, this is a convention used in many EM packages an also in Matlab.

Note that this implies that the Fourier pixels conveying the Nyquist frequency in a direction are NOT to be found at the most positive indices of the Fourier volume. For instance, you might expect the Nyquist frequency for waves in the x direction to be conveyed in the pixel [N,N/2+1,N/2+1]. That's wrong: this pixel is located at a distance (measured between pixel centers) of N/2-1 pixels. The actual Nyquist frequency corresponds to pixel [0,N/2+1,N/2+1], which is at the correct distance. Remember, the theory of Discrete Fourier Transform on real volumes (as density maps are) tells us that all components of the power spectrum are center symmetric.... other than the Nyquist component, that appears only one for each direction (thus no redundancy)


When computing the Fourier Shell Correlation of two volumes, the central pixel is left aside from the computation.