• R/O
  • HTTP
  • SSH
  • HTTPS

base: Commit

This repository is a base of Eos.


Commit MetaInfo

Revision66e85f36497bdd100a784b79da015cd08e460e6c (tree)
Time2015-05-16 09:37:40
AuthorTakuo Yasunaga <yasunaga@bio....>
CommiterTakuo Yasunaga

Log Message

No vacancy: Labeling
modified: include/lmrcImageLabeling.h
modified: src/Objects/DataManip/mrcImage/src/lmrcImageLabeling.c
modified: src/Objects/DataManip/mrcImage/src/lmrcImageLabeling.h
modified: src/Tools/mrcImage/mrcImageLabeling/src/mrcImageLabeling.c

Change Summary

Incremental Difference

--- a/include/lmrcImageLabeling.h
+++ b/include/lmrcImageLabeling.h
@@ -12,6 +12,8 @@
1212
1313 #include "mrcImage.h"
1414
15+void lmrcImageLabelingUsage(FILE* fpt);
1516 void lmrcImageLabeling(mrcImage* label, mrcImage* in, int mode);
17+void lmrcImageLabelingOrder(mrcImage* label, int mode);
1618 void lmrcImageLabeling2D(mrcImage* label, mrcImage* in, int mode);
1719 void lmrcImageLabeling3D(mrcImage* label, mrcImage* in, int mode);
--- a/src/Objects/DataManip/mrcImage/src/lmrcImageLabeling.c
+++ b/src/Objects/DataManip/mrcImage/src/lmrcImageLabeling.c
@@ -10,12 +10,18 @@
1010 */
1111 /* $Log$ */
1212
13-#define DEBUG
13+#undef DEBUG
1414 #include "genUtil.h"
1515 #include "Memory.h"
1616 #include "./lmrcImageLabeling.h"
1717
1818 void
19+lmrcImageLabelingUsage(FILE* fpt)
20+{
21+ fprintf(fpt, "mode: 0 (default: speed)\n");
22+ fprintf(fpt, " 1 (No vacancy)\n");
23+}
24+void
1925 lmrcImageLabelingOrder(mrcImage* dst, int mode)
2026 {
2127 mrcImageParaTypeReal x, y, z;
@@ -26,9 +32,19 @@ lmrcImageLabelingOrder(mrcImage* dst, int mode)
2632 double data;
2733
2834 DEBUGPRINT("lmrcImageLabelingOrder\n");
29- max = dst->HeaderAMax+1;
30- num = (int*)memoryAllocate(sizeof(int), "in lmrcImageLabelingOrder");
31- newlabel = (int*)memoryAllocate(sizeof(int), "in lmrcImageLabelingOrder");
35+ max = 0;
36+ for(z=0; z<dst->HeaderN.z; z++) {
37+ for(y=0; y<dst->HeaderN.y; y++) {
38+ for(x=0; x<dst->HeaderN.x; x++) {
39+ mrcPixelDataGet(dst, x, y, z, &data, mrcPixelRePart, mrcPixelHowNearest);
40+ if(max<data) {
41+ max = data;
42+ }
43+ }
44+ }
45+ }
46+ num = (int*)memoryAllocate(sizeof(int)*max, "in lmrcImageLabelingOrder");
47+ newlabel = (int*)memoryAllocate(sizeof(int)*max, "in lmrcImageLabelingOrder");
3248 for(i=0; i<max; i++) {
3349 num[i]=0;
3450 newlabel[i]=0;
@@ -52,13 +68,14 @@ lmrcImageLabelingOrder(mrcImage* dst, int mode)
5268 j++;
5369 }
5470 }
71+ dst->HeaderAMax = j;
5572
5673 for(z=0; z<dst->HeaderN.z; z++) {
5774 for(y=0; y<dst->HeaderN.y; y++) {
5875 for(x=0; x<dst->HeaderN.x; x++) {
5976 mrcPixelDataGet(dst, x, y, z, &data, mrcPixelRePart, mrcPixelHowNearest);
6077 if(0<data) {
61- mrcPixelDataSet(dst, x, y, z, num[(int)(data+0.5)], mrcPixelRePart);
78+ mrcPixelDataSet(dst, x, y, z, newlabel[(int)(data+0.5)], mrcPixelRePart);
6279 }
6380 }
6481 }
@@ -87,7 +104,7 @@ lmrcImageLabeling2D(mrcImage* label, mrcImage* in, int mode)
87104 {
88105 mrcImageParaTypeReal x, y, z;
89106 double data, mindata, data0, data1, data2, data3, data4;
90- int number, total;
107+ int number, total, max;
91108
92109 DEBUGPRINT("lmrcImageLabeling Start\n");
93110 label->Header = in->Header;
@@ -100,6 +117,7 @@ lmrcImageLabeling2D(mrcImage* label, mrcImage* in, int mode)
100117 }
101118
102119 number = 0;
120+ max = 0;
103121 while(1) {
104122 total = 0;
105123 for(y=0; y<in->HeaderN.y; y++) {
@@ -163,7 +181,6 @@ lmrcImageLabeling2D(mrcImage* label, mrcImage* in, int mode)
163181 break;
164182 }
165183 }
166- label->HeaderAMax = number;
167184 }
168185
169186 void
--- a/src/Objects/DataManip/mrcImage/src/lmrcImageLabeling.h
+++ b/src/Objects/DataManip/mrcImage/src/lmrcImageLabeling.h
@@ -12,6 +12,8 @@
1212
1313 #include "mrcImage.h"
1414
15+void lmrcImageLabelingUsage(FILE* fpt);
1516 void lmrcImageLabeling(mrcImage* label, mrcImage* in, int mode);
17+void lmrcImageLabelingOrder(mrcImage* label, int mode);
1618 void lmrcImageLabeling2D(mrcImage* label, mrcImage* in, int mode);
1719 void lmrcImageLabeling3D(mrcImage* label, mrcImage* in, int mode);
--- a/src/Tools/mrcImage/mrcImageLabeling/src/mrcImageLabeling.c
+++ b/src/Tools/mrcImage/mrcImageLabeling/src/mrcImageLabeling.c
@@ -56,4 +56,5 @@ void
5656 additionalUsage()
5757 {
5858 fprintf(stderr, "----- Additional Usage -----\n");
59+ lmrcImageLabelingUsage(stderr);
5960 }
--- a/src/Tools/mrcImage/mrcImageLabeling/src/mrcImageLabeling.html
+++ b/src/Tools/mrcImage/mrcImageLabeling/src/mrcImageLabeling.html
@@ -13,6 +13,8 @@ Options:
1313 [-c[onfig] configFile (NULL ).as(inFile ) ] :Optional :ConfigurationFile
1414 [-m[ode] mode (0 ).as(Integer ) ] :Optional :Mode
1515 ----- Additional Usage -----
16+mode: 0 (default: speed)
17+ 1 (No vacancy)
1618 </PRE>
1719 </BODY>
1820 </HTML>
Binary files a/src/Tools/mrcImage/mrcImageLabeling/src/test/( and /dev/null differ
--- a/src/Tools/mrcImage/mrcImageLabeling/src/test/Makefile
+++ b/src/Tools/mrcImage/mrcImageLabeling/src/test/Makefile
@@ -18,3 +18,7 @@ exec:
1818 @echo "----- Calc check -----"
1919
2020 clean:
21+
22+init:
23+ mrcImageBinalization -i $(DATA).mrc -o $(DATA).bin -t 240
24+ mrcImageOpening -i $(DATA).bin -o $(DATA).open -m 2 -times 2 -r 1
Show on old repository browser