Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial_classification_FD gives incorrect angles #31

Closed
janden opened this issue Mar 28, 2017 · 1 comment
Closed

Initial_classification_FD gives incorrect angles #31

janden opened this issue Mar 28, 2017 · 1 comment
Labels

Comments

@janden
Copy link
Contributor

janden commented Mar 28, 2017

Specifically, it doesn't seem to give the same angles as the old Initial_classification when dealing with flipped/reflected images. To see this, consider the test script

n = 1024;
sigma = 0.5;

n_nbor = 3;

f = load('cleanrib.mat');
vol = f.volref(1:4:end,1:4:end,1:4:end);
vol = vol/max(vol(:));

qs = qrand(n);

im_clean = cryo_project(vol, qs);

im = im_clean+sigma*randn(size(im_clean));

[sPCA_data, ~, ~, recon_spca] = data_sPCA(im, sigma^2);

[class, class_refl, class_rot] = Initial_classification_FD(sPCA_data, n_nbor, false);

fname = tempname;
WriteMRC(im, 1, fname);
im_reader = imagestackReader(fname);

tmpdir = tempname;
mkdir(tmpdir);

[~, ~, im_ave_file, ~] = ...
    align_main(im_reader, class_rot, class, class_refl, sPCA_data, n_nbor, 0, 1:n, recon_spca, tmpdir);

delete(fname);
rmdir(tmpdir);

im_ave = ReadMRC(im_ave_file);

delete(im_ave_file);

disp(norm(im(:)-im_clean(:))^2/norm(im_clean(:))^2);
disp(norm(im_ave(:)-im_clean(:))^2/norm(im_clean(:))^2);

Now adding the line

class_rot(class_refl==2) = mod(class_rot(class_refl==2)+180, 360);

just after the call to Initial_classification_FD brings down the MSE from about 0.65 to 0.50. The difference is even greater in less noisy situations, when the MSE for the class averages will actually be larger than those of the original images when not correcting for the angles.

Presumably this has something to do with how the sPCA coefficients and/or bispectrum is computed in the new version. That being said, adding the above line to the Initial_classification_FD should solve the problem.

@janden janden added the bug label Mar 28, 2017
janden added a commit that referenced this issue Mar 30, 2017
Per issue #31, Initial_classification_FD gives the wrong angles
for the rotated images (compared to what Initial_classification
gives and align_main expects). This is fixed by correcting those
angles.
@janden
Copy link
Contributor Author

janden commented Mar 30, 2017

Fixed (hopefully) in 39950dd.

@janden janden closed this as completed Mar 30, 2017
@janden janden reopened this Mar 30, 2017
@janden janden closed this as completed Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant