how to get rotation and translation parameters after alignment

89 views
Skip to first unread message

Hamidreza

unread,
Jun 23, 2017, 8:49:05 AM6/23/17
to EMAN2
Dear Steve,

I am doing class averaging on a set of 2D images using e2refine2d function (with GUI). After doing the averaging, I need to somehow know the rotation and translation parameters of each of the images that are now fused in a single image (one of the classes).

Could you please tell if this is possible or not? Are these parameters stored in some files?

Best regards,
Hamidreza

Steve Ludtke

unread,
Jun 23, 2017, 12:07:40 PM6/23/17
to em...@googlegroups.com
Hi. Yes, the alignment information for the individual particles is stored for each iteration in the classmx_*hdf files. The images in these files are used like a matrix to store the information about the transformation. 

The overall file structure of EMAN2 projects is here:

Information on the contents of the classmx_* files specifically is here:

If your hope is to simply see the aligned images that went into a class average, you are supposed to be able to do this by displaying the set of class averages then holding down shift and double-clicking on the class-average you are interested in. This is supposed to open a new window with aligned particles. Unfortunately this seems to be broken at the moment, and what you see is unaligned particles  :^(

If your goal is to play around with alignments of individual particles, an easier approach might be to use e2classextract.py  (use --help for options)

--
--
----------------------------------------------------------------------------------------------
You received this message because you are subscribed to the Google
Groups "EMAN2" group.
To post to this group, send email to em...@googlegroups.com
To unsubscribe from this group, send email to eman2+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/eman2

---
You received this message because you are subscribed to the Google Groups "EMAN2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eman2+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

----------------------------------------------------------------------------
Steven Ludtke, Ph.D.
Professor, Dept of Biochemistry and Mol. Biol.         (www.bcm.edu/biochem)
Co-Director National Center For Macromolecular Imaging        (ncmi.bcm.edu)
Co-Director CIBR Center                          (www.bcm.edu/research/cibr)
Baylor College of Medicine                             





Hamidreza

unread,
Jul 6, 2017, 11:15:09 AM7/6/17
to EMAN2


Hi Steve

Thanks for your answer. I tried to extract alignment parameters from classmx_*.hdf files, however there are some issues that I cannot figure it out.

In order to see what is really going on, I have generated 10 synthetic images of the letter 'R' and rotated each of them by integer multiples of 90 degree. Then I applied e2refine2d() on them to do the averaging. I set ncls = 3 and iter = 8. After e2refine2d.py completed, I got 8 files named classes_01.hdf ... classes_08.hdf and one file which is called classes_init.hdf. Each of these contain 3 images numbered from 0 to 2.

On the other hand, I got 9 different classmx_00.hdf .. classmx_08.hdf files.

Here, could you please tell me how these classmx_xx.hdf files correspond to classes_xx.hdf files? Does classmx_00.hdf corresponds to classes_init.hdf and the rest according to their matched numbers?

Assuming that the correspondence between classmx_xx and classes_xx is as above, I tried to inspect the estimated rotation angles of particles for the class average 03 using the following commands in terminal:

1. read the class averages and particles correspondences (from image 0):
h5dump -d /MDF/images/0/image r2d_04/classmx_03.hdf

output:
HDF5 "r2d_04/classmx_03.hdf" {
DATASET "/MDF/images/0/image" {
   DATATYPE  H5T_IEEE_F32LE
   DATASPACE  SIMPLE { ( 10, 1 ) / ( 10, 1 ) }
   DATA {
   (0,0): 2,
   (1,0): 2,
   (2,0): 2,
   (3,0): 0,
   (4,0): 2,
   (5,0): 2,
   (6,0): 0,
   (7,0): 1,
   (8,0): 2,
   (9,0): 1
   }
}


2. read estimated rotation angles (from image 4):
h5dump -d /MDF/images/4/image r2d_04/classmx_03.hdf

output:
HDF5 "r2d_04/classmx_03.hdf" {
DATASET "/MDF/images/4/image" {
   DATATYPE  H5T_IEEE_F32LE
   DATASPACE  SIMPLE { ( 10, 1 ) / ( 10, 1 ) }
   DATA {
   (0,0): 0,
   (1,0): 270.286,
   (2,0): 180.857,
   (3,0): 90.5714,
   (4,0): 359.429,
   (5,0): 269.714,
   (6,0): 180,
   (7,0): 89.7143,
   (8,0): 0.571426,
   (9,0): 271.143
   }
}
}

With these outputs, I tried to figure out how these angles are relating the individual particles to their corresponding class averages but I am not sure if my interpretation is correct or wrong. So could you please help me to understand it clearly?
My interpretation is like this:
Indices in image 0 of classmx are telling that which particles goes with which class averages. Since, I set ncls to 3, the particles can belong to one of the three class averages and that is why we only have indices between 0 to 2.
In image 4, each row of the output defines the relative angle of that particle to its corresponding class average. For example, in the above, (0,0):0 means that the class average number 2 is aligned with the first image in the Included Particles and (1,0): 270.286 means that the second image in the Included Particles has a relative angle of ~270 degree with the class average number 2 and so on and so forth.

Could you please confirm if this interpretation is correct or not?

My last question goes here:
In the following I have attached the images for this class:
 
Class average 0:


Class average 1:



Class average 2:



Here, if you look at the class averages and their corresponding Included Particles, you will notice that except for the last class average (class 2), the rotation parameters for the other two classes do not match with the orientation of the included particles. For example, in class average 0, while the Included Particles are rotated by 0 and 90 degree, the estimated angles (by EMAN2) are 90 and 180 degree which is not visible in the class average. I mean if EMAN2 really estimated these angles (which are wrong) then why we cannot see two crossing R letter in the class average? What is wrong here?


Sorry for my long story and thanks in advance for your help.

Best regards,

Hamidreza

Steve Ludtke

unread,
Jul 6, 2017, 2:24:13 PM7/6/17
to em...@googlegroups.com
On Jul 6, 2017, at 10:15 AM, Hamidreza <hr.hei...@gmail.com> wrote:






Hi Steve

Thanks for your answer. I tried to extract alignment parameters from classmx_*.hdf files, however there are some issues that I cannot figure it out.

In order to see what is really going on, I have generated 10 synthetic images of the letter 'R' and rotated each of them by integer multiples of 90 degree. Then I applied e2refine2d() on them to do the averaging. I set ncls = 3 and iter = 8. After e2refine2d.py completed, I got 8 files named classes_01.hdf ... classes_08.hdf and one file which is called classes_init.hdf. Each of these contain 3 images numbered from 0 to 2.

On the other hand, I got 9 different classmx_00.hdf .. classmx_08.hdf files.

Here, could you please tell me how these classmx_xx.hdf files correspond to classes_xx.hdf files? Does classmx_00.hdf corresponds to classes_init.hdf and the rest according to their matched numbers?
The processing scheme for 2-D class-averaging (e2refine2d.py) is very different than that used for 3-D refinement (e2refine_easy.py). While your numbering scheme is correct, I fear the situation with respect to alignments is more complicated. In e2refine2d, particles are initially aligned only with respect to alirefs_<XX-1>.hdf. These alignments get stored in simmx_XX.hdf 

After alignment PCA with K-means is used to classify the already oriented particles. The final alignment to produce the class-averages is not actually being stored anywhere at present by e2refine2d.py. If you

grep e2classaverage.py .eman2log.txt|grep r2d_

you will see all of the e2classaverage commands used during 2D refinement. To save the final alignment information you need to include the --resultmx option on this command. In e2refine_easy.py this option is set, but not for e2refine2d.py

See:
for the overview of what this program does.

--
--
----------------------------------------------------------------------------------------------
You received this message because you are subscribed to the Google
Groups "EMAN2" group.
To post to this group, send email to em...@googlegroups.com
To unsubscribe from this group, send email to eman2+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/eman2

---
You received this message because you are subscribed to the Google Groups "EMAN2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eman2+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hamidreza

unread,
Jul 6, 2017, 4:01:01 PM7/6/17
to EMAN2
Hi Steve,

Thanks for you answer. So could you please tell me what are the angles that are stored in (image 4) classmx files after using e2refine2d()?

Actually, all of the particles that I have belong to a single class and what I am doing is to perform an averaging on them. However, since e2refine2d() is not working with ncls < 3, I have to set it to 3 otherwise I would like to have a single class average at the end. Is there a way in eman2 with which I can directly do that and at the end have the relative angle of all particles with respect to the averaging result?

Best regards,
Hamidreza

Steven Ludtke

unread,
Jul 6, 2017, 5:26:44 PM7/6/17
to em...@googlegroups.com
I suspect, but am not sure without checking, that this was the angle to bring the image into alignment with the appropriate alignment reference, copied from the simmx file...

----------------------------------------------------------------------------
Steven Ludtke, Ph.D.
Professor, Dept. of Biochemistry and Mol. Biol.                Those who do
Co-Director National Center For Macromolecular Imaging            ARE
Baylor College of Medicine                                     The converse
slu...@bcm.edu  -or-  ste...@alumni.caltech.edu               also applies
http://ncmi.bcm.edu/~stevel
Reply all
Reply to author
Forward
0 new messages