• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版193bed700abcae852649c12493b2b9d6e209397a (tree)
时间2015-03-06 05:09:11
作者Takuo Yasunaga <yasunaga@bio....>
CommiterTakuo Yasunaga

Log Message

modified: .gitignore
modified: util/src/Graphics/Makefile

更改概述

差异

--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,9 @@ bin/wish/*/tclIndex
3333 */*/tclIndex
3434 */tclIndex
3535
36+#util
37+util/src.org/
38+
3639 #
3740 data/
3841 .acmlg/
--- a/src/Tools/mrcImage/mrcImageShapeSearch/src/mrcImageShapeSearch.c
+++ b/src/Tools/mrcImage/mrcImageShapeSearch/src/mrcImageShapeSearch.c
@@ -17,36 +17,52 @@
1717
1818 #define DEBUG
1919 #include "genUtil.h"
20+#include "Memory.h"
21+#include "Matrix3D.h"
22+#include "Vector.h"
2023 #include "mrcImage.h"
2124
2225 typedef struct lmrcImageShapeSearchInfo {
23- int radius; // Sylinder, plane
24- int minRadius;
25- int maxRadius;
26+ float radius; // Sylinder, plane
27+ float minRadius;
28+ float maxRadius;
29+ float delRadius;
2630
27- int length; // Sylinder
28- int minLength;
29- int maxLength;
31+ float length; // Sylinder
32+ float minLength;
33+ float maxLength;
34+ float delLength;
3035
31- int thickness; // Plane
32- int minThickness;
33- int maxThickness;
36+ float thickness; // Plane
37+ float minThickness;
38+ float maxThickness;
39+ float delThickness;
3440
3541 float minTheta;
3642 float maxTheta;
3743 float delTheta;
44+
3845 float minPhi;
3946 float maxPhi;
4047 float delPhi;
48+
4149 float minPsi;
4250 float maxPsi;
4351 float delPsi;
4452
45- mrcImage shape;
53+ int interpMode;
54+ mrcImage shape; // Template Structure
55+
56+ // Output
57+ mrcImage average; // Average for all orientations
58+ mrcImage SD; // SD for all
59+ mrcImage Zscore; // Z-score;
60+ mrcImage shapeInfo; // Shape, Orientation, ...
4661 } lmrcImageShapeSearchInfo;
4762
4863 typedef enum lmrcImageShapeSearchMode {
49- lmrcImageShapeSearchModeSylinder=0
64+ lmrcImageShapeSearchModeSylinder=0,
65+ lmrcImageShapeSearchModePlane=1
5066 } lmrcImageShapeSearchMode;
5167
5268 extern void lmrcImageShapeSearch(mrcImage* out, mrcImage* in, lmrcImageShapeSearchInfo* linfo, int mode);
@@ -99,6 +115,7 @@ void
99115 lmrcImageShapeSearchModePrint(FILE* fpt)
100116 {
101117 fprintf(fpt, "%d: Cylinder with radius and length\n", lmrcImageShapeSearchModeSylinder);
118+ fprintf(fpt, "%d: Plane with radius and thickness\n", lmrcImageShapeSearchModePlane);
102119 }
103120
104121
@@ -110,6 +127,10 @@ lmrcImageShapeSearch(mrcImage* out, mrcImage* in, lmrcImageShapeSearchInfo* linf
110127 lmrcImageShapeSearchSylinder(out, in, linfo, mode);
111128 break;
112129 }
130+ case lmrcImageShapeSearchModePlane: {
131+ lmrcImageShapeSearchPlane(out, in, linfo, mode);
132+ break;
133+ }
113134 default: {
114135 fprintf(stderr, "Not supported mode: %d\n", mode);
115136 break;
@@ -122,45 +143,98 @@ void
122143 lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchInfo* linfo, int mode)
123144 {
124145 float x, y, z;
125- float theta, phi, psi;
126- int iPhi, iTheta, iPsi;
127- int nPhi, nTheta, nPsi;
128- int iR;
146+ float srcx, srcy, srcz;
147+ float dstx, dsty, dstz;
148+ float theta, phi, psi, radius, length;
149+ int iPhi, iTheta, iPsi, iRadius, iLength;
150+ int nPhi, nTheta, nPsi, nRadius, nLength;
129151 float max;
130- mrcImage template;
131-
132- max = MAX(2*linfo->radius, linfo->length);
133-
134- template->Header = in->Header;
135- template->HeaderLength.x = max;
136- template->HeaderLength.y = max;
137- template->HeaderLength.z = max;
138- mrcInit(&template, NULL);
139-
140- for(z=0; z<in->HeaderN.z; z++) {
141- for(y=0; y<in->HeaderN.y; y++) {
142- for(x=0; x<in->HeaderN.x; x++) {
143-
144- }
145- }
146- }
147-
148- nPhi = (int)((linfo->maxPhi -linfo->minPhi) /linfo->delPhi) +1;
149- nTheta = (int)((linfo->maxTheta-linfo->minTheta)/linfo->delTheta)+1;
150- nPsi = 2*M_PI/linfo->delPsi;
152+ double* data;
153+ double d, cp, sp;
154+ double score;
155+ int nData, index;
156+ float r, l, p;
157+ Matrix3D mat;
158+ floatVector v;
159+
160+ nPhi = (int)((linfo->maxPhi - linfo->minPhi) /linfo->delPhi) +1;
161+ nTheta = (int)((linfo->maxTheta - linfo->minTheta)/linfo->delTheta)+1;
162+ nPsi= (int)((linfo->maxTheta - linfo->minTheta)/linfo->delTheta)+1;
163+ nRadius = (int)((linfo->maxRadius - linfo->minRadius)/linfo->delRadius) + 1;
164+ nLength = (int)((linfo->maxLength - linfo->minLength)/linfo->delLength) + 1;
165+
166+ nData = nPhi*nTheta*nPsi*nRadius*nLength;
167+ data = (double*)memoryAllocate(sizeof(double)*nData, "in lmrcImageShapeSearchSylinder");
168+
169+ floatVectorInit(&v, 4);
170+ v.data[3] = 1;
151171
152172 for(z=0; z<in->HeaderN.z; z++) {
153173 for(y=0; y<in->HeaderN.y; y++) {
154174 for(x=0; x<in->HeaderN.x; x++) {
155- for(iTheta=0; iTheta<nTheta; iTheta++) {
156- theta = linfo->minTheta + iTheta*linfo->delTheta;
157175 for(iPhi=0; iPhi<nPhi; iPhi++) {
158176 phi = linfo->minPhi + iPhi*linfo->delPhi;
159- for(iR=linfo->minRadius; iR<=linfo->maxRadius; iR++) {
160-
177+ for(iTheta=0; iTheta<nTheta; iTheta++) {
178+ theta = linfo->minTheta + iTheta*linfo->delTheta;
179+ for(iPsi=0; iPsi<nPsi; iPsi++) {
180+ psi= linfo->minPsi+ iPhi*linfo->delPsi;
181+
182+ matrix3DRotationSetFollowingEulerAngle(mat, "ZENS", phi, theta, psi, MATRIX_3D_MODE_INITIALIZE);
183+
184+ for(iRadius=linfo->minRadius; iRadius<=linfo->maxRadius; iRadius++) {
185+ radius = linfo->minRadius + iRadius*linfo->delRadius;
186+ for(iLength=linfo->minLength; iLength<=linfo->maxLength; iLength++) {
187+ length = linfo->minLength + iLength*linfo->delLength;
188+
189+ index = iPhi
190+ +iTheta *nPhi
191+ +iPsi *nPhi*nTheta
192+ +iRadius*nPhi*nTheta*nPsi
193+ +iLength*nPhi*nTheta*nPsi*nRadius;
194+
195+ score = 0;
196+ for(p=0; r<2*M_PI; l+=linfo->delPsi) {
197+ cp = cos(p);
198+ sp = sin(p);
199+ for(l=0; r<=length; l+=linfo->delLength) {
200+ v.data[2] = l-length/2;
201+ for(r=0; r<=radius; r+=linfo->delRadius) {
202+ v.data[0] = r*cp;
203+ v.data[1] = r*sp;
204+
205+ matrix3DMultiplyVector(&v, mat);
206+ dstx = x + v.data[0];
207+ dsty = y + v.data[1];
208+ dstz = z + v.data[2];
209+ mrcPixelDataGet(in, dstx, dsty, dstz, &d, mrcPixelRePart, linfo->interpMode);
210+ score += d;
211+ }
212+ v.data[0] = r*cos(p);
213+ v.data[1] = r*sin(p);
214+ matrix3DMultiplyVector(&v, mat);
215+ dstx = x + v.data[0];
216+ dsty = y + v.data[1];
217+ dstz = z + v.data[2];
218+ mrcPixelDataGet(in, dstx, dsty, dstz, &d, mrcPixelRePart, linfo->interpMode);
219+ score -= d;
161220 }
221+ }
222+ data[index] = score;
223+ }
224+ }
225+ }
226+ }
227+ }
228+ sum = 0;
229+ for(i=0; i<nData; i++) {
230+ sum += data[i];
162231 }
232+ ave = sum/nData;
233+ sum = 0;
234+ for(i=0; i<nData; i++) {
235+ sum += SQR(data[i]-ave);
163236 }
237+ sd = sqrt(sum/nData);
164238 }
165239 }
166240 }
@@ -169,48 +243,5 @@ lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchIn
169243 void
170244 lmrcImageShapeSearchPlane(mrcImage* out, mrcImage* in, lmrcImageShapeSearchInfo* linfo, int mode)
171245 {
172- float x, y, z;
173- float theta, phi, psi;
174- int iPhi, iTheta, iPsi;
175- int nPhi, nTheta, nPsi;
176- int iR;
177- float max;
178- mrcImage template;
179-
180- max = MAX(2*linfo->radius, linfo->length);
181-
182- template->Header = in->Header;
183- template->HeaderLength.x = max;
184- template->HeaderLength.y = max;
185- template->HeaderLength.z = max;
186- mrcInit(&template, NULL);
187-
188- for(z=0; z<in->HeaderN.z; z++) {
189- for(y=0; y<in->HeaderN.y; y++) {
190- for(x=0; x<in->HeaderN.x; x++) {
191-
192- }
193- }
194- }
195-
196- nPhi = (int)((linfo->maxPhi -linfo->minPhi) /linfo->delPhi) +1;
197- nTheta = (int)((linfo->maxTheta-linfo->minTheta)/linfo->delTheta)+1;
198- nPsi = 2*M_PI/linfo->delPsi;
199-
200- for(z=0; z<in->HeaderN.z; z++) {
201- for(y=0; y<in->HeaderN.y; y++) {
202- for(x=0; x<in->HeaderN.x; x++) {
203- for(iTheta=0; iTheta<nTheta; iTheta++) {
204- theta = linfo->minTheta + iTheta*linfo->delTheta;
205- for(iPhi=0; iPhi<nPhi; iPhi++) {
206- phi = linfo->minPhi + iPhi*linfo->delPhi;
207- for(iR=linfo->minRadius; iR<=linfo->maxRadius; iR++) {
208-
209- }
210- }
211- }
212- }
213- }
214- }
215246 }
216247
--- a/util/src.org
+++ /dev/null
@@ -1 +0,0 @@
1-orgsrc/src
\ No newline at end of file
--- a/util/src/Graphics/Makefile
+++ b/util/src/Graphics/Makefile
@@ -3,12 +3,18 @@ SHELL=/bin/sh
33
44 include ${EOS_HOME}/src/Config/${EOS_HOST}${FLAG_ICC}.inc
55
6-JPEGVERSION=6b
6+#JPEGVERSION=6b
7+JPEGVERSION=9a
78 ##GIFVERSION=3.0
8-GIFVERSION=4.1.6
9+#GIFVERSION=4.1.6
10+GIFVERSION=5.1.1
911 MESAVERSION=4.0.3
1012 #TIFFVERSION=v3.4beta037
11-TIFFVERSION=3.8.2
13+#TIFFVERSION=3.8.2
14+TIFFVERSION=4.0.3
15+
16+help:
17+ echo "JPEG/GIF/TIFF/MESA"
1218
1319 check: JPEGInit GIFInit TIFFInit MESAInit
1420
@@ -16,61 +22,128 @@ config: JPEGConfig GIFConfig MESAConfig TIFFConfig
1622
1723 all: JPEG GIF MESA TIFF
1824
19-clean:
20-
21-JPEGInit::
22- ln -sf ../../src/Graphics/jpeg-$(JPEGVERSION).tar.gz .
23- gzip -dc jpeg-$(JPEGVERSION).tar.gz | tar xvf -
24-
25-TIFFInit::
26- ln -sf ../..//src/Graphics/tiff-$(TIFFVERSION).tar.gz .
27- gzip -dc tiff-$(TIFFVERSION).tar.gz | tar xvf -
25+clean: JPEGClean GIFClean MESAClean TIFFClean
2826
29-MESAInit::
30- ln -sf ../../src/Graphics/MesaLib-$(MESAVERSION).tar.gz .
31- gzip -dc MesaLib-$(MESAVERSION).tar.gz | tar xvf -
27+cleanAll: JPEGCleanAll GIFCleanAll MESACleanAll TIFFCleanAll
3228
33-GIFInit::
34- ln -sf ../../src/Graphics/giflib-$(GIFVERSION).tar.gz .
35- gzip -dc giflib-$(GIFVERSION).tar.gz | tar xvf -
29+#
30+# JPEG
31+#
32+JPEGInit::
33+ #ln -sf ../../src/Graphics/jpeg-$(JPEGVERSION).tar.gz .
34+ curl -O http://www.ijg.org/files/jpegsrc.v$(JPEGVERSION).tar.gz
35+ gzip -dc jpegsrc.v$(JPEGVERSION).tar.gz | tar xvf -
36+ #gzip -dc jpeg-$(JPEGVERSION).tar.gz | tar xvf -
3637
3738 JPEGConfig::
3839 cd jpeg-$(JPEGVERSION) ; \
3940 $(MAKE) clean ; \
40- ./configure CC=icc --prefix=${EOS_HOME}/util/$(OSTYPE) --enable-static --enable-shared
41-
42-GIFConfig::
43- cd giflib-$(GIFVERSION) ; \
44- ./configure CC=icc --prefix=${EOS_HOME}/util/$(OSTYPE) --exec-prefix=${EOS_HOME}/util/$(OSTYPE) ; \
45- $(MAKE) clean
46-
47-MESAConfig::
48- cd Mesa-$(MESAVERSION) ; \
49- ./configure CC=icc --prefix=${EOS_HOME}/util/$(OSTYPE) --with-glut=${EOS_HOME}/util/$(OSTYPE)/lib ; \
50- $(MAKE) clean
51-
52-TIFFConfig::
53- cd tiff-$(TIFFVERSION) ; \
54- $(MAKE) clean ; \
55- ./configure CC=icc --with-x --prefix=$(EOS_HOME)/util/$(OSTYPE)
56-
41+ if [ ! -z $${USE_ICC} ] ; then \
42+ ./configure CC=icc --prefix=${EOS_HOME}/util/$(OSTYPE) ; \
43+ else \
44+ ./configure --prefix=${EOS_HOME}/util/$(OSTYPE) ; \
45+ fi
5746
5847 JPEG::
5948 cd jpeg-$(JPEGVERSION); \
6049 $(MAKE) install ; \
6150 $(MAKE) install-lib
6251
52+JPEGClean::
53+ cd jpeg-$(JPEGVERSION); \
54+ $(MAKE) -i clean
55+
56+JPEGCleanAll::
57+ rm -rf jpeg-$(JPEGVERSION)
58+ rm jpegsrc.v$(JPEGVERSION).tar.gz
59+
60+#
61+# GIF
62+#
63+GIFInit::
64+ #ln -sf ../../src/Graphics/giflib-$(GIFVERSION).tar.gz .
65+ curl -L http://sourceforge.net/projects/giflib/files/giflib-$(GIFVERSION).tar.gz/download > giflib-$(GIFVERSION).tar.gz
66+ gzip -dc giflib-$(GIFVERSION).tar.gz | tar xvf -
67+
68+GIFConfig::
69+ cd giflib-$(GIFVERSION) ; \
70+ $(MAKE) -i clean ; \
71+ if [ ! -z $${USE_ICC} ] ; then \
72+ ./configure CC=icc --prefix=${EOS_HOME}/util/$(OSTYPE) --exec-prefix=${EOS_HOME}/util/$(OSTYPE) ; \
73+ else \
74+ ./configure --prefix=${EOS_HOME}/util/$(OSTYPE) --exec-prefix=${EOS_HOME}/util/$(OSTYPE) ; \
75+ fi ;
76+
6377 GIF::
6478 cd giflib-$(GIFVERSION) ; \
6579 $(MAKE) ; \
6680 mkdir ${EOS_HOME}/util/$(OSTYPE)/bin ; \
6781 $(MAKE) DEST=${EOS_HOME}/util/$(OSTYPE)/bin LIBDIR=${EOS_HOME}/util/$(OSTYPE)/lib install
6882
83+GIFClean::
84+ cd giflib-$(GIFVERSION) ; \
85+ $(MAKE) -i clean
86+
87+GIFCleanAll::
88+ rm -rf giflib-$(GIFVERSION)
89+ rm -rf giflib-$(GIFVERSION).tar.gz
90+
91+#
92+# MESA
93+#
94+
95+MESAInit::
96+ ln -sf ../../src/Graphics/MesaLib-$(MESAVERSION).tar.gz .
97+ gzip -dc MesaLib-$(MESAVERSION).tar.gz | tar xvf -
98+
99+MESAConfig::
100+ cd Mesa-$(MESAVERSION) ; \
101+ if [ ! -z $${USE_ICC} ] ; then \
102+ ./configure CC=icc --prefix=${EOS_HOME}/util/$(OSTYPE) --with-glut=${EOS_HOME}/util/$(OSTYPE)/lib ; \
103+ else \
104+ ./configure --prefix=${EOS_HOME}/util/$(OSTYPE) --with-glut=${EOS_HOME}/util/$(OSTYPE)/lib ; \
105+ fi ;
106+
69107 MESA::
70- cd ../../src$(OSTYPE)/Graphics/Mesa-$(MESAVERSION) ; \
108+ cd Mesa-$(MESAVERSION) ; \
71109 $(MAKE) -i linux; \
72110 $(MAKE) install
73111
112+MESAClean::
113+ cd Mesa-$(MESAVERSION) ; \
114+ $(MAKE) clean
115+
116+MESACleanAll::
117+ rm -rf Mesa-$(MESAVERSION)
118+ rm -f MesaLib-$(MESAVERSION).tar.gz
119+
120+#
121+# TIFF
122+#
123+
124+TIFFInit::
125+ #ln -sf ../..//src/Graphics/tiff-$(TIFFVERSION).tar.gz .
126+ curl -O http://download.osgeo.org/libtiff/tiff-$(TIFFVERSION).tar.gz
127+ gzip -dc tiff-$(TIFFVERSION).tar.gz | tar xvf -
128+
129+TIFFConfig::
130+ cd tiff-$(TIFFVERSION) ; \
131+ $(MAKE) -i clean ; \
132+ if [ ! -z $${USE_ICC} ] ; then \
133+ ./configure CC=icc --with-x --with-jpeg-lib-dir=$(EOS_HOME)/util/$(OSTYPE)/lib --with-jpeg-include-dir=$(EOS_HOME)/util/$(OSTYPE)/include --prefix=$(EOS_HOME)/util/$(OSTYPE); \
134+ else \
135+ ./configure --with-x --with-x --with-jpeg-lib-dir=$(EOS_HOME)/util/$(OSTYPE)/lib --with-jpeg-include-dir=$(EOS_HOME)/util/$(OSTYPE)/include --prefix=$(EOS_HOME)/util/$(OSTYPE); \
136+ fi
137+
74138 TIFF::
75139 cd tiff-$(TIFFVERSION); \
76140 $(MAKE) install
141+
142+TIFFClean::
143+ cd tiff-$(TIFFVERSION); \
144+ $(MAKE) -i clean
145+
146+TIFFCleanAll::
147+ rm -rf tiff-$(TIFFVERSION)
148+ rm -rf tiff-$(TIFFVERSION).tar.gz
149+