3 # The latest update : %G% at %U%
5 #%Z% mrcImageTranspose ver %I%
8 #%Z% Usage : mrcImageTranspose
12 static char __sccs_id[] = "%Z%mrcImageTranspose ver%I%; Date:%D% %Z%";
17 #define GLOBAL_DECLARATION
18 #include "../inc/config.h"
23 #include "mrcRefUtil.h"
27 void lmrcImageTranspose(mrcImage* out , mrcImage* in ,int mode ,int mode2);
30 main(int argc, char* argv[])
33 mrcImageTransposeInfo info;
39 /* input patameters ,file open */
41 argCheck(&info, argc, argv);
46 mrcFileRead(&in ,info.In ,"in main" ,0);
48 lmrcImageTranspose(&out ,&in ,info.mode ,info.Mode);
50 mrcFileWrite(&out ,info.Out ,"in main" ,0);
58 fprintf(stdout ,"----- mode1 -----\n");
59 fprintf(stdout ,"0:+90degree in xy plane around z-axis: x->+y\n");
60 fprintf(stdout ,"1:-90degree in xy plane around z-axis: x->-y\n");
61 fprintf(stdout ,"2:+90degree in yz plane around x-axis: y->+z\n");
62 fprintf(stdout ,"3:-90degree in yz plane around x-axis: y->-z\n");
63 fprintf(stdout ,"4:+90degree in zx plane around y-axis: z->+x\n");
64 fprintf(stdout ,"5:-90degree in zx plane around y-axis: z->-x\n");
65 fprintf(stdout ,"----- mode2 -----\n");
66 fprintf(stdout ,"0: Image\n");
67 fprintf(stdout ,"1: Ref Image(mode1 =0 or 1)\n");
70 void lmrcImageTranspose(mrcImage* out , mrcImage* in ,int mode ,int mode2)
74 int x,y,ox,oy,oz,flag,z;
79 out->Header = in->Header;
83 out->HeaderN.x = in->HeaderN.y;
84 out->HeaderN.y = in->HeaderN.x;
89 out->HeaderN.y = in->HeaderN.z;
90 out->HeaderN.z = in->HeaderN.y;
94 out->HeaderN.z = in->HeaderN.x;
95 out->HeaderN.x = in->HeaderN.z;
104 lmrcRefHeaderGet(&header ,in);
105 lmrcRefHeaderSet(out ,&header);
107 for (z=flag; z < in->HeaderN.z ;z++){
108 for (y=0; y < in->HeaderN.y ;y++){
109 for (x=0; x < in->HeaderN.x ;x++){
110 mrcPixelDataGet(in ,x ,y ,z ,&data ,mrcPixelRePart ,mrcPixelHowNearest);
113 ox = in->HeaderN.y - 1 - y;
119 oy = in->HeaderN.x - 1 - x;
124 oy = in->HeaderN.z - 1 - z;
130 oz = in->HeaderN.y - -1 - y;
135 oz = in->HeaderN.x - 1 - x;
138 ox = in->HeaderN.z - 1 - z;
144 mrcPixelDataSet(out, ox, oy, oz, data, mrcPixelRePart);
148 mrcStatDataSet(out,0);