#include "genUtil.h"
#include "mrcImage.h"
#include "Memory.h"
-//#include "mrcImagePyramid.h"
+#include "mrcImagePyramid.h"
int main(int argc, char* argv[])
{
mrcImagePyramidInfo info;
- //mrcImage* InVx;
- //mrcImage* InVy;
- //mrcImage* InVz;
-
-
mrcImage* In1Shrink;
mrcImage* In2Shrink;
mrcImage InV;
mrcImage InW;
- mrcImage outU;
- mrcImage outV;
+ mrcImage outU;
+ mrcImage outV;
mrcImage outW;
mrcImage outFlow;
mrcImage* tmpw;
mrcImage* tmpt;
-
+ int i;
double u, v, w;
double du, dv, dw, u_dash, v_dash, w_dash;
- int i = (info.flagIn1ShrinkList-1);//5-1=4
- double x,y,z;
+ int x,y,z;
double data1, data2, data3, data4, data5, data6;
double size1, size2, size3, size, *I, *Y;
double pix = 0;
final = gsl_matrix_alloc(3, 1); //最終結果の格納場所
p = gsl_permutation_alloc(3);
- //double thres = info.THRESHOLD; // mean + 2*SD
- //double T, U ;
- //double data;
-
init0(&info);
argCheck(&info, argc, argv);
mrcFileRead(&InV, info.InV, "in main", 0);
mrcFileRead(&InW, info.InW, "in main", 0);
+
for(i=0; i<info.flagIn1ShrinkList; i++) {
mrcFileRead(&(In1Shrink[i]), info.In1ShrinkList[i], "in main", 0);
-
+ i = (info.flagIn1ShrinkList-1);//5-1=4
for(z = 0; z < In1Shrink[i].HeaderN.z; z++){
for(y = 0; y < In1Shrink[i].HeaderN.y; y++){
}
}
-
for(z = 1; z < In1Shrink[i-1].HeaderN.z-1; z++){
for(y = 1; y < In1Shrink[i-1].HeaderN.y-1; y++){
for(x = 1; x < In1Shrink[i-1].HeaderN.x-1; x++){
//i=3
for(i = info.flagIn1ShrinkList - 2 ; i > 0; i--){
-
+ printf("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n");
//deltaIの計算
for(z = 0; z < In1Shrink[i].HeaderN.z; z++){
mrcPixelDataGet(&In1Shrink[i], x, y, z, &Ht, mrcPixelRePart, mrcPixelHowNearest);
mrcPixelDataGet(&In2Shrink[i], x + u_dash, y + v_dash, z + w_dash, &It, mrcPixelRePart, mrcPixelHowNearest);
+
di = (It - Ht);
mrcPixelDataSet(&(tmpt[i]), x, y, z, di, mrcPixelRePart);
mrcPixelDataGet(&(In1Shrink[i]), x, y, z, &data1, mrcPixelRePart, mrcPixelHowNearest);
mrcPixelDataGet(&(In2Shrink[i]), x, y, z, &data2, mrcPixelRePart, mrcPixelHowNearest);
-
+
+
if(data1 < info.BG || data2 < info.BG) {
mrcPixelDataSet(&tmpu[i], x, y, z, 0, mrcPixelRePart);
mrcPixelDataSet(&tmpv[i], x, y, z, 0, mrcPixelRePart);
mrcPixelDataSet(&tmpw[i], x, y, z, 0, mrcPixelRePart);
- } else {
+ mrcPixelDataSet(&outFlow, x, y, z, 0, mrcPixelRePart);
+ } else {
count = 0;
for(j_mat = y-1; j_mat < y+2; j_mat++){
for(i_mat = x-1; i_mat < x+2; i_mat++){
- mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat, k_mat, &fx1, mrcPixelRePart, mrcPixelHowNearest);
- mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat, k_mat, &fx2, mrcPixelRePart, mrcPixelHowNearest);
+ mrcPixelDataGet(&(In2Shrink[i]), i_mat + 1, j_mat, k_mat, &fx1, mrcPixelRePart, mrcPixelHowNearest);
+ mrcPixelDataGet(&(In2Shrink[i]), i_mat - 1, j_mat, k_mat, &fx2, mrcPixelRePart, mrcPixelHowNearest);
fx = (fx1 - fx2) / 2;
- mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat, k_mat, &fy1, mrcPixelRePart, mrcPixelHowNearest);
- mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat, k_mat, &fy2, mrcPixelRePart, mrcPixelHowNearest);
+ mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat + 1, k_mat, &fy1, mrcPixelRePart, mrcPixelHowNearest);
+ mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat - 1, k_mat, &fy2, mrcPixelRePart, mrcPixelHowNearest);
fy = (fy1 - fy2) / 2;
- mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat, k_mat, &fz1, mrcPixelRePart, mrcPixelHowNearest);
- mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat, k_mat, &fz2, mrcPixelRePart, mrcPixelHowNearest);
+ mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat, k_mat + 1, &fz1, mrcPixelRePart, mrcPixelHowNearest);
+ mrcPixelDataGet(&(In2Shrink[i]), i_mat, j_mat, k_mat - 1, &fz2, mrcPixelRePart, mrcPixelHowNearest);
fz = (fz1 - fz2) / 2;
mrcPixelDataGet(&tmpt[i], i_mat, j_mat, k_mat, &di, mrcPixelRePart, mrcPixelHowNearest);
}
}
+ //printf("x:%d y:%d z:%d\n",x,y,z);
+
gsl_blas_dgemm(CblasTrans, CblasNoTrans, 1.0, m, m, 0.0, mp_result); //転置行列[3×27] × 元の行列[27×3]
gsl_linalg_LU_decomp(mp_result, p, &signum); //LU分解
gsl_linalg_LU_invert(mp_result, p, inv); //逆行列
mrcPixelDataSet(&outV, x, y, z, data2, mrcPixelRePart);
mrcPixelDataSet(&outW, x, y, z, data3, mrcPixelRePart);
mrcPixelDataSet(&outFlow, x, y, z, size, mrcPixelRePart);
-
+
+ //printf("size = %f\n",size);
+
if(max<size) max = size;
if(size<min) min = size;
}
fprintf(info.fptoutHistgram, "%3d %15.6g %15.6g %15.6g \n", i, min+i*delta, Y[i], I[i]);
}
}
-
- free(I);
- free(Y);
+
if(info.flagoutU){
mrcFileWrite(&outU, info.outU, "in main", 0);
--- /dev/null
+.color 1 1 1
+.color 0.000000 0.406201 0.593799
+.arrow 36 142 9 36.9232 139.018 9.90419 0.1 0.2 0.8
+.color 0.000000 0.067700 0.932300
+.arrow 37 142 9 37.1539 141.503 9.1507 0.1 0.2 0.8
+.color 0.000000 0.011283 0.988717
+.arrow 38 142 9 38.0256 141.917 9.02512 0.1 0.2 0.8
+.color 0.000000 0.067700 0.932300
+.arrow 36 143 9 36.1539 142.503 9.1507 0.1 0.2 0.8
+.color 0.000000 0.022567 0.977433
+.arrow 37 143 9 37.0513 142.834 9.05023 0.1 0.2 0.8
+.color 0.000000 0.005642 0.994358
+.arrow 38 143 9 38.0128 142.959 9.01256 0.1 0.2 0.8
+.color 0.000000 0.011283 0.988717
+.arrow 36 144 9 36.0256 143.917 9.02512 0.1 0.2 0.8
+.color 0.000000 0.005642 0.994358
+.arrow 37 144 9 37.0128 143.959 9.01256 0.1 0.2 0.8
+.color 0.000000 0.406201 0.593799
+.arrow 36 141 10 36.9232 138.018 10.9042 0.1 0.2 0.8
+.color 0.000000 0.067700 0.932300
+.arrow 37 141 10 37.1539 140.503 10.1507 0.1 0.2 0.8
+.color 0.000000 0.011283 0.988717
+.arrow 38 141 10 38.0256 140.917 10.0251 0.1 0.2 0.8
+.color 0.000000 0.406201 0.593799
+.arrow 35 142 10 35.9232 139.018 10.9042 0.1 0.2 0.8
+.color 0.000000 0.428768 0.571232
+.arrow 37 142 10 37.9745 138.853 10.9544 0.1 0.2 0.8
+.color 0.000000 0.067700 0.932300
+.arrow 35 143 10 35.1539 142.503 10.1507 0.1 0.2 0.8
+.color 0.000000 0.428768 0.571232
+.arrow 36 143 10 36.9745 139.853 10.9544 0.1 0.2 0.8
+.color 0.000000 0.146684 0.853316
+.arrow 37 143 10 37.3334 141.923 10.3265 0.1 0.2 0.8
+.color 0.000000 0.025388 0.974612
+.arrow 38 143 10 38.0577 142.814 10.0565 0.1 0.2 0.8
+.color 0.000000 0.004545 0.995455
+.arrow 39 143 10 39.0103 142.967 10.0101 0.1 0.2 0.8
+.color 0.000000 0.011283 0.988717
+.arrow 35 144 10 35.0256 143.917 10.0251 0.1 0.2 0.8
+.color 0.000000 0.025388 0.974612
+.arrow 37 144 10 37.0577 143.814 10.0565 0.1 0.2 0.8
+.color 0.000000 0.004545 0.995455
+.arrow 37 145 10 37.0103 144.967 10.0101 0.1 0.2 0.8
+.color 0.000000 0.067700 0.932300
+.arrow 36 141 11 36.1539 140.503 11.1507 0.1 0.2 0.8
+.color 0.000000 0.022567 0.977433
+.arrow 37 141 11 37.0513 140.834 11.0502 0.1 0.2 0.8
+.color 0.000000 0.005642 0.994358
+.arrow 38 141 11 38.0128 140.959 11.0126 0.1 0.2 0.8
+.color 0.000000 0.067700 0.932300
+.arrow 35 142 11 35.1539 141.503 11.1507 0.1 0.2 0.8
+.color 0.000000 0.428768 0.571232
+.arrow 36 142 11 36.9745 138.853 11.9544 0.1 0.2 0.8
+.color 0.000000 0.146684 0.853316
+.arrow 37 142 11 37.3334 140.923 11.3265 0.1 0.2 0.8
+.color 0.000000 0.025388 0.974612
+.arrow 38 142 11 38.0577 141.814 11.0565 0.1 0.2 0.8
+.color 0.000000 0.004545 0.995455
+.arrow 39 142 11 39.0103 141.967 11.0101 0.1 0.2 0.8
+.color 0.000000 0.022567 0.977433
+.arrow 35 143 11 35.0513 142.834 11.0502 0.1 0.2 0.8
+.color 0.000000 0.146684 0.853316
+.arrow 36 143 11 36.3334 141.923 11.3265 0.1 0.2 0.8
+.color 0.000000 0.073342 0.926658
+.arrow 37 143 11 37.1667 142.462 11.1633 0.1 0.2 0.8
+.color 0.000000 0.020686 0.979314
+.arrow 38 143 11 38.047 142.848 11.046 0.1 0.2 0.8
+.color 0.000000 0.004963 0.995037
+.arrow 39 143 11 39.0113 142.964 11.011 0.1 0.2 0.8
+.color 0.000000 0.005642 0.994358
+.arrow 35 144 11 35.0128 143.959 11.0126 0.1 0.2 0.8
+.color 0.000000 0.025388 0.974612
+.arrow 36 144 11 36.0577 143.814 11.0565 0.1 0.2 0.8
+.color 0.000000 0.020686 0.979314
+.arrow 37 144 11 37.047 143.848 11.046 0.1 0.2 0.8
+.color 0.000000 0.006895 0.993105
+.arrow 38 144 11 38.0157 143.949 11.0153 0.1 0.2 0.8
+.color 0.000000 0.004545 0.995455
+.arrow 36 145 11 36.0103 144.967 11.0101 0.1 0.2 0.8
+.color 0.000000 0.004963 0.995037
+.arrow 37 145 11 37.0113 144.964 11.011 0.1 0.2 0.8
+.color 0.000000 0.011283 0.988717
+.arrow 36 141 12 36.0256 140.917 12.0251 0.1 0.2 0.8
+.color 0.000000 0.005642 0.994358
+.arrow 37 141 12 37.0128 140.959 12.0126 0.1 0.2 0.8
+.color 0.000000 0.011283 0.988717
+.arrow 35 142 12 35.0256 141.917 12.0251 0.1 0.2 0.8
+.color 0.000000 0.025388 0.974612
+.arrow 37 142 12 37.0577 141.814 12.0565 0.1 0.2 0.8
+.color 0.000000 0.005642 0.994358
+.arrow 35 143 12 35.0128 142.959 12.0126 0.1 0.2 0.8
+.color 0.000000 0.025388 0.974612
+.arrow 36 143 12 36.0577 142.814 12.0565 0.1 0.2 0.8
+.color 0.000000 0.020686 0.979314
+.arrow 37 143 12 37.047 142.848 12.046 0.1 0.2 0.8
+.color 0.000000 0.006895 0.993105
+.arrow 38 143 12 38.0157 142.949 12.0153 0.1 0.2 0.8
+.color 0.000000 0.006895 0.993105
+.arrow 37 144 12 37.0157 143.949 12.0153 0.1 0.2 0.8
+.color 0.000000 0.004545 0.995455
+.arrow 37 142 13 37.0103 141.967 13.0101 0.1 0.2 0.8
+.color 0.000000 0.004545 0.995455
+.arrow 36 143 13 36.0103 142.967 13.0101 0.1 0.2 0.8
+.color 0.000000 0.004963 0.995037
+.arrow 37 143 13 37.0113 142.964 13.011 0.1 0.2 0.8