Skip to content

angular_project_library with non-trivial psi_sampling failing #1008

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

Open
jvdoorss opened this issue Apr 21, 2025 · 1 comment
Open

angular_project_library with non-trivial psi_sampling failing #1008

jvdoorss opened this issue Apr 21, 2025 · 1 comment

Comments

@jvdoorss
Copy link

I found that, when using angular_project_library, the image output of the projections is not as expected and in particular not in sync with the corresponding angular metadata. I suspect it being due to the indexing in this line:

P.write(output_file,(size_t) (numberStepsPsi * i + mypsi +1),true,WRITE_REPLACE);

To reproduce:

I did

xmipp_angular_project_library -i volume.vol -o images.mrcs --sampling_rate 22.5 --psi_sampling 22.5

on a 100x100x100 volume. 22.5 degrees was chosen for easy testing as kind of the the largest divisor of 360 below the sampling cut-off.

It produces an images.doc file with $92 \times 16 = 1472$ where 92 is the number of spatial directions (also the size without psi_sampling) and 16 = 360 / 22.5 the number of in-plane rotations. So far so good, this is exactly what you would want/expect. ✅

images.mrcs however contains 1703 images ($\neq 1472$) of whom all except 226 are empty. A possible explanation, consistent with the indexing in the line quoted above, is the following:

The (0-based) indices of this non-empty set correspond exactly to the unique values in the set
$\lbrace floor(i)+15 * j|i\in \lbrace 0,22.5,45,...337.5\rbrace, j\in \lbrace 0,...91\rbrace\rbrace$
with i, j indexing in-plane and spatial rotations, respectively and 15 being an (incorrect) offset numberStepsPsi. While the double loop spans the correct 1472 cases, the indices will go from 0 to 1702 = 91 * 15 + 337 but contains only 226 unique indices.

Possible fix, I think:
Using a counter rather than the angle mypsi clearly was the intention. Doing that correctly and ensuring numberStepsPsi is right, would yield the correct result here.

However, I guess adding an intrinsic label to the Sampling, used both when writing the images and angular metadata, would allow to avoid any mismatch and easily check unicity and give a more robust implementation? 🤔

@jvdoorss
Copy link
Author

Additionally, I think that replacing the 16 values of mypsi with the integers [0...15] would store the images in transposed order (psi as the inner counter, changing at every step) compared to the .doc metadata (psi the outer counter, changing every 92 samples).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant