#ifndef MRC_IMAGE_H #define MRC_IMAGE_H /* mrcImage.h * Language: C or CC(c++) * Editor : tacyas.tkyemg.u_tokyo * Date : 1990-1992 * Modified: 1993 */ #include "mrcError2.h" /* * Header File for MRC Format * Edited by Tac */ typedef long mrcImageParaTypeInteger; typedef float mrcImageParaTypeReal; typedef struct mrcImageParaTypeIntegerCoord { mrcImageParaTypeInteger x; mrcImageParaTypeInteger y; mrcImageParaTypeInteger z; } mrcImageParaTypeIntegerCoord; typedef struct mrcImageParaTypeRealCoord { mrcImageParaTypeReal x; mrcImageParaTypeReal y; mrcImageParaTypeReal z; } mrcImageParaTypeRealCoord; /* * MRC Image Header * Edited by Tac */ /* Header Size */ #define MRC_HEADER (1024) /* Image Data Type */ /* for compatibility */ typedef mrcImageParaTypeInteger mrcImageMode; #define MRC_char_image ((mrcImageMode)0) #define MRC_short_image ((mrcImageMode)1) #define MRC_float_image ((mrcImageMode)2) #define MRC_complex_short_ft ((mrcImageMode)3) #define MRC_complex_float_ft ((mrcImageMode)4) #define MRC_long_image ((mrcImageMode)101) #define MRC_double_image ((mrcImageMode)102) #define MRC_complex_long_ft ((mrcImageMode)103) #define MRC_complex_double_ft ((mrcImageMode)104) #define MRC_complex_short_fft ((mrcImageMode)1003) #define MRC_complex_float_fft ((mrcImageMode)1004) #define MRC_complex_long_fft ((mrcImageMode)1103) #define MRC_complex_double_fft ((mrcImageMode)1104) #define MRC_NotSuppotedMode ((mrcImageMode)0xffffffffL) #define mrcCharImage ((mrcImageMode)0) #define mrcShortImage ((mrcImageMode)1) #define mrcFloatImage ((mrcImageMode)2) #define mrcComplexShortFT ((mrcImageMode)3) #define mrcComplexFloatFT ((mrcImageMode)4) #define mrcLongImage ((mrcImageMode)101) #define mrcDoubleImage ((mrcImageMode)102) #define mrcComplexLongFT ((mrcImageMode)103) #define mrcComplexDoubleFT ((mrcImageMode)104) #define mrcComplexShortFFT ((mrcImageMode)1003) #define mrcComplexFloatFFT ((mrcImageMode)1004) #define mrcComplexLongFFT ((mrcImageMode)1103) #define mrcComplexDoubleFFT ((mrcImageMode)1104) #define mrcNotSuppotedMode ((mrcImageMode)0xffffffffL) #define MRC_MAX_LABEL_N (10) #define MRC_MAX_LABEL_LEN (80) #define MRC_MAX_EXTRA (29) /* Image Header */ typedef struct _mrcImageHeader { mrcImageParaTypeIntegerCoord N; /* Data Numbers */ mrcImageMode Mode; /* Data Type */ mrcImageParaTypeIntegerCoord StartN; /* First in map */ mrcImageParaTypeIntegerCoord M; /* Number of Intervals */ mrcImageParaTypeRealCoord Length; /* Cell Dimensions : Angstrom */ mrcImageParaTypeReal Alpha; /* Cell Angle : Degree */ mrcImageParaTypeReal Beta; mrcImageParaTypeReal Gamma; mrcImageParaTypeInteger MAPC; /* Which Axis Corresponds to Columns */ mrcImageParaTypeInteger MAPR; /* Which Axis Corresponds to Rows */ mrcImageParaTypeInteger MAPS; /* Which Axis Corresponds to Sections */ mrcImageParaTypeReal AMin; /* Minimum Density Value */ mrcImageParaTypeReal AMax; /* Maximum Density Value */ mrcImageParaTypeReal AMean; /* Mean Density Value */ mrcImageParaTypeInteger ISPG; /* Space Group */ mrcImageParaTypeInteger NSYMBT; /* Number of bytes */ mrcImageParaTypeReal EXTRA[MRC_MAX_EXTRA]; /* Extra, user defined storage space */ mrcImageParaTypeReal OriginX; mrcImageParaTypeReal OriginY; mrcImageParaTypeInteger LabelN; char Label[MRC_MAX_LABEL_N][MRC_MAX_LABEL_LEN]; } _mrcImageHeader; typedef union mrcImageHeader { unsigned char All[MRC_HEADER]; mrcImageParaTypeInteger Int[MRC_HEADER/4]; mrcImageParaTypeReal Real[MRC_HEADER/4]; _mrcImageHeader Cont; } mrcImageHeader; /* * mrcImage Structure */ typedef struct mrcImage { mrcImageHeader Header; mrcImageParaTypeInteger BytePerBand; mrcImageParaTypeInteger BandPerPixel; mrcImageParaTypeInteger PixelPerImage; mrcStatusType Status; char* Image; char* ImageCharImage; short* ImageShortImage; long* ImageLongImage; float* ImageFloatImage; double* ImageDoubleImage; } mrcImage; typedef struct mrcImageInformation { double mean; double max; double min; double sd; double se; } mrcImageInformation; /* * Define */ #define HeaderN Header.Cont.N #define HeaderMode Header.Cont.Mode #define HeaderStartN Header.Cont.StartN #define HeaderM Header.Cont.M #define HeaderLength Header.Cont.Length #define HeaderAlpha Header.Cont.Alpha #define HeaderBeta Header.Cont.Beta #define HeaderGamma Header.Cont.Gamma #define HeaderMAPC Header.Cont.MAPC #define HeaderMAPR Header.Cont.MAPR #define HeaderMAPS Header.Cont.MAPS #define HeaderAMin Header.Cont.AMin #define HeaderAMax Header.Cont.AMax #define HeaderAMean Header.Cont.AMean #define HeaderISPG Header.Cont.ISPG #define HeaderNSYMBT Header.Cont.NSYMBT #define HeaderEXTRA Header.Cont.EXTRA #define HeaderOriginX Header.Cont.OriginX #define HeaderOriginY Header.Cont.OriginY #define HeaderLabelN Header.Cont.LabelN #define HeaderLabel Header.Cont.Label typedef enum mrcPixelDataType { mrcPixelRePart = 0, mrcPixelImPart, mrcPixelMag, mrcPixelPow, mrcPixelLogMag, mrcPixelLogPow, mrcPixelPhase } mrcPixelDataType; typedef enum mrcPixelDataHowToGet { mrcPixelHowNearest = 0, mrcPixelHowLinear, mrcPixelHowPolySig, mrcPixelHowCubicConv } mrcPixelDataHowToGet; /* Utility Routines */ #ifdef __cplusplus extern "C" { #endif /* in mrcInit.c */ extern mrcStatusType mrcInit(mrcImage* mrc, char* filaname); /* in mrcRead.c */ extern mrcStatusType mrcFileRead (mrcImage* mrc, char* filename, char* message, long mode); extern mrcStatusType mrcImageRead (mrcImage* mrc, char* filename, char* message, long mode); extern mrcStatusType mrcHeaderRead(mrcImage* mrc, char* filename, char* message, long mode); /* in mrcWrite.c */ extern mrcStatusType mrcFileWrite (mrcImage* mrc, char* filename, char* message, long mode); extern mrcStatusType mrcImageWrite (mrcImage* mrc, char* filename, char* message, long mode); extern mrcStatusType mrcHeaderWrite(mrcImage* mrc, char* filename, char* message, long mode); /* in mrcGet.c */ extern double mrcPixelDataGet(mrcImage* mrc, mrcImageParaTypeReal x, mrcImageParaTypeReal y, mrcImageParaTypeReal z, double* data, mrcPixelDataType mode, mrcPixelDataHowToGet how); /* in mrcSet.c */ extern double mrcPixelDataSet(mrcImage* mrc, mrcImageParaTypeReal x, mrcImageParaTypeReal y, mrcImageParaTypeReal z, double data, mrcPixelDataType mode); extern void mrcStatDataSet(mrcImage* mrc, mrcImageParaTypeInteger mode); /* in mrcImageInfo.c */ extern void lmrcImageXProjection(mrcImage* proj, mrcImage* img); extern void lmrcImageYProjection(mrcImage* proj, mrcImage* img); extern void lmrcImageZProjection(mrcImage* proj, mrcImage* img); extern void lmrcImageXYProjection(mrcImage* proj, mrcImage* img); extern void lmrcImageYZProjection(mrcImage* proj, mrcImage* img); extern void lmrcImageZXProjection(mrcImage* proj, mrcImage* img); extern void lmrcImageHistgram(double** hist, unsigned long nlevel, mrcImage* img); extern void lmrcImageInformation(mrcImageInformation* info, mrcImage* img); /* in mrcUtil.c */ extern int IsImage(mrcImage* mrc, char* message, mrcImageParaTypeInteger mode); extern int IsFT(mrcImage* mrc, char* message, mrcImageParaTypeInteger mode); extern int IsFFT(mrcImage* mrc, char* message, mrcImageParaTypeInteger mode); extern void mrcInfoSet(mrcImage* mrc, FILE* fptIn, FILE* fptOut, long mode); /* in mrcPrint.c */ extern void mrcInfoPrint(FILE* fpt, mrcImage* mrc, mrcImageParaTypeInteger mode); extern void mrcImagePSFilePrint(FILE* fpt, mrcImage* mrc, char* message, double scale, long nContour, double* level, long mode); #ifdef __cplusplus }; #endif #endif /* MRC_IMAGE_H */