OSDN Git Service

Please enter the commit message for your changes. Lines starting v2.4.21p0371
authorTakuo Yasunaga <yasuanga@phys.kyutech.ac.jp>
Fri, 16 Dec 2022 10:24:46 +0000 (19:24 +0900)
committerTakuo Yasunaga <yasuanga@phys.kyutech.ac.jp>
Fri, 16 Dec 2022 10:24:46 +0000 (19:24 +0900)
 with '#' will be ignored, and an empty message aborts the commit.

 On branch master
 Your branch is up to date with 'origin/master'.

 Changes to be committed:
modified:   bin/wish/Display2/tclIndex
modified:   hostdepend/ARM64MAC64
modified:   src/Objects/DataManip/mrcImage/src/lmrcImageMorphology.c
modified:   src/Objects/DataManip/mrcImage/src/lmrcImageSoftEdge.c
modified:   src/Tools/mrcImage/mrcImageSoftEdge/src/test/Makefile

 Changes not staged for commit:
modified:   hostdepend/ARM64MAC64 (new commits)
modified:   include/eosMATH.h

bin/wish/Display2/tclIndex
hostdepend/ARM64MAC64
src/Objects/DataManip/mrcImage/src/lmrcImageMorphology.c
src/Objects/DataManip/mrcImage/src/lmrcImageSoftEdge.c
src/Tools/mrcImage/mrcImageSoftEdge/src/test/Makefile

index c4c3f5a..ddbd17b 100644 (file)
@@ -54,7 +54,6 @@ set auto_index(menuMultiRoiOKCommand) [list source [file join $dir Display2MenuR
 set auto_index(menuMultiRoiAllDeleteCommand) [list source [file join $dir Display2MenuROI.wish]]
 set auto_index(menuMultiRoiDeleteCommand) [list source [file join $dir Display2MenuROI.wish]]
 set auto_index(menuEditCreate) [list source [file join $dir Display2MenuROI.wish]]
-set auto_index(fft2dCmd) [list source [file join $dir fft2dCmd.wish]]
 set auto_index(layerLineRecreate) [list source [file join $dir LayerLineUtil.wish]]
 set auto_index(layerLineCreate) [list source [file join $dir LayerLineUtil.wish]]
 set auto_index(layerLineClear) [list source [file join $dir LayerLineUtil.wish]]
@@ -137,3 +136,4 @@ set auto_index(sectionClearAll) [list source [file join $dir SectionUtil.wish]]
 set auto_index(sectionClear) [list source [file join $dir SectionUtil.wish]]
 set auto_index(sectionChange) [list source [file join $dir SectionUtil.wish]]
 set auto_index(unitCellRecreate) [list source [file join $dir UnitCell.wish]]
+set auto_index(fft2dCmd) [list source [file join $dir fft2dCmd.wish]]
index 294828f..b8745df 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 294828f10762d2aee283acb6b34ba86b346b6b25
+Subproject commit b8745dfd26b78656350495ca523e2608ddcb3bfb
index 8b76209..6fc2d1a 100644 (file)
 */
 static char __sccs_id[] = "%Z%lmrcImageMorphology ver%I%; Date:%D% %Z%";
 
+#undef DEBUG
+#include "genUtil.h"
 #include <stdio.h>
 #include "./lmrcImageMorphology.h"
 
 void
 lmrcImageMorphologyStructuringElementSet(lmrcImageMorphologyInfo* linfo, int mode)
 {
+    DEBUGPRINT1(" lmrcImageMorphologyStructuringElementSet: %d\n", linfo->mode);
        switch(linfo->mode) {
                case 0: {
                        lmrcImageMorphologyStructuringElement2DCross(&linfo->SE, mode);
@@ -135,7 +138,7 @@ lmrcImageMorphologyStructuringElementSphere(mrcImage* out, int r, int nx, int ny
        int rx, ry, rz;
        double rr, r2;
        double data;
-
+    DEBUGPRINT("Sphere\n");
        mrcDefaultHeaderValueSet(out);
        out->HeaderN.x = nx;
        out->HeaderN.y = ny;
index bd9f39a..2f159a7 100644 (file)
@@ -16,6 +16,7 @@ static char __sccs_id[] = "%Z%lmrcImageSoftEdge ver%I%; Date:%D% %Z%";
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "./lmrcImageMorphology.h"
 #include "./lmrcImageSoftEdge.h"
 
 int
@@ -23,13 +24,16 @@ lmrcImageSoftEdge(mrcImage* out, mrcImage* in, lmrcImageSoftEdgeInfo linfo, int
 {
     mrcImageParaTypeReal x, y, z;
     mrcImageParaTypeReal offsetx, offsety, offsetz;
-    double width;
-    double data;
+    double width, tmpWidth;
+    double data, data0;
     double distance, near, nearx, neary, nearz;
     double xmin, ymin, zmin, xmax, ymax, zmax;
     double max;
     double dstData;
-
+    mrcImage dilation, tmp; 
+    lmrcImageMorphologyInfo minfo;
+    int times;
+    DEBUGPRINT("lmrcImageSoftEdge\n");
     out->Header = in->Header;
     mrcInit(out, NULL);
 
@@ -47,40 +51,75 @@ lmrcImageSoftEdge(mrcImage* out, mrcImage* in, lmrcImageSoftEdgeInfo linfo, int
             exit(EXIT_FAILURE);
             break;
     }
+/*
+    minfo.mode = 5;
+    minfo.n = width*2+1;
+    minfo.radius = width;
+*/
 
+    minfo.mode = 4;
+    minfo.n = 3;
+    lmrcImageMorphologyStructuringElementSet(&minfo, 0);
+    times = 0;
+    tmp = *in;
+    do { 
+        lmrcImageDilation(&dilation, &tmp, minfo, 2);
+        tmp = dilation;
+    } while(times<=width);
+#ifdef DEBUG
+    mrcFileWrite(&dilation, "/tmp/test.dilation", "for test", 0); 
+    mrcFileWrite(&minfo.SE, "/tmp/test.se", "for test", 0); 
+#endif
     for(z=0; z<out->HeaderN.z; z++) {
        DEBUGPRINT1("%d\n", (int)z);
     for(y=0; y<out->HeaderN.y; y++) {
     for(x=0; x<out->HeaderN.x; x++) {
-        mrcPixelDataGet(in, x, y, z, &data, mrcPixelRePart, mrcPixelHowNearest);
+        mrcPixelDataGet(in, x, y, z, &data,  mrcPixelRePart, mrcPixelHowNearest);
+        mrcPixelDataGet(&dilation, x, y, z, &data0, mrcPixelRePart, mrcPixelHowNearest);
         if(0<data) {
             dstData = data;
-        } else {
+        } else if(0<data0) {
+            //DEBUGPRINT5("%f %f %f: %f %f\n", x, y, z, data0, data);
             near = max;
             dstData = 0;
-            xmin = MAX(0, x-width); xmax = MIN(x+width, out->HeaderN.x - 1); 
-            ymin = MAX(0, y-width); ymax = MIN(y+width, out->HeaderN.y - 1);
-            zmin = MAX(0, z-width); zmax = MIN(z+width, out->HeaderN.z - 1);
-            for(offsetz=zmin; offsetz<=zmax; offsetz++) {
-            for(offsety=ymin; offsety<=ymax; offsety++) {
-            for(offsetx=xmin; offsetx<=xmax; offsetx++) {
-                distance = sqrt(SQR(offsetx -x) + SQR(offsety - y) + SQR(offsetz - z));  
-                if(distance<width) { 
-                    mrcPixelDataGet(in, offsetx, offsety, offsetz, &data, mrcPixelRePart, mrcPixelHowNearest);
-                    if(0<data) {
-                        if(distance < near) {
-                            near = distance;
-                            nearx = offsetx;
-                            neary = offsety;
-                            nearz = offsetz;
-                            dstData = data;
+            for(tmpWidth=1; tmpWidth<=width; tmpWidth++) { 
+                xmin = MAX(0, x-tmpWidth); xmax = MIN(x+tmpWidth, out->HeaderN.x - 1); 
+                ymin = MAX(0, y-tmpWidth); ymax = MIN(y+tmpWidth, out->HeaderN.y - 1);
+                zmin = MAX(0, z-tmpWidth); zmax = MIN(z+tmpWidth, out->HeaderN.z - 1);
+                for(offsetz=zmin; offsetz<=zmax; offsetz++) {
+                for(offsety=ymin; offsety<=ymax; offsety++) {
+                for(offsetx=xmin; offsetx<=xmax; offsetx++) {
+                    distance = sqrt(SQR(offsetx -x) + SQR(offsety - y) + SQR(offsetz - z));  
+                    if(distance<width) { 
+                        mrcPixelDataGet(in, offsetx, offsety, offsetz, &data, mrcPixelRePart, mrcPixelHowNearest);
+                        if(0<data) {
+                            if(distance < near) {
+                                near = distance;
+                                nearx = offsetx;
+                                neary = offsety;
+                                nearz = offsetz;
+                                dstData = data;
+                            }
                         }
                     }
+                    if(dstData) {
+                        break;
+                    }
+                }
+                    if(dstData) {
+                        break;
+                    }
+                }
+                    if(dstData) {
+                        break;
+                    }
+                }
+                if(dstData) {
+                    break;
                 }
-            }
-            }
             }
             if(0<dstData) {
+                //DEBUGPRINT5("%f %f %f: %f %f\n", x, y, z, data0, data);
                 switch(linfo.envelop) {
                     case lmrcImageSoftEdgeInfoEnvelopGaussian: 
                         dstData *= exp(-SQR(near/linfo.width)/2.0);
@@ -97,7 +136,10 @@ lmrcImageSoftEdge(mrcImage* out, mrcImage* in, lmrcImageSoftEdgeInfo linfo, int
                         exit(EXIT_FAILURE);
                         break;
                 }
+                //DEBUGPRINT6("%f %f %f: %f %f %f \n", x, y, z, dstData, data0, data);
             }
+        } else {
+            dstData = 0;
         }
         mrcPixelDataSet(out, x, y, z, dstData, mrcPixelRePart);
     }
index 9807674..e1c7f61 100644 (file)
@@ -15,4 +15,8 @@ exec:
        ../$(OSTYPE)/$(OBJECTNAME) -i data/test.rect -o data/test.rect.edge1 -w 2 -e 1
        @echo "----- Calc check -----"          
 
+init:
+       mrcImageSiemensStar -o data/test.rect -m 0 -N 256 256 -R 64 -n 18 -Shape 0 -m 2
+
+
 clean: