float* logI;
float* normII;
float* logII;
+
+ int MTFmode;
intensityforbayesMode mode;
/* prototype begin */
/*ctfforbayes.c*/
extern void ctfforbayesInit(FILE* fpt, ctfforbayes* ctf, int mode);
-extern void intensityforbayesInit(intensityforbayes* intensity,int Inum, int mode);
+extern void intensityforbayesInit(intensityforbayes* intensity,int Inum, int MTFmode, int mode);
extern void intensitySet(ctfforbayes* ctf, intensityforbayes* intensity, int mode);
extern void spatialfrequencyRead(FILE* fpt, ctfforbayes* ctf, float rmax, float rmin, int mode);
extern void intensityRead(char* filename, intensityforbayes* intensity, int count, int mode);
extern void ctfFunctionforbayes(ctfforbayes* ctf, intensityforbayes* intensity, eosBayes* d, ctfInfo* info, defocuslikelihoodforbayes* l, int count, int mode);
extern float MTFFunctionforbayes(float R, float m, int mode);
-extern float ctfforbayesIntensityCalculation(float* parameter, float R, ctfInfo* info, int mode);
-extern void ctfforbayesFree(ctfforbayes* ctf, intensityforbayes* intensity, defocuslikelihoodforbayes* likedihood);
+extern float ctfforbayesIntensityCalculation(float* parameter, float R, ctfInfo* info, int MTFmode, int mode);
+ extern void ctfforbayesFree(ctfforbayes* ctf, intensityforbayes* intensity, defocuslikelihoodforbayes* likedihood, int numLikelihood);
-/*defocuslikelihood.c*/
+ /*defocuslikelihood.c*/
extern void defocusLikelihoodInit(defocuslikelihoodforbayes* l, eosBayes d, int mode);
extern void ctfforbayesXofLikelihoodCalculation(defocuslikelihoodforbayes* l, ctfforbayes* ctf, eosBayes* d, int* L, int count, int mode);
extern void defocusLikelihood(defocuslikelihoodforbayes* l, ctfforbayes* ctf, eosBayes* d, int count, int mode);
extern void ctfforbayescheckRvsValue(char* filename, float R,float value, int count);
extern void ctfforbayescheckdifference(char* filename, defocuslikelihoodforbayes* l, eosBayesDistribution* d, int numLikelihood, int count, int mode);
extern void ctfforbayescheckintensity(ctfforbayes ctf, eosBayesDistribution* d, int numLikelihood, int count, int mode);
-extern void ctfforbayescheckIntensityOfMaxPosterior(ctfforbayes ctf, eosBayesDistribution* d, int numDistribution, ctfInfo* info, int mode);
+ extern void ctfforbayescheckIntensityOfMaxPosterior(ctfforbayes ctf, eosBayesDistribution* d, int numDistribution, ctfInfo* info, int MTFmode, int mode);
/* prototype end */
}
-void intensityforbayesInit(intensityforbayes* intensity, int Inum, int mode){
+void intensityforbayesInit(intensityforbayes* intensity, int Inum, int MTFmode, int mode){
+ intensity->MTFmode = MTFmode;
intensity->normI = (float*)malloc(sizeof(float)*Inum);
intensity->logI = (float*)malloc(sizeof(float)*Inum);
intensity->mode = 0;
DEBUGPRINT1("Intensityinit finitsh! Inum:%d\n",Inum);
+ DEBUGPRINT1("---MTFmode:%d---\n",MTFmode);
}
}
//DEBUGPRINT3("%d:%d:%d\n",L[0],L[1],L[2]);
for(j=0;j<ctf->n;j++){
- intensity->normII[j] = ctfforbayesIntensityCalculation(parameter,ctf->R[j],info,mode);
- intensity->logII[j] = log(intensity->normII[j]);
+ intensity->normII[j] = ctfforbayesIntensityCalculation(parameter,ctf->R[j],info,intensity->MTFmode,mode);
+ intensity->logII[j] = log(intensity->normII[j]);
}
intensitySet(ctf,intensity,0);
}
-float ctfforbayesIntensityCalculation(float* parameter, float R, ctfInfo* info, int mode){
+float ctfforbayesIntensityCalculation(float* parameter, float R, ctfInfo* info, int MTFmode, int mode){
float S;
float N;
float A;
float B;
float m;
- int mode2;
- mode2 = 1;
+ m = 0;
A = 0;
B = 0;
S = parameter[1];
N = parameter[2];
- switch(mode2){
+ switch(MTFmode){
case 0:
}
-void ctfforbayesFree(ctfforbayes* ctf, intensityforbayes* intensity, defocuslikelihoodforbayes* likedihood){
+void ctfforbayesFree(ctfforbayes* ctf, intensityforbayes* intensity, defocuslikelihoodforbayes* likelihood, int numLikelihood){
+
+ int i;
DEBUGPRINT("In ctfforbayesfree\n");
+ for(i=0;i<numLikelihood;i++){
+ free(likelihood->x[i]);
+ }
+
+ free(likelihood->width);
+ free(likelihood->x);
+
free(ctf->R);
free(intensity->normI);
}
-void ctfforbayescheckIntensityOfMaxPosterior(ctfforbayes ctf, eosBayesDistribution* d, int numDistribution, ctfInfo* info, int mode){
+void ctfforbayescheckIntensityOfMaxPosterior(ctfforbayes ctf, eosBayesDistribution* d, int numDistribution, ctfInfo* info, int MTFmode, int mode){
FILE* fpt;
char s[1024];
}
for(i=0;i<ctf.n;i++){
- intensity[i] = ctfforbayesIntensityCalculation(parameter,ctf.R[i],info,mode);
+ intensity[i] = ctfforbayesIntensityCalculation(parameter,ctf.R[i],info,MTFmode,mode);
}
float* logI;
float* normII;
float* logII;
+
+ int MTFmode;
intensityforbayesMode mode;
/* prototype begin */
/*ctfforbayes.c*/
extern void ctfforbayesInit(FILE* fpt, ctfforbayes* ctf, int mode);
-extern void intensityforbayesInit(intensityforbayes* intensity,int Inum, int mode);
+extern void intensityforbayesInit(intensityforbayes* intensity,int Inum, int MTFmode, int mode);
extern void intensitySet(ctfforbayes* ctf, intensityforbayes* intensity, int mode);
extern void spatialfrequencyRead(FILE* fpt, ctfforbayes* ctf, float rmax, float rmin, int mode);
extern void intensityRead(char* filename, intensityforbayes* intensity, int count, int mode);
extern void ctfFunctionforbayes(ctfforbayes* ctf, intensityforbayes* intensity, eosBayes* d, ctfInfo* info, defocuslikelihoodforbayes* l, int count, int mode);
extern float MTFFunctionforbayes(float R, float m, int mode);
-extern float ctfforbayesIntensityCalculation(float* parameter, float R, ctfInfo* info, int mode);
-extern void ctfforbayesFree(ctfforbayes* ctf, intensityforbayes* intensity, defocuslikelihoodforbayes* likedihood);
+extern float ctfforbayesIntensityCalculation(float* parameter, float R, ctfInfo* info, int MTFmode, int mode);
+ extern void ctfforbayesFree(ctfforbayes* ctf, intensityforbayes* intensity, defocuslikelihoodforbayes* likedihood, int numLikelihood);
-/*defocuslikelihood.c*/
+ /*defocuslikelihood.c*/
extern void defocusLikelihoodInit(defocuslikelihoodforbayes* l, eosBayes d, int mode);
extern void ctfforbayesXofLikelihoodCalculation(defocuslikelihoodforbayes* l, ctfforbayes* ctf, eosBayes* d, int* L, int count, int mode);
extern void defocusLikelihood(defocuslikelihoodforbayes* l, ctfforbayes* ctf, eosBayes* d, int count, int mode);
extern void ctfforbayescheckRvsValue(char* filename, float R,float value, int count);
extern void ctfforbayescheckdifference(char* filename, defocuslikelihoodforbayes* l, eosBayesDistribution* d, int numLikelihood, int count, int mode);
extern void ctfforbayescheckintensity(ctfforbayes ctf, eosBayesDistribution* d, int numLikelihood, int count, int mode);
-extern void ctfforbayescheckIntensityOfMaxPosterior(ctfforbayes ctf, eosBayesDistribution* d, int numDistribution, ctfInfo* info, int mode);
+ extern void ctfforbayescheckIntensityOfMaxPosterior(ctfforbayes ctf, eosBayesDistribution* d, int numDistribution, ctfInfo* info, int MTFmode, int mode);
/* prototype end */
WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
"-rmin","-rmin","rmin[1/A]","Optional","1","1","rmin","Real","0"
"-c","-c[onfig]","ConfigurationFile","Optional","1","1","configFile","inFile","NULL"
"-m","-m[ode]","Mode","Optional","1","1","mode","Integer","0"
+"-MTFmode","-MTFmode","MTFmode","Optional","1","1","MTFmode","Integer","0"
long flagmode;
long mode;
+ long flagMTFmode;
+ long MTFmode;
+
} ctfDeterminationByBayesInfo;
#ifdef __cplusplus
extern "C" {
}
SBREAK;
}
+ SCASE("MTFmode") {
+ if(i+1<argc) {
+ info->MTFmode = stringGetNthIntegerData(argv[i+1], 1, " ,");
+ i++;
+ info->flagMTFmode++;
+ } else {
+ usage(argv[0]);
+ exit(EXIT_FAILURE);
+ }
+ SBREAK;
+ }
SCASE("h") {
usage(argv[0]);
exit(EXIT_SUCCESS);
/*For CTF and intensity*/
ctfforbayesInit(info.fptIn2,&ctf,0);
- intensityforbayesInit(&intensity,ctf.n,0);
+ intensityforbayesInit(&intensity,ctf.n,info.MTFmode,0);
spatialfrequencyRead(info.fptIn2,&ctf,info.rmax,info.rmin,0);
ctfInfoRead(info.fptIn3,&ctfinfo,"",0);
DEBUGPRINT5("kV:%f Cs:%f Ain:%f Cc:%f ctfMode:%ld\n",ctfinfo.kV,ctfinfo.Cs,ctfinfo.Ain,ctfinfo.Cc,ctfinfo.mode);
}
DEBUGPRINT("loop end\n");
- ctfforbayescheckIntensityOfMaxPosterior(ctf,out.posterior,out.numDistribution,&ctfinfo,2);
+ ctfforbayescheckIntensityOfMaxPosterior(ctf,out.posterior,out.numDistribution,&ctfinfo,intensity.MTFmode,2);
eosBayesPriorWrite(info.fptOut,&out,0);
- ctfforbayesFree(&ctf,&intensity,&likelihood);
+ ctfforbayesFree(&ctf,&intensity,&likelihood,out.numLikelihood);
+
eosBayesFree(&out);
exit(EXIT_SUCCESS);
[-rmin rmin (0 ).as(Real ) ] :Optional :rmin[1/A]
[-c[onfig] configFile (NULL ).as(inFile ) ] :Optional :ConfigurationFile
[-m[ode] mode (0 ).as(Integer ) ] :Optional :Mode
+ [-MTFmode MTFmode (0 ).as(Integer ) ] :Optional :MTFmode
----- Additional Usage -----
</PRE>
</BODY>
-f 1 0 1 0 0 -1x1+1+13.500000 0 0 0.000000 0 0 0 'rmin' 'rmin[1/A]' rmin
-I 1 0 1 0 0 1 -1x1+1+15.000000 ' ' 'configFile' 'ConfigurationFile' c
-i 1 0 1 0 0 -1x1+1+16.500000 0 0 0 0 0 'mode' 'Mode' m
+ -i 1 0 1 0 0 -1x1+1+18.000000 0 0 0 0 0 'MTFmode' 'MTFmode' MTFmode
-E
-E
-E
info->rmin = 0; info->flagrmin = 0;
info->fptconfigFile = NULL; info->flagconfigFile = 0;
info->mode = 0; info->flagmode = 0;
+ info->MTFmode = 0; info->flagMTFmode = 0;
}
void
if(info->flagmode) {
}
+ if(info->flagMTFmode) {
+ }
+
}
#ifdef KHOROS
#include <stdio.h>
fprintf(stderr, " [-rmin rmin (0 ).as(Real ) ] :Optional :rmin[1/A]\n");
fprintf(stderr, " [-c[onfig] configFile (NULL ).as(inFile ) ] :Optional :ConfigurationFile\n");
fprintf(stderr, " [-m[ode] mode (0 ).as(Integer ) ] :Optional :Mode\n");
+ fprintf(stderr, " [-MTFmode MTFmode (0 ).as(Integer ) ] :Optional :MTFmode\n");
additionalUsage();
}