I2PC / scipion-em-xmipp

Plugin to use Xmipp programs within the Scipion framework
GNU General Public License v3.0
11 stars 4 forks source link

fix header for resize voxels protocol #760

Closed jamesmkrieger closed 5 months ago

jamesmkrieger commented 5 months ago

The behaviour before was that the header would get the input volume sampling rate.

This is the commands that are run when we resize voxels from 1.05 A to 1.5 A (applying a factor of 0.7 with default spline interpolation):

> xmipp_transform_filter -i «output»:mrc -o «output-one» --fourier low_pass 0.350000
> xmipp_image_resize -i «output-one» --factor 0.7
> xmipp_image_header -i «output-one» --sampling_rate 1.05
jamesmkrieger commented 5 months ago

This doesn't work completely yet.

When I resize EMD 21457 (open spike) from 1.05 to 1.5 A, I get what I expect now:

** Running command: **
 xmipp_image_resize -i Runs/000056_XmippProtCropResizeVolumes/extra/output_volume.mrc --factor 0.700000
Input File: Runs/000056_XmippProtCropResizeVolumes/extra/output_volume.mrc
Output File: Runs/000056_XmippProtCropResizeVolumes/extra/output_volume.mrc_tmp.mrc
FINISHED: resizeStep, step 3, time 2024-01-11 11:56:10.503805
STARTED: createOutputStep, step 4, time 2024-01-11 11:56:11.931986
** Running command: **
 xmipp_image_header -i Runs/000056_XmippProtCropResizeVolumes/extra/output_volume.mrc --sampling_rate 1.500000
Input File: Runs/000056_XmippProtCropResizeVolumes/extra/output_volume.mrc
New sampling rate (Angstrom) = 1.5

However, now I have a problem with the case for not resizing (crop with window operation). It gives 1.00 instead of 1.05:

** Running command: **
 xmipp_transform_window -i Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc -o Runs/000108_XmippProtCropResizeVolumes/extra/output_volume.mrc  --size 100 
Input File: Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc
Output File: Runs/000108_XmippProtCropResizeVolumes/extra/output_volume.mrc
FINISHED: windowStep, step 2, time 2024-01-11 11:56:24.592078
STARTED: createOutputStep, step 3, time 2024-01-11 11:56:24.807895
** Running command: **
 xmipp_image_header -i Runs/000108_XmippProtCropResizeVolumes/extra/output_volume.mrc --sampling_rate 1.000000
Input File: Runs/000108_XmippProtCropResizeVolumes/extra/output_volume.mrc
New sampling rate (Angstrom) = 1

This is in contrast to the not resizing case without the fix:

** Running command: **
 xmipp_transform_window -i Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc -o Runs/000160_XmippProtCropResizeVolumes/extra/output_volume.mrc  --size 100 
Input File: Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc
Output File: Runs/000160_XmippProtCropResizeVolumes/extra/output_volume.mrc
FINISHED: windowStep, step 2, time 2024-01-11 11:59:50.463991
STARTED: createOutputStep, step 3, time 2024-01-11 11:59:51.290592
** Running command: **
 xmipp_image_header -i Runs/000160_XmippProtCropResizeVolumes/extra/output_volume.mrc --sampling_rate 1.050000
Input File: Runs/000160_XmippProtCropResizeVolumes/extra/output_volume.mrc
New sampling rate (Angstrom) = 1.05
jamesmkrieger commented 5 months ago

However, now I have a problem with the case for not resizing (crop with window operation). It gives 1.00 instead of 1.05:

** Running command: **
�[32m xmipp_transform_window -i Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc -o Runs/000108_XmippProtCropResizeVolumes/extra/output_volume.mrc  --size 100 �[0m
Input File: Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc
Output File: Runs/000108_XmippProtCropResizeVolumes/extra/output_volume.mrc
�[35mFINISHED�[0m: windowStep, step 2, time 2024-01-11 11:56:24.592078
�[35mSTARTED�[0m: createOutputStep, step 3, time 2024-01-11 11:56:24.807895
** Running command: **
�[32m xmipp_image_header -i Runs/000108_XmippProtCropResizeVolumes/extra/output_volume.mrc --sampling_rate 1.000000�[0m
Input File: Runs/000108_XmippProtCropResizeVolumes/extra/output_volume.mrc
New sampling rate (Angstrom) = 1

This is because I have a bad if condition. Now I've changed it and it works as expected:

 xmipp_transform_window -i Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc -o Runs/000282_XmippProtCropResizeVolumes/extra/output_volume.mrc  --size 100 
Input File: Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc
Output File: Runs/000282_XmippProtCropResizeVolumes/extra/output_volume.mrc
FINISHED: windowStep, step 2, time 2024-01-11 12:06:23.344860
STARTED: createOutputStep, step 3, time 2024-01-11 12:06:23.575840
** Running command: **
 xmipp_image_header -i Runs/000282_XmippProtCropResizeVolumes/extra/output_volume.mrc --sampling_rate 1.050000
Input File: Runs/000282_XmippProtCropResizeVolumes/extra/output_volume.mrc
New sampling rate (Angstrom) = 1.05
jamesmkrieger commented 5 months ago

I also confirmed that a preprocess job that isn't a crop/resize one (thresholding at 0) behaves as expected too:

** Running command: **
 xmipp_transform_threshold -i Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc -o Runs/000212_XmippProtPreprocessVolumes/extra/output_volume.mrc --select abs_below 0.000000 --substitute value  0.000000
Input File: Runs/000002_ProtImportVolumes/extra/emd_21457.map:mrc
Output File: Runs/000212_XmippProtPreprocessVolumes/extra/output_volume.mrc
FINISHED: thresholdStep, step 2, time 2024-01-11 12:08:47.870757
STARTED: createOutputStep, step 3, time 2024-01-11 12:08:48.168181
** Running command: **
 xmipp_image_header -i Runs/000212_XmippProtPreprocessVolumes/extra/output_volume.mrc --sampling_rate 1.050000
Input File: Runs/000212_XmippProtPreprocessVolumes/extra/output_volume.mrc
New sampling rate (Angstrom) = 1.05
sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud