OSDN Git Service

add mrcImageParticleCandidateExtract
authorTakuo Yasunaga <yasunaga@bio.kyutech.ac.jp>
Wed, 21 Sep 2011 20:54:14 +0000 (05:54 +0900)
committerTakuo Yasunaga <yasunaga@bio.kyutech.ac.jp>
Wed, 21 Sep 2011 20:54:14 +0000 (05:54 +0900)
14 files changed:
bin/X86MAC64/mrcImageDisplayDensityAsTempFactor
bin/X86MAC64/mrcImageParticleCandidateExtract
src/Tools/Config/Define.inc
src/Tools/mrcImage/mrcImageDisplayDensityAsTempFactor/src/X86MAC64/mrcImageDisplayDensityAsTempFactor
src/Tools/mrcImage/mrcImageDisplayDensityAsTempFactor/src/mrcImageDisplayDensityAsTempFactor.c
src/Tools/mrcImage/mrcImageParticleCandidateExtract/Config/OptionControlFile
src/Tools/mrcImage/mrcImageParticleCandidateExtract/inc/mrcImageParticleCandidateExtract.h
src/Tools/mrcImage/mrcImageParticleCandidateExtract/src/X86MAC64/mrcImageParticleCandidateExtract
src/Tools/mrcImage/mrcImageParticleCandidateExtract/src/argCheck.c
src/Tools/mrcImage/mrcImageParticleCandidateExtract/src/init.c
src/Tools/mrcImage/mrcImageParticleCandidateExtract/src/mrcImageParticleCandidateExtract.c
src/Tools/mrcImage/mrcImageParticleCandidateExtract/src/mrcImageParticleCandidateExtract.html [changed mode: 0644->0755]
src/Tools/mrcImage/mrcImageParticleCandidateExtract/src/mrcImageParticleCandidateExtract.pane
src/Tools/mrcImage/mrcImageParticleCandidateExtract/src/usage.c

index f6142d0..b3e9ff1 100755 (executable)
Binary files a/bin/X86MAC64/mrcImageDisplayDensityAsTempFactor and b/bin/X86MAC64/mrcImageDisplayDensityAsTempFactor differ
index 1b43277..d1d7efb 100755 (executable)
Binary files a/bin/X86MAC64/mrcImageParticleCandidateExtract and b/bin/X86MAC64/mrcImageParticleCandidateExtract differ
index 21d5904..bc4775f 100755 (executable)
@@ -1280,3 +1280,8 @@ WORLDNAME=Tools
 WORLDNAME=Tools
 WORLDNAME=Tools
 WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
index f6142d0..b3e9ff1 100755 (executable)
Binary files a/src/Tools/mrcImage/mrcImageDisplayDensityAsTempFactor/src/X86MAC64/mrcImageDisplayDensityAsTempFactor and b/src/Tools/mrcImage/mrcImageDisplayDensityAsTempFactor/src/X86MAC64/mrcImageDisplayDensityAsTempFactor differ
index dfbdf3d..8cb77c5 100755 (executable)
@@ -76,7 +76,7 @@ void lmrcImageDisplayAsTempFactor(pdbFile* pdb, mrcImage* in, double v, double H
       z=(pz / in->HeaderLength.z - in->HeaderStartN.z);
        */
       //mrcPixelDataGet(in, x, y, z, &data, mrcPixelRePart, mrcPixelHowNearest); 
-      mrcImageDataGetbyAU(in, x, y, z, &data, mrcPixelRePart, mrcPixelHowNearest); 
+      mrcImageDataGetbyAU(in, px, py, pz, &data, mrcPixelRePart, mrcPixelHowNearest); 
       data *= v;
       if (flagH){
        if (data > H){
index 0691cda..526a756 100755 (executable)
@@ -2,6 +2,9 @@
 # FileFormat
 "-i","-i[nput]","Input: MRC","Essential","1","1","In","inFile","NULL"
 "-o","-o[utput]","Output: MRC","Essential","1","1","Out","outFile","NULL"
-"-Max","-Max[Size]","Input: [A]","Optional","1","1","MaxSize","Real","100.0"
+"-RR","-R[ing]R[adius]","Input: [A]","Optional","1","1","RingRadius","Real","100.0"
+"-RW","-R[ing]W[idth]","Input: [A]","Optional","1","1","RingWidth","Real","10.0"
+"-thres","-thres[hold]","Input: threshold of IQ","Optional","1","1","Threshold","Real","3.0"
+"-out","-out[Threshold]","Output: Output","Optional","1","1","outFileThres","outFile","stdout"
 "-c","-c[onfig]","ConfigurationFile","Optional","1","1","configFile","inFile","NULL"
 "-m","-m[ode]","Mode","Optional","1","1","mode","Integer","0"
index 613e14f..fd9741c 100755 (executable)
@@ -21,8 +21,18 @@ typedef struct mrcImageParticleCandidateExtractInfo {
     char* Out;
     FILE* fptOut;
     
-    long flagMaxSize;
-    float MaxSize;
+    long flagRingRadius;
+    float RingRadius;
+    
+    long flagRingWidth;
+    float RingWidth;
+    
+    long flagThreshold;
+    float Threshold;
+    
+    long flagoutFileThres;
+    char* outFileThres;
+    FILE* fptoutFileThres;
     
     long flagconfigFile;
     char* configFile;
index 1b43277..d1d7efb 100755 (executable)
Binary files a/src/Tools/mrcImage/mrcImageParticleCandidateExtract/src/X86MAC64/mrcImageParticleCandidateExtract and b/src/Tools/mrcImage/mrcImageParticleCandidateExtract/src/X86MAC64/mrcImageParticleCandidateExtract differ
index 623224c..633be63 100755 (executable)
@@ -50,11 +50,44 @@ argCheck(mrcImageParticleCandidateExtractInfo* info, int argc, char* argv[])
                     }
                     SBREAK;
                 }
-                SCASE("Max") {
+                SCASE("RR") {
                     if(i+1<argc) {
-                        info->MaxSize = stringGetNthRealData(argv[i+1], 1, " ,");
+                        info->RingRadius = stringGetNthRealData(argv[i+1], 1, " ,");
                         i++;
-                        info->flagMaxSize++;
+                        info->flagRingRadius++;
+                    } else {
+                        usage(argv[0]);
+                        exit(EXIT_FAILURE);
+                    }
+                    SBREAK;
+                }
+                SCASE("RW") {
+                    if(i+1<argc) {
+                        info->RingWidth = stringGetNthRealData(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagRingWidth++;
+                    } else {
+                        usage(argv[0]);
+                        exit(EXIT_FAILURE);
+                    }
+                    SBREAK;
+                }
+                SCASE("thres") {
+                    if(i+1<argc) {
+                        info->Threshold = stringGetNthRealData(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagThreshold++;
+                    } else {
+                        usage(argv[0]);
+                        exit(EXIT_FAILURE);
+                    }
+                    SBREAK;
+                }
+                SCASE("out") {
+                    if(i+1<argc) {
+                        info->outFileThres = stringGetNthWord(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagoutFileThres++;
                     } else {
                         usage(argv[0]);
                         exit(EXIT_FAILURE);
index bae1f5d..5841dd5 100755 (executable)
@@ -14,7 +14,10 @@ init0(mrcImageParticleCandidateExtractInfo* info)
 {
     info->fptIn = NULL;    info->flagIn = 0;
     info->fptOut = NULL;    info->flagOut = 0;
-    info->MaxSize = 100.0;    info->flagMaxSize = 0;
+    info->RingRadius = 100.0;    info->flagRingRadius = 0;
+    info->RingWidth = 10.0;    info->flagRingWidth = 0;
+    info->Threshold = 3.0;    info->flagThreshold = 0;
+    info->fptoutFileThres = stdout;    info->flagoutFileThres = 0;
     info->fptconfigFile = NULL;    info->flagconfigFile = 0;
     info->mode = 0;    info->flagmode = 0;
 }
@@ -42,7 +45,17 @@ init1(mrcImageParticleCandidateExtractInfo* info)
         info->fptOut = fileOpen(info->Out, "w");
     }
     
-    if(info->flagMaxSize) {
+    if(info->flagRingRadius) {
+    }
+    
+    if(info->flagRingWidth) {
+    }
+    
+    if(info->flagThreshold) {
+    }
+    
+    if(info->flagoutFileThres) {
+        info->fptoutFileThres = fileOpen(info->outFileThres, "w");
     }
     
     if(info->flagconfigFile) {
index 86c4857..8762589 100755 (executable)
@@ -24,7 +24,10 @@ typedef enum lmrcImageParticleCandidateExtractMode {
 } lmrcImageParticleCandidateExtractMode;
 
 typedef struct lmrcImageParticleCandidateExtractInfo {
-       float Max; // A 
+       float RingRadius; // A 
+       float RingWidth; // A 
+       float Threshold;
+       FILE* fptThreshold;
 } lmrcImageParticleCandidateExtractInfo;
 
 
@@ -43,8 +46,10 @@ main(int argc, char* argv[])
        init1(&info);
 
        DEBUGPRINT("Program Start\n");
-       linfo.Max = info.MaxSize;
-
+       linfo.RingRadius = info.RingRadius;
+       linfo.RingWidth  = info.RingWidth;
+       linfo.Threshold  = info.Threshold;
+       linfo.fptThreshold = info.fptoutFileThres;
        mrcFileRead(&in, info.In, "in main", 0);
        
        lmrcImageParticleCandidateExtract(&out, &in, linfo, info.mode);
@@ -65,11 +70,80 @@ void
 lmrcImageParticleCandidateExtract(mrcImage* out, mrcImage* in, lmrcImageParticleCandidateExtractInfo linfo, lmrcImageParticleCandidateExtractMode mode)
 {
        mrcImageParaTypeReal x, y, z;
+       mrcImageParaTypeReal xx, yy, zz;
+       mrcImageParaTypeReal RR, RW;
+       double RIN, ROUT;
+       double R2;
+       double RIN2, ROUT2;
+       double testdata, data;
+       double sum, sum2;
+       double sd, mean;
+       double IQ;
+       int n;
+       int working, all;
+
+       out->Header = in->Header;
+       mrcInit(out, NULL);
+
+       // Real Space
+       RIN2  = SQR(linfo.RingRadius);
+       ROUT2 = SQR(linfo.RingRadius+linfo.RingWidth);
 
+       // Pixel
+       RR = MAX(MAX(linfo.RingRadius/in->HeaderLength.x, linfo.RingRadius/in->HeaderLength.y), linfo.RingRadius/in->HeaderLength.z);
+       RW = MAX(MAX(linfo.RingWidth /in->HeaderLength.x, linfo.RingWidth /in->HeaderLength.y), linfo.RingWidth /in->HeaderLength.z);
+       RIN  = RR;
+       ROUT = RR + RW;
+
+       all = in->HeaderN.x*in->HeaderN.y*in->HeaderN.z;
+       working = 0;
        for(z=0; z<in->HeaderN.z; z++) {
        for(y=0; y<in->HeaderN.y; y++) {
        for(x=0; x<in->HeaderN.x; x++) {
+               if(working*100/all==working*100.0/(double)all) {
+                       fprintf(stderr, "%d%\n", working*100/all);
+               }
+               working++;
+               mrcPixelDataGet(in, x, y, z, &testdata, mrcPixelRePart, mrcPixelHowNearest);
+               sum  = 0;
+               sum2 = 0;
+               n = 0;
+               for(zz=z-ROUT; zz<=z+ROUT; zz++) {
+               for(yy=y-ROUT; yy<=y+ROUT; yy++) {
+               for(xx=x-ROUT; xx<=x+ROUT; xx++) {
+                       R2 = SQR((xx-x)*in->HeaderLength.x) + SQR((yy-y)*in->HeaderLength.y) + SQR((zz-z)*in->HeaderLength.z);
+                       if(RIN2 <= R2 && R2 <= ROUT2) {
+                               if(-0.5 <= xx && xx < in->HeaderN.x-0.5   
+                                &&-0.5 <= yy && yy < in->HeaderN.y-0.5   
+                                &&-0.5 <= zz && zz < in->HeaderN.z-0.5) {
+                                       mrcPixelDataGet(in, xx, yy, zz, &data, mrcPixelRePart, mrcPixelHowNearest);
+                                       sum  += data;
+                                       sum2 += data*data;
+                                       n++;
+                               }
+                       }
+               }
+               }
+               }
+               if(0<n) { 
+                       mean = sum/n;
+                       sd = sqrt(sum2/n - SQR(mean));  
+                       IQ = (testdata - mean)/sd;
+                       if(0<linfo.Threshold) {
+                               if(linfo.Threshold<IQ) {
+                                       fprintf(linfo.fptThreshold, "%f %f %f %f\n", x, y, z, IQ);
+                               }
+                       } else {
+                               if(IQ<linfo.Threshold) {
+                                       fprintf(linfo.fptThreshold, "%f %f %f %f\n", x, y, z, IQ);
+                               }
+                       }
+               } else {
+                       IQ = 0;
+               }
+               mrcPixelDataSet(out, x, y, z, IQ, mrcPixelRePart);
        }
        }
        }
 }
+
old mode 100644 (file)
new mode 100755 (executable)
index b43dd29..9f32485
@@ -10,7 +10,10 @@ Usage: mrcImageParticleCandidateExtract
 Options:
     [-i[nput]            In                  (NULL      )] :Essential :Input: MRC
     [-o[utput]           Out                 (NULL      )] :Essential :Output: MRC
-    [-Max[Size]          MaxSize             (100.0     )] :Optional  :Input: [A]
+    [-R[ing]R[adius]     RingRadius          (100.0     )] :Optional  :Input: [A]
+    [-R[ing]W[idth]      RingWidth           (10.0      )] :Optional  :Input: [A]
+    [-thres[hold]        Threshold           (3.0       )] :Optional  :Input: threshold of IQ
+    [-out[Threshold]     outFileThres        (stdout    )] :Optional  :Output: Output
     [-c[onfig]           configFile          (NULL      )] :Optional  :ConfigurationFile
     [-m[ode]             mode                (0         )] :Optional  :Mode
 ----- Additional Usage -----
index b29d8d5..330d0fe 100755 (executable)
@@ -9,9 +9,12 @@
         -Q 1 0 5.25x1+47+0 'Close'
         -I 1 0 1 1 0 1 -1x1+1+1.500000 ' ' 'In' 'Input: MRC' i
         -O 1 0 1 1 0 1 -1x1+1+3.000000 ' ' 'Out' 'Output: MRC' o
-        -f 1 0 1 0 0 -1x1+1+4.500000 0 0 100.000000 0 0 0 'MaxSize' 'Input: [A]' Max
-        -I 1 0 1 0 0 1 -1x1+1+6.000000 ' ' 'configFile' 'ConfigurationFile' c
-        -i 1 0 1 0 0 -1x1+1+7.500000 0 0 0 0 0 'mode' 'Mode' m
+        -f 1 0 1 0 0 -1x1+1+4.500000 0 0 100.000000 0 0 0 'RingRadius' 'Input: [A]' RR
+        -f 1 0 1 0 0 -1x1+1+6.000000 0 0 10.000000 0 0 0 'RingWidth' 'Input: [A]' RW
+        -f 1 0 1 0 0 -1x1+1+7.500000 0 0 3.000000 0 0 0 'Threshold' 'Input: threshold of IQ' thres
+        -O 1 0 1 0 0 1 -1x1+1+9.000000 ' ' 'outFileThres' 'Output: Output' out
+        -I 1 0 1 0 0 1 -1x1+1+10.500000 ' ' 'configFile' 'ConfigurationFile' c
+        -i 1 0 1 0 0 -1x1+1+12.000000 0 0 0 0 0 'mode' 'Mode' m
     -E
   -E
 -E
index c0bb1e2..6980e6f 100755 (executable)
@@ -9,7 +9,10 @@ usage(char* thisProgram)
     fprintf(stderr, "Options:\n");
     fprintf(stderr, "    [-i[nput]            In                  (NULL      )] :Essential :Input: MRC\n");
     fprintf(stderr, "    [-o[utput]           Out                 (NULL      )] :Essential :Output: MRC\n");
-    fprintf(stderr, "    [-Max[Size]          MaxSize             (100.0     )] :Optional  :Input: [A]\n");
+    fprintf(stderr, "    [-R[ing]R[adius]     RingRadius          (100.0     )] :Optional  :Input: [A]\n");
+    fprintf(stderr, "    [-R[ing]W[idth]      RingWidth           (10.0      )] :Optional  :Input: [A]\n");
+    fprintf(stderr, "    [-thres[hold]        Threshold           (3.0       )] :Optional  :Input: threshold of IQ\n");
+    fprintf(stderr, "    [-out[Threshold]     outFileThres        (stdout    )] :Optional  :Output: Output\n");
     fprintf(stderr, "    [-c[onfig]           configFile          (NULL      )] :Optional  :ConfigurationFile\n");
     fprintf(stderr, "    [-m[ode]             mode                (0         )] :Optional  :Mode\n");
     additionalUsage();