00001
00002
00003
00004
00005
00006
00007
00008 #ifndef MAPDEPTHMATRIX_H_
00009 #define MAPDEPTHMATRIX_H_
00010
00011 #include <complex.h>
00012 #include "objectfits.h"
00013 #include "matrix.h"
00014 #include "Mask.h"
00015
00033 typedef struct {
00034 FloatComplex *data;
00035 int nX;
00036 int nY;
00037 int nZ;
00038 int nT;
00039 int nV;
00040 MatrixType mtype;
00041 bool shift;
00042 int nYOriginal;
00043
00044 } MAP_DEPTH_MATRIX;
00045
00050 enum DataSpace {REAL_SPACE, WAVE_SPACE};
00051
00052 #endif
00053
00054 MAP_DEPTH_MATRIX newMapDepthMatrix(int x, int y, int z, int t, bool shift);
00055 MAP_DEPTH_MATRIX newMapDepthMatrixV(int x, int y, int z, int t, int v, bool shift);
00056
00057 void destroyMapDepthMatrix(MAP_DEPTH_MATRIX td);
00058
00059 bool isEmptyMapDepthMatrix(const MAP_DEPTH_MATRIX *td);
00060
00061 MATRIX extractMapDepth(int kx, int ky, MAP_DEPTH_MATRIX td);
00062
00063 void insertMapDepth(int kx, int ky, MATRIX m, MAP_DEPTH_MATRIX *td);
00064
00065 MATRIX extractXYPlaneFromMapDepthMatrix(int map, int depth, MAP_DEPTH_MATRIX td);
00066 MATRIX extractXYPlaneFromMapDepthMatrixV(int map, int depth, int v, MAP_DEPTH_MATRIX td);
00067 MATRIX extractXYPlaneFromDoubleArray(int map, int depth, int v, int nX, int nY, int nZ, int nT, int nV, Float *td);
00068
00069 void insertXYPlaneIntoMapDepthMatrix(MATRIX xyPlane, int map, int depth, MAP_DEPTH_MATRIX *td);
00070 void insertXYPlaneIntoMapDepthMatrixV(MATRIX xyPlane, int map, int depth, int v, MAP_DEPTH_MATRIX *td);
00071 void insertXYPlaneIntoDoubleArray(MATRIX xyPlane, int map, int depth, int v, int nX, int nY,
00072 int nZ, int nT, int nV, Float *tdptr);
00073
00074 MATRIX extractXYPlaneColMajorMapDepthMatrix(int map, int depth, const MAP_DEPTH_MATRIX *td);
00075 MATRIX extractXYPlaneColMajorMapDepthMatrixV(int map, int depth, int v, const MAP_DEPTH_MATRIX *tdptr);
00076 void insertXYPlaneColMajorMapDepthMatrix(MATRIX xyPlane, int map, int depth, MAP_DEPTH_MATRIX *tdptr);
00077 void insertXYPlaneColMajorMapDepthMatrixV(MATRIX xyPlane, int map, int depth, int v, MAP_DEPTH_MATRIX *tdptr);
00078
00079 MAP_DEPTH_MATRIX readMapDepthMatrix(char *basedir, char *filenames[], int nFiles, bool useFT);
00080 MAP_DEPTH_MATRIX readMapDepthMatrixKernel(char *basedir, char *filenames[], int nFiles, bool useFT);
00081 MAP_DEPTH_MATRIX readMapDepthMatrixV(char *basedir, char *filenames[], int nFiles, int vdim, bool useFT);
00082 MAP_DEPTH_MATRIX readMapDepthMatrixFromOneFile(char *filename, bool useFT);
00083 MAP_DEPTH_MATRIX readMapDepthMatrixFromOneFileS(char *filename, bool useFT, bool shiftOnInput, bool shiftOnOutput);
00084 MAP_DEPTH_MATRIX readMapDepthMatrixForTarget(char *filename, bool useFT);
00085
00086 void writeMapDepthMatrix(char *filenames[], int nFiles, MAP_DEPTH_MATRIX tdm,
00087 bool useFT, FITSParameters headerParameters);
00088
00089 void writeDepthMapMatrix(char *filenames[], int nFiles, MAP_DEPTH_MATRIX tdm, bool useFT, FITSParameters headerParameters);
00090
00091
00092 void writeAvgKernelMatrix(char *filenames[], int nFiles, MAP_DEPTH_MATRIX tdm, bool useFT, Float lambda);
00093
00094 void writeMapDepthMatrixToOneFile(char *filename, MAP_DEPTH_MATRIX tdm,
00095 bool useFT, FITSParameters headerParameters);
00096
00097 MAP_DEPTH_MATRIX inverseMapDepth(MAP_DEPTH_MATRIX tdm);
00098
00099 MAP_DEPTH_MATRIX convertMapDepth(const MAP_DEPTH_MATRIX *tdm, MatrixOrder order);
00100 MAP_DEPTH_MATRIX convertMapDepthSpace(const MAP_DEPTH_MATRIX *tdm, enum DataSpace toSpace);
00101
00102 void TdmMultiplyScalarTakeConjugate(MAP_DEPTH_MATRIX *tdmPtr, Float scalar);
00103 void TdmMultiplyScalar(MAP_DEPTH_MATRIX *tdmPtr, Float scalar);
00104
00105 void MdmMultiplyMatrix(MAP_DEPTH_MATRIX *tdmPtr, MATRIX theta);
00106
00107 void ZeroK0(MAP_DEPTH_MATRIX *tdmPtr);
00108
00109 MAP_DEPTH_MATRIX TdmCopy(MAP_DEPTH_MATRIX tdm);
00110
00111 void pack(const MAP_DEPTH_MATRIX *w_n, MATRIX *x, const MASK *mask);
00112 void unpack(MATRIX *x, const MASK *mask, MAP_DEPTH_MATRIX *w);
00113
00114 void pack2(const MAP_DEPTH_MATRIX *w_n, MATRIX *x, const MAP_DEPTH_MATRIX *mask);
00115 void unpack2(const MAP_DEPTH_MATRIX *in, const MAP_DEPTH_MATRIX *mask, MAP_DEPTH_MATRIX *out);
00116 void unpack3(const MAP_DEPTH_MATRIX *in, const MAP_DEPTH_MATRIX *mask, MAP_DEPTH_MATRIX *out);
00117
00118 MATRIX TdmFlatten(MAP_DEPTH_MATRIX tdm);
00119 void TdmRebuild(MATRIX m, MAP_DEPTH_MATRIX *tdm);
00120
00121 MAP_DEPTH_MATRIX XYTransposeMapDepthMatrix(const MAP_DEPTH_MATRIX *K);