stack numbering not updated in relion_image_handler
Issue description
If relion_image_handler is run with .star-file input where images reference a .mrcs-file, the output .star file images have numbers which refer to the input stack, even if the output stack is smaller.
Example: in.star has 3 lines refering to [email protected], [email protected], and [email protected].
in.mrcs has 3 images.
If one edits in.star to remove any reference to 01@mrcs, running
relion_image_handler --i in.star --o out
produces an output file in_out.star which refers to 03@in_out.mrcs, even though in_out.mrcs only has 2 images. Consequently, e.g.
relion_display --i in_out.star
will fail with
ERROR:
readMRC: Image number 3 exceeds stack size 2 of image in_out.mrcs
The image references are also incorrect, such that if a user decides to remedy the issue by removing any reference to 03@in_out.mrcs in in_out.star then 02@in_out.mrcs references image information from position 2 in the original stack, which is now in 01@in_out.mrcs.
As a result, simple manual removal of any entry in the input invalidates the references of all subsequent images. This should throw an error such as that by relion_display above, but is possible to circumvent by users in a manner that corrupts data references gracefully.
Environment:
- OS: ubuntu 22.04 LTS
- RELION version 5.0 b75b38c0
Job options:
- Type of job: relion_image_handler