OSDN Git Service

Add exp/gauss window: lmrcImageWindowing
authorTakuo Yasunaga <yasunaga@bio.kyutech.ac.jp>
Sun, 19 Oct 2014 14:58:39 +0000 (23:58 +0900)
committerTakuo Yasunaga <yasunaga@bio.kyutech.ac.jp>
Sun, 19 Oct 2014 14:58:39 +0000 (23:58 +0900)
modified:   src/Objects/DataManip/mrcImage/src/lmrcImageWindowing.c

hostdepend/X86MAC64/bin/X86MAC64/mrcImageWindowing
hostdepend/X86MAC64/lib/X86MAC64/libEosObjects.a
hostdepend/X86MAC64/lib/X86MAC64/libmrcImage.a
hostdepend/X86MAC64/lib/X86MAC64/shared/lmrcImageWindowing.sharedo
hostdepend/X86MAC64/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.a
hostdepend/X86MAC64/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.debug.a
hostdepend/X86MAC64/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcImageWindowing.sharedo
hostdepend/X86MAC64/src/Tools/mrcImage/mrcImageWindowing/src/X86MAC64/mrcImageWindowing [new file with mode: 0755]
src/Objects/DataManip/mrcImage/src/lmrcImageWindowing.c
src/Tools/mrcImage/mrcImageWindowing/src/mrcImageWindowing.html

index c30e3c9..eca389a 100755 (executable)
Binary files a/hostdepend/X86MAC64/bin/X86MAC64/mrcImageWindowing and b/hostdepend/X86MAC64/bin/X86MAC64/mrcImageWindowing differ
index 22ba5a1..c2d2f8d 100644 (file)
Binary files a/hostdepend/X86MAC64/lib/X86MAC64/libEosObjects.a and b/hostdepend/X86MAC64/lib/X86MAC64/libEosObjects.a differ
index 2b9974c..441b839 100644 (file)
Binary files a/hostdepend/X86MAC64/lib/X86MAC64/libmrcImage.a and b/hostdepend/X86MAC64/lib/X86MAC64/libmrcImage.a differ
index a148ea7..c87052c 100644 (file)
Binary files a/hostdepend/X86MAC64/lib/X86MAC64/shared/lmrcImageWindowing.sharedo and b/hostdepend/X86MAC64/lib/X86MAC64/shared/lmrcImageWindowing.sharedo differ
index 2b9974c..441b839 100644 (file)
Binary files a/hostdepend/X86MAC64/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.a and b/hostdepend/X86MAC64/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.a differ
index b223b8a..65067e1 100644 (file)
Binary files a/hostdepend/X86MAC64/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.debug.a and b/hostdepend/X86MAC64/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.debug.a differ
index a148ea7..c87052c 100644 (file)
Binary files a/hostdepend/X86MAC64/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcImageWindowing.sharedo and b/hostdepend/X86MAC64/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcImageWindowing.sharedo differ
diff --git a/hostdepend/X86MAC64/src/Tools/mrcImage/mrcImageWindowing/src/X86MAC64/mrcImageWindowing b/hostdepend/X86MAC64/src/Tools/mrcImage/mrcImageWindowing/src/X86MAC64/mrcImageWindowing
new file mode 100755 (executable)
index 0000000..eca389a
Binary files /dev/null and b/hostdepend/X86MAC64/src/Tools/mrcImage/mrcImageWindowing/src/X86MAC64/mrcImageWindowing differ
index 748160c..a59b34a 100755 (executable)
@@ -423,7 +423,7 @@ __lmrcImageWindowingBlackmanWindow(mrcImage* dst, mrcImage* src, lmrcImageWindow
 
 
 void 
-__lmrcImageWindowingDolphChebychevWindow(mrcImage* dst, mrcImage* src, lmrcImageWindowingInfo* info, long mode)
+__lmrcImageWindowingDolphChebyshevWindow(mrcImage* dst, mrcImage* src, lmrcImageWindowingInfo* info, long mode)
 {
        mrcImageParaTypeReal x, y, z;
        mrcImageParaTypeReal rx, ry, rz;
@@ -521,35 +521,28 @@ __lmrcImageWindowingGaussWindow(mrcImage* dst, mrcImage* src, lmrcImageWindowing
        mrcImageParaTypeReal rx, ry, rz;
        double data;
        double weightx, weighty;
-       double WxMin, WxMax, Wx;
-       double WyMin, WyMax, Wy;
-
-
-       fprintf(stderr, "Not supported yet\n");
-       exit(EXIT_FAILURE);
+       double Wx, Cx;
+       double Wy, Cy;
 
        if(src->HeaderN.z!=1) {
                fprintf(stderr, "Not supported N.z : %d\n", src->HeaderN.z);
                return;
        }
 
-       Wx    = 1.0 - 2*info->Wx;
-       Wy    = 1.0 - 2*info->Wy;
-       
+       Wx    = (0.5 - info->Wx)*src->HeaderN.x;
+       Wy    = (0.5 - info->Wy)*src->HeaderN.y;
+       Cx    = (src->HeaderN.x-1)/2.0;  
+       Cy    = (src->HeaderN.y-1)/2.0;  
+
        for(x=0; x<src->HeaderN.x; x++) {
-               rx = (x-(src->HeaderN.x-1)/2.0)/(src->HeaderN.x*Wx);
+               rx = (x-Cx)/Wx;
+               weightx = exp(-SQR(rx)/2.0);    
        for(y=0; y<src->HeaderN.y; y++) {
-               ry = (y-(src->HeaderN.y-1)/2.0)/(src->HeaderN.y*Wy);
+               ry = (y-Cy)/Wy;
+               weighty = exp(-SQR(ry)/2.0);    
 
-               if(x<WxMin || WxMax <x
-                ||y<WyMin || WyMax <y) {
-                       data = info->Offset;
-               } else {        
-                       weightx = 1;
-                       weighty = 1;
-                       mrcPixelDataGet(src, x, y, 0.0, &data, mrcPixelMag, mrcPixelHowNearest);
-                       data = weightx*weighty*(data - info->Offset) + info->Offset; 
-               }
+               mrcPixelDataGet(src, x, y, 0.0, &data, mrcPixelMag, mrcPixelHowNearest);
+               data = weightx*weighty*(data - info->Offset) + info->Offset; 
                mrcPixelDataSet(dst, x, y, 0.0, data, mrcPixelMag);
        }
        }
@@ -562,35 +555,28 @@ __lmrcImageWindowingExponentialWindow(mrcImage* dst, mrcImage* src, lmrcImageWin
        mrcImageParaTypeReal rx, ry, rz;
        double data;
        double weightx, weighty;
-       double WxMin, WxMax, Wx;
-       double WyMin, WyMax, Wy;
-
-
-       fprintf(stderr, "Not supported yet\n");
-       exit(EXIT_FAILURE);
+       double Wx, Cx;
+       double Wy, Cy;
 
        if(src->HeaderN.z!=1) {
                fprintf(stderr, "Not supported N.z : %d\n", src->HeaderN.z);
                return;
        }
 
-       Wx    = 1.0 - 2*info->Wx;
-       Wy    = 1.0 - 2*info->Wy;
-       
+       Wx    = (0.5 - info->Wx)*src->HeaderN.x;
+       Wy    = (0.5 - info->Wy)*src->HeaderN.y;
+       Cx    = (src->HeaderN.x-1)/2.0;  
+       Cy    = (src->HeaderN.y-1)/2.0;  
+
        for(x=0; x<src->HeaderN.x; x++) {
-               rx = (x-(src->HeaderN.x-1)/2.0)/(src->HeaderN.x*Wx);
+               rx = (x-Cx)/Wx;
+               weightx = exp(-fabs(rx));       
        for(y=0; y<src->HeaderN.y; y++) {
-               ry = (y-(src->HeaderN.y-1)/2.0)/(src->HeaderN.y*Wy);
+               ry = (y-Cy)/Wy;
+               weighty = exp(-fabs(ry));       
 
-               if(x<WxMin || WxMax <x
-                ||y<WyMin || WyMax <y) {
-                       data = info->Offset;
-               } else {        
-                       weightx = 1;
-                       weighty = 1;
-                       mrcPixelDataGet(src, x, y, 0.0, &data, mrcPixelMag, mrcPixelHowNearest);
-                       data = weightx*weighty*(data - info->Offset) + info->Offset; 
-               }
+               mrcPixelDataGet(src, x, y, 0.0, &data, mrcPixelMag, mrcPixelHowNearest);
+               data = weightx*weighty*(data - info->Offset) + info->Offset; 
                mrcPixelDataSet(dst, x, y, 0.0, data, mrcPixelMag);
        }
        }
index eca95a3..f02688f 100755 (executable)
@@ -1 +1,48 @@
-/bin/bash: mrcImageWindowing: No such file or directory
+<HTML>
+<HEAD>
+<TITLE>mrcImageWindowing</TITLE>
+</HEAD>
+<BODY>
+<H1>mrcImageWindowing</H1>
+<H2>Usage</H2>
+<PRE>
+Usage: mrcImageWindowing
+Options:
+    [-i[nput]            In                  (NULL      ).as(inFile              ) ] :Essential :InputDataFile
+    [-o[utput]           Out                 (NULL      ).as(outFile             ) ] :Essential :OutputDataFile
+    [-W[indowing]        Wx                  (0.1       ).as(Real                ) 
+                         WxMax               (0.0       ).as(Real                ) 
+                         Wy                  (0.1       ).as(Real                ) 
+                         WyMax               (0.0       ).as(Real                ) ] :Optional  :Windowsing Size:
+    [-W[indowing]x       WX                  (0.1       ).as(Real                ) ] :Optional  :Windowsing Size:
+    [-W[indowing]y       WY                  (0.1       ).as(Real                ) ] :Optional  :Windowsing Size:
+    [-c[onfig]           configFile          (NULL      ).as(inFile              ) ] :Optional  :ConfigurationFile
+    [-m[ode]             mode                (0         ).as(Integer             ) ] :Optional  :Mode
+>>> Mode
+    0: If 0<x<0.1*nx or 0.9*nx<x<nx, then cos windowing, else original.
+0: Cos Window (Fixed)
+   90% windowing:         fixed.   
+1: Cos Window (Y-variable)
+   Wy: Settings:          variable.
+2: Cos Window XY-variable
+   WxMax and Wx                    
+   WyMax and Wy Settings: variables
+           x/Nx < WxMax   or    1-WxMax < x/Nx           : 0 
+   WxMax < x/Nx < Wx      or    1-Wx    < x/Nx < 1-WxMax : cos window  
+                  Wx   < x/Nx < 1-Wx                     : 1
+   Wy and WyMax are also used for windowing in the similar manner.
+    In general, this is called Tukey window.
+3: Rectangle Window
+4: Hanning Window
+5: Hamming Window
+6: Blackman Window
+7: Dolph-Chebyshev Window
+8: Kaiser Window
+9: Gauss Window
+10: Exponentail Window
+>> Boundary  
++0 : To Zero.  
++16: Contrast down around mean.
+</PRE>
+</BODY>
+</HTML>