Xmipp  v3.23.11-Nereus
tomo_tiltseries_dose_filter.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: J.L. Vilas jlvilas@cnb.csic.es
4  *
5  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA
21  *
22  * All comments concerning this program package may be sent to the
23  * e-mail address 'xmipp@cnb.csic.es'
24  ***************************************************************************/
25 /* This program is strongly based on the unblur code
26  * (http://grigoriefflab.janelia.org/unblur)
27 which has been realeased under the following copyright:
28 
29 The Janelia Farm Research Campus Software Copyright 1.1
30 
31 Copyright (c) 2014, Howard Hughes Medical Institute, All rights reserved.
32 
33 Redistribution and use in source and binary forms, with or without
34 modification, are permitted provided that the following conditions are met:
35 
36 
37 Redistributions of source code must retain the above copyright notice,
38  this list of conditions and the following disclaimer.
39 Redistributions in binary form must reproduce the above copyright notice,
40 this list of conditions and the following disclaimer in the documentation
41 and/or other materials provided with the distribution.
42 Neither the name of the Howard Hughes Medical Institute nor the names of
43 its contributors may be used to endorse or promote products derived from
44 this software without specific prior written permission.
45 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
46 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ANY
47 IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR A
48 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
49 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
50 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
51 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
52 REASONABLE ROYALTIES; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
55 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
56 */
57 #ifndef _PROG_TOMO_TILTSERIOES_DOSE_FILTER
58 #define _PROG_TOMO_TILTSERIOES_DOSE_FILTER
59 
60 #include <complex>
61 #include "core/xmipp_program.h"
62 #include "core/xmipp_filename.h"
63 #include "core/metadata_vec.h"
64 
65 template<typename T>
66 class MultidimArray;
67 
71 
74 {
75 public:
76 
81 
83 
85  double accVoltage;
88 
91 
94 
98 
100  double sampling;
101 
103  double maxFreq;
104 
105 
108 
109  // Fourier transforms of the input images
110  std::vector< MultidimArray<std::complex<double> > * > frameFourierVec;
111 
112 public:
114  void readParams();
115 
117  void show();
118 
120  void defineParams();
121 
123  void run();
124 
125  void initParameters();
126 
127  void readInputData(MetaDataVec &md);
128 
130  // factor due to radiation damage (as used by summovie)
131  double doseFilter(double dose_at_end_of_frame, double critical_dose);
132 
134  double criticalDose(double spatial_frequency);
135 
136 
138  double optimalDoseGivenCriticalDose(double critical_dose);
139 
141  void applyDoseFilterToImage(int Ydim, int Xdim, const MultidimArray< std::complex<double> > &FFT1, const double dose_finish);
142 
143 };
145 #endif
double criticalDose(double spatial_frequency)
Given a spatial frequency, return the critical dose in electrons per square Angstroms.
double optimalDoseGivenCriticalDose(double critical_dose)
Given the critical dose, return an estimate of the optimal dose (at which the SNR is maximised) ...
void applyDoseFilterToImage(int Ydim, int Xdim, const MultidimArray< std::complex< double > > &FFT1, const double dose_finish)
Apply a dose filter to the image Fourier transform.
double doseFilter(double dose_at_end_of_frame, double critical_dose)
Compute the dose filter, which is the signal attenuation.
void readParams()
Read argument from command line.
void defineParams()
Define parameters.
void readInputData(MetaDataVec &md)
bool restore_power
Restore noise power after filtering?&#39;, &#39;Renormalise the summed image after filtering.
std::vector< MultidimArray< std::complex< double > > *> frameFourierVec