31 #define OUTSIDE_WRAP 0 33 #define OUTSIDE_VALUE 2 47 std::cout <<
"Input movie: " <<
fnTs 48 << std::endl <<
"Output movie: " 50 <<
"Sampling: " <<
sampling << std::endl
51 <<
"Acceleration_Voltage (kV): " <<
accVoltage << std::endl;
56 addUsageLine(
"AThis algorithm applies a dose filter based on Grant & Grigorief eLife 2015. The result will be a low pass filtered tilt series based on the applied dose.");
57 addParamsLine(
" -i <tiltseries> : Metadata with the input tilt series");
58 addParamsLine(
" [-o <fn=\"out.mrcs\">] : Output path for the filtered tilt series.");
59 addParamsLine(
" [--sampling <Ts=1>] : Sampling rate (A/pixel)");
60 addParamsLine(
" [--voltage <voltage=300>] : Acceleration voltage (kV) min_value=200.0e0,max_value=300.0e0)");
62 addExampleLine(
"xmipp_tomo_tiltseries_dose_filter -i tiltseries.xmd -o . --sampling 2.2 --dosePerImage 2 --voltage 300");
63 addExampleLine(
"xmipp_tomo_tiltseries_dose_filter -i tiltseries.xmd -o . --sampling 2.2 --voltage 300");
69 return exp((-0.5 * dose_at_end_of_frame) / critical_dose);
89 if (accVoltage < 301 && accVoltage > 299.)
96 if (accVoltage < 201.0 && accVoltage > 199.0)
114 double current_critical_dose, current_optimal_dose;
115 int sizeX_2 = Xdim / 2;
116 double ixsize = 1.0 / Xdim;
117 int sizeY_2 = Ydim / 2;
118 double iysize = 1.0 / Ydim;
120 for (
long int i = 0;
i <
YSIZE(FFT1);
i++)
125 for (
long int j = 0;
j <
XSIZE(FFT1);
j++)
129 if (
i == 0 &&
j == 0)
138 current_optimal_dose = 2.51284 * current_critical_dose;
150 size_t Xdim, Ydim, Zdim, Ndim;
173 std::cout <<
" Starting filtering..."<< std::endl;
187 std::vector<FileName> ti_fn;
188 std::vector<double> ti_dose;
190 for (
size_t objId : mdts.
ids())
196 ti_fn.push_back(fnti);
197 ti_dose.push_back(doseTi);
205 for (
size_t objId : mdts.
ids())
210 tiltImage.
read(fnti);
double getDoubleParam(const char *param, int arg=0)
double criticalDose(double spatial_frequency)
Given a spatial frequency, return the critical dose in electrons per square Angstroms.
#define REPORT_ERROR(nerr, ErrormMsg)
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.
void sqrt(Image< double > &op)
#define DIRECT_A2D_ELEM(v, i, j)
void write(const FileName &name="", size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST, int _swapWrite=0)
double doseFilter(double dose_at_end_of_frame, double critical_dose)
Compute the dose filter, which is the signal attenuation.
#define FFT_IDX2DIGFREQ_FAST(idx, size, size_2, isize, freq)
void readParams()
Read argument from command line.
const char * getParam(const char *param, int arg=0)
Incorrect argument received.
void max(Image< double > &op1, const Image< double > &op2)
void addExampleLine(const char *example, bool verbatim=true)
int verbose
Verbosity level.
double critical_dose_at_dc
void defineParams()
Define parameters.
double voltage_scaling_factor
bool isMetaData(bool failIfNotExists=true) const
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
void addUsageLine(const char *line, bool verbatim=false)
void readInputData(MetaDataVec &md)
void addParamsLine(const String &line)