scipion-em-xmipp 24.12.2__py3-none-any.whl → 25.6.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.1.dist-info}/METADATA +10 -10
- scipion_em_xmipp-25.6.1.dist-info/RECORD +255 -0
- {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.1.dist-info}/WHEEL +1 -1
- {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.1.dist-info}/entry_points.txt +0 -1
- xmipp3/__init__.py +105 -72
- xmipp3/base.py +2 -1
- xmipp3/convert/convert.py +1 -1
- xmipp3/legacy/protocols/protocol_angular_resolution_alignment.py +204 -0
- xmipp3/legacy/protocols/protocol_apply_deformation_zernike3d.py +113 -0
- xmipp3/legacy/protocols/protocol_classification_gpuCorr.py +821 -0
- xmipp3/legacy/protocols/protocol_classification_gpuCorr_full.py +1014 -0
- xmipp3/legacy/protocols/protocol_classification_gpuCorr_semi.py +462 -0
- xmipp3/legacy/protocols/protocol_classify_kmeans2d.py +285 -0
- xmipp3/legacy/protocols/protocol_deep_align.py +859 -0
- xmipp3/legacy/protocols/protocol_deep_denoising.py +425 -0
- xmipp3/legacy/protocols/protocol_kmeans_clustering.py +122 -0
- xmipp3/legacy/protocols/protocol_metaprotocol_create_output.py +146 -0
- xmipp3/legacy/protocols/protocol_metaprotocol_create_subset.py +96 -0
- xmipp3/legacy/protocols/protocol_metaprotocol_discrete_heterogeneity_scheduler.py +516 -0
- xmipp3/legacy/protocols/protocol_metaprotocol_golden_highres.py +663 -0
- xmipp3/legacy/protocols/protocol_mltomo.py +576 -0
- xmipp3/legacy/protocols/protocol_movie_average.py +202 -0
- xmipp3/legacy/protocols/protocol_movie_opticalflow.py +416 -0
- xmipp3/legacy/protocols/protocol_particle_boxsize.py +133 -0
- xmipp3/legacy/protocols/protocol_reconstruct_heterogeneous.py +1031 -0
- xmipp3/legacy/protocols/protocol_rotational_spectra.py +212 -0
- xmipp3/legacy/protocols/protocol_solid_angles.py +632 -0
- xmipp3/legacy/protocols/protocol_split_volume.py +112 -0
- xmipp3/legacy/protocols/protocol_split_volume_hierarchical_cluster.py +865 -0
- xmipp3/legacy/protocols/protocol_subtract_projection.py +265 -0
- xmipp3/legacy/tests/test_protocol_deep_denoising.py +64 -0
- xmipp3/legacy/tests/test_protocols_angular_resolution_alignment.py +88 -0
- xmipp3/legacy/tests/test_protocols_gpuCorr_classifier.py +141 -0
- xmipp3/legacy/tests/test_protocols_gpuCorr_fullStreaming.py +172 -0
- xmipp3/legacy/tests/test_protocols_gpuCorr_semiStreaming.py +68 -0
- xmipp3/legacy/tests/test_protocols_metaprotocol_golden_highres.py +96 -0
- xmipp3/legacy/tests/test_protocols_metaprotocol_heterogeneity.py +78 -0
- xmipp3/legacy/tests/test_protocols_mixed_movies.py +148 -0
- xmipp3/legacy/tests/test_protocols_solid_angles.py +161 -0
- xmipp3/legacy/tests/test_protocols_subtract_projection.py +595 -0
- xmipp3/legacy/tests/test_protocols_xmipp_movies.py +229 -0
- xmipp3/legacy/viewers/viewer_angular_resolution_alignment.py +148 -0
- xmipp3/legacy/viewers/viewer_deep_align.py +121 -0
- xmipp3/legacy/viewers/viewer_metaprotocol_golden_highres.py +140 -0
- xmipp3/legacy/viewers/viewer_mltomo.py +297 -0
- xmipp3/legacy/viewers/viewer_solid_angles.py +91 -0
- xmipp3/legacy/viewers/viewer_split_volume.py +57 -0
- xmipp3/protocols/__init__.py +1 -2
- xmipp3/protocols/protocol_align_volume.py +34 -8
- xmipp3/protocols/protocol_apply_alignment.py +1 -1
- xmipp3/protocols/protocol_apply_tilt_to_ctf.py +2 -3
- xmipp3/protocols/protocol_apply_zernike3d.py +2 -1
- xmipp3/protocols/protocol_assignment_tilt_pair.py +1 -2
- xmipp3/protocols/protocol_center_particles.py +1 -1
- xmipp3/protocols/protocol_cl2d.py +1 -2
- xmipp3/protocols/protocol_cl2d_align.py +1 -1
- xmipp3/protocols/protocol_cl2d_clustering.py +1 -1
- xmipp3/protocols/protocol_classify_pca.py +25 -9
- xmipp3/protocols/protocol_classify_pca_streaming.py +67 -42
- xmipp3/protocols/protocol_compute_likelihood.py +368 -0
- xmipp3/protocols/protocol_consensus_local_ctf.py +1 -1
- xmipp3/protocols/protocol_convert_pdb.py +9 -1
- xmipp3/protocols/protocol_create_gallery.py +1 -1
- xmipp3/protocols/protocol_ctf_consensus.py +14 -8
- xmipp3/protocols/protocol_ctf_correct_wiener2d.py +1 -1
- xmipp3/protocols/protocol_ctf_micrographs.py +1 -1
- xmipp3/protocols/protocol_deep_center_predict.py +10 -1
- xmipp3/protocols/protocol_deep_hand.py +19 -2
- xmipp3/protocols/protocol_deep_micrograph_screen.py +1 -1
- xmipp3/protocols/protocol_extract_asymmetric_unit.py +1 -1
- xmipp3/protocols/protocol_extract_particles.py +22 -10
- xmipp3/protocols/protocol_extract_particles_movies.py +1 -1
- xmipp3/protocols/protocol_extract_particles_pairs.py +1 -1
- xmipp3/protocols/protocol_flexalign.py +3 -4
- xmipp3/protocols/protocol_helical_parameters.py +1 -4
- xmipp3/protocols/protocol_movie_alignment_consensus.py +122 -40
- xmipp3/protocols/protocol_movie_dose_analysis.py +79 -82
- xmipp3/protocols/protocol_movie_max_shift.py +6 -2
- xmipp3/protocols/protocol_movie_split_frames.py +165 -88
- xmipp3/protocols/protocol_particle_pick_automatic.py +1 -2
- xmipp3/protocols/protocol_particle_pick_consensus.py +7 -0
- xmipp3/protocols/protocol_particle_pick_pairs.py +1 -1
- xmipp3/protocols/protocol_phantom_create.py +1 -1
- xmipp3/protocols/protocol_pick_noise.py +1 -1
- xmipp3/protocols/protocol_postProcessing_deepPostProcessing.py +5 -5
- xmipp3/protocols/protocol_preprocess/protocol_crop_resize.py +3 -2
- xmipp3/protocols/protocol_preprocess/protocol_filter.py +2 -2
- xmipp3/protocols/protocol_preprocess/protocol_image_operate.py +2 -2
- xmipp3/protocols/protocol_preprocess/protocol_mask.py +1 -1
- xmipp3/protocols/protocol_preprocess/protocol_preprocess.py +6 -4
- xmipp3/protocols/protocol_preprocess/protocol_process.py +20 -7
- xmipp3/protocols/protocol_preprocess_micrographs.py +3 -2
- xmipp3/protocols/protocol_projmatch/projmatch_steps.py +1 -1
- xmipp3/protocols/protocol_projmatch/protocol_projmatch.py +1 -1
- xmipp3/protocols/protocol_random_conical_tilt.py +1 -2
- xmipp3/protocols/protocol_ransac.py +41 -37
- xmipp3/protocols/protocol_reconstruct_fourier.py +5 -1
- xmipp3/protocols/protocol_reconstruct_highres.py +13 -7
- xmipp3/protocols/protocol_reconstruct_significant.py +14 -21
- xmipp3/protocols/protocol_resolution3d.py +1 -1
- xmipp3/protocols/protocol_resolution_deepres.py +1 -1
- xmipp3/protocols/protocol_resolution_directional.py +1 -1
- xmipp3/protocols/protocol_resolution_fso.py +1 -1
- xmipp3/protocols/protocol_resolution_monogenic_signal.py +19 -4
- xmipp3/protocols/protocol_rotate_volume.py +1 -1
- xmipp3/protocols/protocol_screen_deepConsensus.py +25 -5
- xmipp3/protocols/protocol_shift_volume.py +1 -1
- xmipp3/protocols/protocol_simulate_ctf.py +5 -3
- xmipp3/protocols/protocol_structure_map.py +9 -1
- xmipp3/protocols/protocol_subtract_projection.py +25 -10
- xmipp3/protocols/protocol_tilt_analysis.py +3 -3
- xmipp3/protocols/protocol_validate_fscq.py +2 -2
- xmipp3/protocols/protocol_validate_nontilt.py +1 -1
- xmipp3/protocols/protocol_volume_adjust_sub.py +8 -4
- xmipp3/protocols/protocol_volume_deform_zernike3d.py +1 -1
- xmipp3/protocols/protocol_volume_local_sharpening.py +1 -1
- xmipp3/protocols/protocol_volume_strain.py +1 -1
- xmipp3/protocols.conf +1 -3
- xmipp3/tests/test_protocol_likelihood.py +240 -0
- xmipp3/tests/test_protocol_split_frames.py +136 -0
- xmipp3/tests/test_protocol_validate_fscq.py +2 -2
- xmipp3/tests/test_protocols_highres.py +44 -5
- xmipp3/tests/test_protocols_xmipp_2d.py +1 -48
- xmipp3/tests/test_protocols_xmipp_mics.py +20 -16
- xmipp3/tests/test_protocols_xmipp_movies.py +4 -4
- xmipp3/version.py +5 -5
- xmipp3/viewers/__init__.py +1 -1
- xmipp3/viewers/viewer_LL_matrix.py +273 -0
- xmipp3/viewers/viewer_deep_consensus.py +1 -7
- xmipp3/viewers/viewer_dose_analysis.py +18 -2
- xmipp3/viewers/viewer_resolution_fso.py +18 -6
- xmipp3/viewers/viewer_structure_map.py +53 -11
- xmipp3/wizards.py +3 -2
- xmipp3/xmipp_logo_devel.png +0 -0
- scipion_em_xmipp-24.12.2.dist-info/RECORD +0 -210
- {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.1.dist-info}/LICENSE +0 -0
- {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.1.dist-info}/top_level.txt +0 -0
- /xmipp3/{protocols → legacy/protocols}/protocol_enrich.py +0 -0
- /xmipp3/{protocols → legacy/protocols}/protocol_screen_deeplearning.py +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# **************************************************************************
|
|
3
|
+
# *
|
|
4
|
+
# * Authors: Jose Luis Vilas (jlvilas@cnb.csic.es)
|
|
5
|
+
# *
|
|
6
|
+
# * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
|
|
7
|
+
# *
|
|
8
|
+
# * This program is free software; you can redistribute it and/or modify
|
|
9
|
+
# * it under the terms of the GNU General Public License as published by
|
|
10
|
+
# * the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# * (at your option) any later version.
|
|
12
|
+
# *
|
|
13
|
+
# * This program is distributed in the hope that it will be useful,
|
|
14
|
+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# * GNU General Public License for more details.
|
|
17
|
+
# *
|
|
18
|
+
# * You should have received a copy of the GNU General Public License
|
|
19
|
+
# * along with this program; if not, write to the Free Software
|
|
20
|
+
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
21
|
+
# * 02111-1307 USA
|
|
22
|
+
# *
|
|
23
|
+
# * All comments concerning this program package may be sent to the
|
|
24
|
+
# * e-mail address 'scipion@cnb.csic.es'
|
|
25
|
+
# *
|
|
26
|
+
# **************************************************************************
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
import os
|
|
30
|
+
from pyworkflow import VERSION_2_0
|
|
31
|
+
from pyworkflow.utils import getExt
|
|
32
|
+
from pyworkflow.protocol.params import (PointerParam, BooleanParam, FloatParam,
|
|
33
|
+
LEVEL_ADVANCED)
|
|
34
|
+
from pwem.protocols import ProtAnalysis3D
|
|
35
|
+
|
|
36
|
+
RADIAL_RESOLUTION_FN = 'radial_FSC_resolution.xmd'
|
|
37
|
+
|
|
38
|
+
class XmippProtResolutionAlignment(ProtAnalysis3D):
|
|
39
|
+
"""
|
|
40
|
+
Given two half maps the protocol estimates if the reconstruction presents angular
|
|
41
|
+
alignment errors. To do that, a set of directional FSC along all possible directions
|
|
42
|
+
are estimated. The result is a curve Resolution-radius. If this curve presents a slope
|
|
43
|
+
then the map present angular assignment errors, but it the graph is flat (horizontal), the map
|
|
44
|
+
is error free. Note that this protocol generates a plot, not a Scipion object. Its result
|
|
45
|
+
can only be visualized.
|
|
46
|
+
"""
|
|
47
|
+
_label = 'resolution alignment'
|
|
48
|
+
_lastUpdateVersion = VERSION_2_0
|
|
49
|
+
|
|
50
|
+
def __init__(self, **args):
|
|
51
|
+
ProtAnalysis3D.__init__(self, **args)
|
|
52
|
+
|
|
53
|
+
# --------------------------- DEFINE param functions ----------------------
|
|
54
|
+
def _defineParams(self, form):
|
|
55
|
+
form.addSection(label='Input')
|
|
56
|
+
|
|
57
|
+
form.addParam('halfVolumesFile', BooleanParam, default=False,
|
|
58
|
+
label="Are the half volumes stored with the input volume?",
|
|
59
|
+
help='Usually, the half volumes are stored as properties of '
|
|
60
|
+
'the input volume. If this is not the case, set this to '
|
|
61
|
+
'False and specify the two halves you want to use.')
|
|
62
|
+
|
|
63
|
+
form.addParam('inputHalves', PointerParam, pointerClass='Volume',
|
|
64
|
+
label="Input Half Maps",
|
|
65
|
+
condition='halfVolumesFile',
|
|
66
|
+
help='Select a half maps for determining its '
|
|
67
|
+
' resolution anisotropy and resolution.')
|
|
68
|
+
|
|
69
|
+
form.addParam('half1', PointerParam, pointerClass='Volume',
|
|
70
|
+
condition="not halfVolumesFile",
|
|
71
|
+
label="Half Map 1", important=True,
|
|
72
|
+
help='Select one map for determining the '
|
|
73
|
+
'directional FSC resolution.')
|
|
74
|
+
|
|
75
|
+
form.addParam('half2', PointerParam, pointerClass='Volume',
|
|
76
|
+
condition="not halfVolumesFile",
|
|
77
|
+
label="Half Map 2", important=True,
|
|
78
|
+
help='Select the second map for determining the '
|
|
79
|
+
'directional FSC resolution.')
|
|
80
|
+
|
|
81
|
+
form.addParam('mask', PointerParam, pointerClass='VolumeMask',
|
|
82
|
+
allowsNull=True,
|
|
83
|
+
label="Mask",
|
|
84
|
+
help='The mask determines which points are specimen'
|
|
85
|
+
' and which are not')
|
|
86
|
+
|
|
87
|
+
form.addParam('helicalReconstruction', BooleanParam, default=False,
|
|
88
|
+
label="Is a the protein a helix",
|
|
89
|
+
help='blablabla')
|
|
90
|
+
|
|
91
|
+
form.addParam('limRadius', BooleanParam, default=True,
|
|
92
|
+
expertLevel=LEVEL_ADVANCED,
|
|
93
|
+
label="Limit the protein radius",
|
|
94
|
+
help='blablabla')
|
|
95
|
+
|
|
96
|
+
form.addParam('usedirectionalfsc', BooleanParam, default=True,
|
|
97
|
+
expertLevel=LEVEL_ADVANCED,
|
|
98
|
+
label="use directional fsc",
|
|
99
|
+
help='blablabla')
|
|
100
|
+
|
|
101
|
+
form.addParam('coneAngle', FloatParam, default=17.0,
|
|
102
|
+
expertLevel=LEVEL_ADVANCED,
|
|
103
|
+
label="Cone Angle",
|
|
104
|
+
help='Angle between the axis of the cone and the generatrix. '
|
|
105
|
+
'An angle of 17 degrees is the best angle (see publication'
|
|
106
|
+
'Vilas 2021) to measuare directional FSCs')
|
|
107
|
+
|
|
108
|
+
form.addParam('threshold', FloatParam, expertLevel=LEVEL_ADVANCED,
|
|
109
|
+
default=0.143,
|
|
110
|
+
label="FSC Threshold",
|
|
111
|
+
help='Threshold for the fsc. By default the standard 0.143. '
|
|
112
|
+
'Other common thresholds are 0.5 and 0.3.')
|
|
113
|
+
|
|
114
|
+
form.addParallelSection(threads=4, mpi=0)
|
|
115
|
+
|
|
116
|
+
# --------------------------- INSERT steps functions --------------------------------------------
|
|
117
|
+
def _insertAllSteps(self):
|
|
118
|
+
self._insertFunctionStep(self.convertInputStep)
|
|
119
|
+
self._insertFunctionStep(self.angularResolutionAlignmentStep)
|
|
120
|
+
|
|
121
|
+
def convertInputStep(self):
|
|
122
|
+
""" This function sets the maps properly into mrc
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
if self.halfVolumesFile:
|
|
126
|
+
self.vol1Fn, self.vol2Fn = self.inputHalves.get().getHalfMaps().split(',')
|
|
127
|
+
else:
|
|
128
|
+
self.vol1Fn = self.half1.get().getFileName()
|
|
129
|
+
self.vol2Fn = self.half2.get().getFileName()
|
|
130
|
+
|
|
131
|
+
extVol1 = getExt(self.vol1Fn)
|
|
132
|
+
extVol2 = getExt(self.vol2Fn)
|
|
133
|
+
|
|
134
|
+
if (extVol1 == '.mrc') or (extVol1 == '.map'):
|
|
135
|
+
self.vol1Fn = self.vol1Fn + ':mrc'
|
|
136
|
+
if (extVol2 == '.mrc') or (extVol2 == '.map'):
|
|
137
|
+
self.vol2Fn = self.vol2Fn + ':mrc'
|
|
138
|
+
|
|
139
|
+
if self.mask.hasValue():
|
|
140
|
+
self.maskFn = self.mask.get().getFileName()
|
|
141
|
+
extMask = getExt(self.maskFn)
|
|
142
|
+
if (extMask == '.mrc') or (extMask == '.map'):
|
|
143
|
+
self.maskFn = self.maskFn + ':mrc'
|
|
144
|
+
|
|
145
|
+
def angularResolutionAlignmentStep(self):
|
|
146
|
+
"""
|
|
147
|
+
This function runs the algorithm to detect misalignment
|
|
148
|
+
"""
|
|
149
|
+
fndir = self._getExtraPath("fsc")
|
|
150
|
+
|
|
151
|
+
os.mkdir(fndir)
|
|
152
|
+
|
|
153
|
+
params = ' --half1 "%s"' % self.vol1Fn
|
|
154
|
+
params += ' --half2 "%s"' % self.vol2Fn
|
|
155
|
+
params += ' -o %s' % self._getExtraPath(RADIAL_RESOLUTION_FN)
|
|
156
|
+
if self.halfVolumesFile:
|
|
157
|
+
params += ' --sampling %f' % self.inputHalves.get().getSamplingRate()
|
|
158
|
+
else:
|
|
159
|
+
params += ' --sampling %f' % self.half1.get().getSamplingRate()
|
|
160
|
+
|
|
161
|
+
if self.helicalReconstruction.get():
|
|
162
|
+
params += ' --helix '
|
|
163
|
+
|
|
164
|
+
if self.mask.hasValue():
|
|
165
|
+
params += ' --mask "%s"' % self.maskFn
|
|
166
|
+
if self.limRadius.get():
|
|
167
|
+
params += ' --limit_radius '
|
|
168
|
+
if self.usedirectionalfsc.get():
|
|
169
|
+
params += ' --directional_resolution '
|
|
170
|
+
params += ' --anglecone %f' % self.coneAngle.get()
|
|
171
|
+
|
|
172
|
+
params += ' --threshold %s' % self.threshold.get()
|
|
173
|
+
params += ' --threads %s' % self.numberOfThreads.get()
|
|
174
|
+
|
|
175
|
+
self.runJob('xmipp_angular_resolution_alignment', params)
|
|
176
|
+
|
|
177
|
+
# --------------------------- INFO functions ------------------------------
|
|
178
|
+
|
|
179
|
+
def _methods(self):
|
|
180
|
+
messages = []
|
|
181
|
+
ARTICLE_URL = 'Pending on publication'
|
|
182
|
+
messages.append('Information about the method/article in ' + ARTICLE_URL)
|
|
183
|
+
|
|
184
|
+
return messages
|
|
185
|
+
|
|
186
|
+
def _validate(self):
|
|
187
|
+
errors = []
|
|
188
|
+
|
|
189
|
+
if self.halfVolumesFile.get():
|
|
190
|
+
if not self.inputHalves.get():
|
|
191
|
+
errors.append("You need to select the Associated halves")
|
|
192
|
+
else:
|
|
193
|
+
if not self.half1.get():
|
|
194
|
+
errors.append("You need to select the half1")
|
|
195
|
+
if not self.half2.get():
|
|
196
|
+
errors.append("You need to select the half2")
|
|
197
|
+
|
|
198
|
+
return errors
|
|
199
|
+
|
|
200
|
+
def _summary(self):
|
|
201
|
+
summary = []
|
|
202
|
+
summary.append("This protocol does not produce Scipion Objects as output. Click on Analyze results to visualize the results")
|
|
203
|
+
return summary
|
|
204
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# # *************************************************
|
|
2
|
+
# # * This protocol will be offered in future releases (more testing is needed)
|
|
3
|
+
# # * TODO: If this protocol is added, check that sampling rate is properly set in header of mrc
|
|
4
|
+
# # *************************************************
|
|
5
|
+
|
|
6
|
+
# # **************************************************************************
|
|
7
|
+
# # *
|
|
8
|
+
# # * Authors: David Herreros Calero (dherreros@cnb.csic.es)
|
|
9
|
+
# # *
|
|
10
|
+
# # * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
|
|
11
|
+
# # *
|
|
12
|
+
# # * This program is free software; you can redistribute it and/or modify
|
|
13
|
+
# # * it under the terms of the GNU General Public License as published by
|
|
14
|
+
# # * the Free Software Foundation; either version 2 of the License, or
|
|
15
|
+
# # * (at your option) any later version.
|
|
16
|
+
# # *
|
|
17
|
+
# # * This program is distributed in the hope that it will be useful,
|
|
18
|
+
# # * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
+
# # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20
|
+
# # * GNU General Public License for more details.
|
|
21
|
+
# # *
|
|
22
|
+
# # * You should have received a copy of the GNU General Public License
|
|
23
|
+
# # * along with this program; if not, write to the Free Software
|
|
24
|
+
# # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
25
|
+
# # * 02111-1307 USA
|
|
26
|
+
# # *
|
|
27
|
+
# # * All comments concerning this program package may be sent to the
|
|
28
|
+
# # * e-mail address 'scipion@cnb.csic.es'
|
|
29
|
+
# # *
|
|
30
|
+
# # **************************************************************************
|
|
31
|
+
#
|
|
32
|
+
# import os, glob
|
|
33
|
+
# import numpy as np
|
|
34
|
+
#
|
|
35
|
+
# from pwem.protocols import ProtAnalysis3D
|
|
36
|
+
# from pwem.objects import Volume, Integer
|
|
37
|
+
# import pwem.emlib.metadata as md
|
|
38
|
+
# import pyworkflow.protocol.params as params
|
|
39
|
+
# import pyworkflow.utils as pwutils
|
|
40
|
+
#
|
|
41
|
+
#
|
|
42
|
+
# class XmippProtApplyZernike3D(ProtAnalysis3D):
|
|
43
|
+
# """ Protocol to apply the deformation computed through spherical harmonics to
|
|
44
|
+
# EM maps. """
|
|
45
|
+
# _label = 'apply deformation - Zernike3D'
|
|
46
|
+
#
|
|
47
|
+
# # --------------------------- DEFINE param functions --------------------------------------------
|
|
48
|
+
# def _defineParams(self, form):
|
|
49
|
+
# form.addSection(label='Input')
|
|
50
|
+
# form.addParam('inputVol', params.PointerParam, label="Input volume",
|
|
51
|
+
# pointerClass='Volume', important=True,
|
|
52
|
+
# help='Select a Volume to be deformed.')
|
|
53
|
+
# form.addParam('inputClasses', params.PointerParam, pointerClass='SetOfClasses2D',
|
|
54
|
+
# label="Input Coefficients", important=True,
|
|
55
|
+
# help='Specify a path to the deformation coefficients metadata.')
|
|
56
|
+
#
|
|
57
|
+
# # --------------------------- INSERT steps functions -----------------------
|
|
58
|
+
# def _insertAllSteps(self):
|
|
59
|
+
# self._insertFunctionStep("deformStep")
|
|
60
|
+
# self._insertFunctionStep("createOutputStep")
|
|
61
|
+
#
|
|
62
|
+
# # --------------------------- STEPS functions ------------------------------
|
|
63
|
+
# def deformStep(self):
|
|
64
|
+
# self.samplingRate_Volume = self.inputVol.get().getSamplingRate()
|
|
65
|
+
# self.outParams = []
|
|
66
|
+
# classes = self.inputClasses.get()
|
|
67
|
+
# self.samplingRate_Coefficients = classes.getSamplingRate()
|
|
68
|
+
# correctionFactor = self.samplingRate_Coefficients / self.samplingRate_Volume
|
|
69
|
+
# for rep in classes.iterItems():
|
|
70
|
+
# basisParams = [rep.L1, rep.L2, rep.Rmax]
|
|
71
|
+
# coeffs = rep.getRepresentative().get()
|
|
72
|
+
# coeffs = np.fromstring(coeffs, sep=',')
|
|
73
|
+
# coeffs = correctionFactor * coeffs
|
|
74
|
+
# idx = rep.getObjId() + 1
|
|
75
|
+
# file = self._getTmpPath('coeffs.txt')
|
|
76
|
+
# # np.savetxt(file, coeffs)
|
|
77
|
+
# with open(file, 'w') as fid:
|
|
78
|
+
# fid.write(' '.join(map(str, basisParams)) + "\n")
|
|
79
|
+
# fid.write(' '.join(map(str, coeffs)) + "\n")
|
|
80
|
+
# outFile = pwutils.removeBaseExt(self.inputVol.get().getFileName()) + '_%d_deformed.mrc' % idx
|
|
81
|
+
# params = ' -i %s --clnm %s -o %s' % \
|
|
82
|
+
# (self.inputVol.get().getFileName(), file, self._getExtraPath(outFile))
|
|
83
|
+
# self.runJob("xmipp_volume_apply_deform_sph", params)
|
|
84
|
+
# params = ' -i %s --sampling_rate %f' % (self._getExtraPath(outFile), self.samplingRate_Volume)
|
|
85
|
+
# self.runJob("xmipp_image_header", params)
|
|
86
|
+
# self.outParams.append((self._getExtraPath(outFile), rep.getSize()))
|
|
87
|
+
#
|
|
88
|
+
# def createOutputStep(self):
|
|
89
|
+
# classes3DSet = self._createSetOfClasses3D(self.inputClasses.get().getImages())
|
|
90
|
+
# classes3DSet.classifyItems(updateItemCallback=self._updateParticle,
|
|
91
|
+
# updateClassCallback=self._updateClass,
|
|
92
|
+
# itemDataIterator=self.iterClassesId())
|
|
93
|
+
# result = {'outputClasses': classes3DSet}
|
|
94
|
+
# self._defineOutputs(**result)
|
|
95
|
+
# self._defineSourceRelation(self.inputClasses, classes3DSet)
|
|
96
|
+
# self._defineOutputs(**result)
|
|
97
|
+
# self._defineSourceRelation(self.inputVol, classes3DSet)
|
|
98
|
+
#
|
|
99
|
+
# # ------------------------------- UTILS functions -------------------------------
|
|
100
|
+
# def _updateParticle(self, item, idc):
|
|
101
|
+
# item.setClassId(idc)
|
|
102
|
+
#
|
|
103
|
+
# def _updateClass(self, item):
|
|
104
|
+
# representative = item.getRepresentative()
|
|
105
|
+
# volumeFile = pwutils.removeBaseExt(self.inputVol.get().getFileName()) + '_%d_deformed.mrc' \
|
|
106
|
+
# % (item.getObjId() + 1)
|
|
107
|
+
# volumeFile = self._getExtraPath(volumeFile)
|
|
108
|
+
# representative.setSamplingRate(self.samplingRate_Volume)
|
|
109
|
+
# representative.setLocation(volumeFile)
|
|
110
|
+
#
|
|
111
|
+
# def iterClassesId(self):
|
|
112
|
+
# for img in self.inputClasses.get().iterClassItems():
|
|
113
|
+
# yield img.getClassId()
|