5 # The latest update : %G% at %U%
7 #%Z% mrcImage.h ver %I%
10 #%Z% Usage : mrcImage.h
16 * Language: C or CC(c++)
17 * Editor : tacyas.tkyemg.u_tokyo
19 * Modified: 2012 for CCP4(2000)
23 * Header File for MRC Format
35 typedef unsigned int mrcStatusMask;
37 typedef unsigned int mrcStatusMask;
42 typedef unsigned int mrcStatusType;
44 typedef unsigned int mrcStatusType;
51 #define mrcStatusMask_ExitFailure ((mrcStatusMask)0x80000000L)
52 #define mrcStatusMask_Warning ((mrcStatusMask)0x40000000L)
53 #define mrcStatusMask_Information ((mrcStatusMask)0x20000000L)
54 #define mrcStatusMask_Message ((mrcStatusMask)0x10000000L)
55 #define mrcStatusMask_1B ((mrcStatusMask)0x08000000L)
56 #define mrcStatusMask_1A ((mrcStatusMask)0x04000000L)
57 #define mrcStatusMask_19 ((mrcStatusMask)0x02000000L)
58 #define mrcStatusMask_18 ((mrcStatusMask)0x01000000L)
59 #define mrcStatusMask_17 ((mrcStatusMask)0x00800000L)
60 #define mrcStatusMask_16 ((mrcStatusMask)0x00400000L)
61 #define mrcStatusMask_15 ((mrcStatusMask)0x00200000L)
62 #define mrcStatusMask_14 ((mrcStatusMask)0x00100000L)
63 #define mrcStatusMask_ReferMRCInfo ((mrcStatusMask)0x00080000L)
64 #define mrcStatusMask_Mode ((mrcStatusMask)0x00040000L)
65 #define mrcStatusMask_ReferMemory ((mrcStatusMask)0x00020000L)
66 #define mrcStatusMask_ReferFile ((mrcStatusMask)0x00010000L)
68 #define MRC_Status_OK ((mrcStatusType)0x00000000L)
70 #define MRC_FileCanNotOpened ((mrcStatusType)0x00000000L|mrcStatusMask_ReferFile)
71 #define MRC_ImageHeaderCanNotRead ((mrcStatusType)0x00000001L|mrcStatusMask_ReferFile)
72 #define MRC_ImageDataCanNotRead ((mrcStatusType)0x00000002L|mrcStatusMask_ReferFile)
73 #define MRC_ImageHeaderCanNotWrite ((mrcStatusType)0x00000003L|mrcStatusMask_ReferFile)
74 #define MRC_ImageDataCanNotWrite ((mrcStatusType)0x00000004L|mrcStatusMask_ReferFile)
75 #define MRC_FileCanNotClosed ((mrcStatusType)0x00000005L|mrcStatusMask_ReferFile)
77 #define MRC_MemoryNotAllocate ((mrcStatusType)0x00000000L|mrcStatusMask_ReferMemory)
79 #define MRC_ModeNotSupported ((mrcStatusType)0x00000000L|mrcStatusMask_Mode)
80 #define MRC_ModeZNot1FFTMode ((mrcStatusType)0x00000001L|mrcStatusMask_Mode)
82 #define MRC_SizeOfZero ((mrcStatusType)0x00000000L|mrcStatusMask_ReferMRCInfo)
87 typedef union MRC_Status_t {
92 unsigned char category;
96 unsigned char category;
103 typedef int mrcImageParaTypeInteger;
105 typedef int mrcImageParaTypeInteger;
108 typedef float mrcImageParaTypeReal;
109 typedef unsigned char mrcImageParaTypeCharacter;
111 typedef struct mrcImageParaTypeIntegerCoord {
112 mrcImageParaTypeInteger x;
113 mrcImageParaTypeInteger y;
114 mrcImageParaTypeInteger z;
115 } mrcImageParaTypeIntegerCoord;
117 typedef struct mrcImageParaTypeRealCoord {
118 mrcImageParaTypeReal x;
119 mrcImageParaTypeReal y;
120 mrcImageParaTypeReal z;
121 } mrcImageParaTypeRealCoord;
130 #define MRC_HEADER (1024)
131 #define MRC_TAILER (1024)
133 /* Image Data Type */
134 /* for compatibility */
135 typedef mrcImageParaTypeInteger mrcImageMode;
136 #define MRC_char_image ((mrcImageMode)0)
137 #define MRC_short_image ((mrcImageMode)1)
138 #define MRC_float_image ((mrcImageMode)2)
139 #define MRC_complex_short_ft ((mrcImageMode)3)
140 #define MRC_complex_float_ft ((mrcImageMode)4)
141 #define MRC_long_image ((mrcImageMode)101)
142 #define MRC_double_image ((mrcImageMode)102)
143 #define MRC_complex_long_ft ((mrcImageMode)103)
144 #define MRC_complex_double_ft ((mrcImageMode)104)
145 #define MRC_complex_short_fft ((mrcImageMode)1003)
146 #define MRC_complex_float_fft ((mrcImageMode)1004)
147 #define MRC_complex_long_fft ((mrcImageMode)1103)
148 #define MRC_complex_double_fft ((mrcImageMode)1104)
149 #define MRC_NotSuppotedMode ((mrcImageMode)0xffffffffL)
151 #define mrcCharImage ((mrcImageMode)0)
152 #define mrcShortImage ((mrcImageMode)1)
153 #define mrcFloatImage ((mrcImageMode)2)
154 #define mrcComplexShortFT ((mrcImageMode)3)
155 #define mrcComplexFloatFT ((mrcImageMode)4)
156 #define mrcComplexFloatOneDimFT ((mrcImageMode)5)
157 #define mrcFloatRadonImage ((mrcImageMode)6)
158 #define mrcFloatRadonFT ((mrcImageMode)7)
159 #define mrcLongImage ((mrcImageMode)101)
160 #define mrcDoubleImage ((mrcImageMode)102)
161 #define mrcComplexLongFT ((mrcImageMode)103)
162 #define mrcComplexDoubleFT ((mrcImageMode)104)
163 #define mrcComplexShortFFT ((mrcImageMode)1003)
164 #define mrcComplexFloatFFT ((mrcImageMode)1004)
165 #define mrcComplexLongFFT ((mrcImageMode)1103)
166 #define mrcComplexDoubleFFT ((mrcImageMode)1104)
167 #define mrcNotSuppotedMode ((mrcImageMode)0xffffffffL)
169 #define MRC_MAX_LABEL_N (10)
170 #define MRC_MAX_LABEL_LEN (80)
171 #define MRC_MAX_EXTRA (29)
172 #define MRC_MAX_EXTRA_CCP4 (15)
178 typedef struct _mrcImageHeader {
179 mrcImageParaTypeIntegerCoord N; /* Data Numbers */
180 mrcImageMode Mode; /* Data Type */
181 mrcImageParaTypeIntegerCoord StartN; /* First in map */
182 mrcImageParaTypeIntegerCoord M; /* Number of Intervals */
183 mrcImageParaTypeRealCoord Length; /* Cell Dimensions : Angstrom */
184 mrcImageParaTypeReal Alpha; /* Cell Angle : Degree */
185 mrcImageParaTypeReal Beta;
186 mrcImageParaTypeReal Gamma;
187 mrcImageParaTypeInteger MAPC; /* Which Axis Corresponds to Columns */
188 mrcImageParaTypeInteger MAPR; /* Which Axis Corresponds to Rows */
189 mrcImageParaTypeInteger MAPS; /* Which Axis Corresponds to Sections */
190 mrcImageParaTypeReal AMin; /* Minimum Density Value */
191 mrcImageParaTypeReal AMax; /* Maximum Density Value */
192 mrcImageParaTypeReal AMean; /* Mean Density Value */
193 mrcImageParaTypeInteger ISPG; /* Space Group */
194 mrcImageParaTypeInteger NSYMBT; /* Number of bytes */
195 mrcImageParaTypeReal EXTRA[MRC_MAX_EXTRA]; /* Extra, user defined storage space */
196 mrcImageParaTypeReal OriginX;
197 mrcImageParaTypeReal OriginY;
198 mrcImageParaTypeInteger LabelN;
199 char Label[MRC_MAX_LABEL_N][MRC_MAX_LABEL_LEN];
202 /* For CCP4 2000 : Current New */
203 typedef struct _mrcImageHeaderCCP4 {
204 mrcImageParaTypeIntegerCoord N; /* Data Numbers */
205 mrcImageMode Mode; /* Data Type */
206 mrcImageParaTypeIntegerCoord StartN; /* First in map */
207 mrcImageParaTypeIntegerCoord NI; /* Number of Intervals */
208 mrcImageParaTypeRealCoord Length; /* Cell Dimensions : Angstrom */
209 mrcImageParaTypeReal Alpha; /* Cell Angle : Degree */
210 mrcImageParaTypeReal Beta;
211 mrcImageParaTypeReal Gamma;
212 mrcImageParaTypeInteger MAPC; /* Which Axis Corresponds to Columns */
213 mrcImageParaTypeInteger MAPR; /* Which Axis Corresponds to Rows */
214 mrcImageParaTypeInteger MAPS; /* Which Axis Corresponds to Sections */
215 mrcImageParaTypeReal AMin; /* Minimum Density Value */
216 mrcImageParaTypeReal AMax; /* Maximum Density Value */
217 mrcImageParaTypeReal AMean; /* Mean Density Value */
218 mrcImageParaTypeInteger ISPG; /* Space Group */
219 mrcImageParaTypeInteger NSYMBT; /* Number of bytes used for storing symmetry operators */
220 mrcImageParaTypeInteger LSKFLG; /* Flag for Skew transformation */
221 mrcImageParaTypeReal SKWMAT[9]; /* Skew matrix S */
222 mrcImageParaTypeReal SKWTRN[3]; /* Skew translation */
223 mrcImageParaTypeReal EXTRA[MRC_MAX_EXTRA_CCP4]; /* Extra, user defined storage space */
224 mrcImageParaTypeCharacter MAP[4];
225 mrcImageParaTypeInteger MARCHST;
226 mrcImageParaTypeReal ARMS;
227 mrcImageParaTypeInteger LabelN;
228 char Label[MRC_MAX_LABEL_N][MRC_MAX_LABEL_LEN];
229 } _mrcImageHeaderCCP4;
232 typedef union mrcImageHeader {
233 unsigned char All[MRC_HEADER];
234 mrcImageParaTypeInteger Int[MRC_HEADER/4];
235 mrcImageParaTypeReal Real[MRC_HEADER/4];
236 _mrcImageHeader Cont;
237 _mrcImageHeaderCCP4 ContCCP4;
246 #define mrcImageTailerMode2DProjection 0
250 typedef struct _mrcImageTailer {
252 mrcImageParaTypeInteger Mode;
253 char EulerAngleMode[4];
254 mrcImageParaTypeReal Rot1;
255 mrcImageParaTypeReal Rot2;
256 mrcImageParaTypeReal Rot3;
257 mrcImageParaTypeInteger Mirror;
261 typedef union mrcImageTailer {
262 unsigned char All[MRC_TAILER];
263 mrcImageParaTypeInteger Int[MRC_TAILER/4];
264 mrcImageParaTypeReal Real[MRC_TAILER/4];
265 _mrcImageTailer Cont;
269 typedef char mrcImageSymmetryOperator;
274 typedef struct mrcImage {
275 mrcImageHeader Header;
276 mrcImageParaTypeInteger BytePerImage;
277 mrcImageParaTypeInteger BytePerBand;
278 mrcImageParaTypeInteger BandPerPixel;
279 mrcImageParaTypeInteger PixelPerImage;
280 mrcStatusType status;
282 unsigned char* ImageCharImage;
283 unsigned short* ImageShortImage;
284 unsigned long* ImageLongImage;
285 float* ImageFloatImage;
286 double* ImageDoubleImage;
287 mrcImageTailer* Tailer;
288 mrcImageParaTypeInteger numTailer;
291 mrcImageParaTypeInteger flagByteSwap;
294 mrcImageParaTypeInteger flagCCP4;
295 mrcImageParaTypeInteger ImageOffset;
296 mrcImageSymmetryOperator* SymmetryOperator;
299 typedef struct mrcImageInformation {
301 double rootMeanSquare;
302 double meanOfSphereSurface;
303 double sdOfSphereSurface;
304 double seOfSphereSurface;
305 double meanOfCylinderSurface;
306 double sdOfCylinderSurface;
307 double seOfCylinderSurface;
312 mrcImageParaTypeRealCoord maxCoord;
314 mrcImageParaTypeRealCoord minCoord;
319 double RMS; /* Root mean square */
321 } mrcImageInformation;
326 typedef enum mrcImageInformationMode {
328 meanOfSphereSurface = 1,
329 meanOfCylinderSurface = 2,
335 } mrcImageInformationMode;
340 #define HeaderN Header.Cont.N
341 #define HeaderMode Header.Cont.Mode
342 #define HeaderStartN Header.Cont.StartN
343 #define HeaderM Header.Cont.M
344 #define HeaderLength Header.Cont.Length
345 #define HeaderAlpha Header.Cont.Alpha
346 #define HeaderBeta Header.Cont.Beta
347 #define HeaderGamma Header.Cont.Gamma
348 #define HeaderMAPC Header.Cont.MAPC
349 #define HeaderMAPR Header.Cont.MAPR
350 #define HeaderMAPS Header.Cont.MAPS
351 #define HeaderAMin Header.Cont.AMin
352 #define HeaderAMax Header.Cont.AMax
353 #define HeaderAMean Header.Cont.AMean
354 #define HeaderISPG Header.Cont.ISPG
355 #define HeaderNSYMBT Header.Cont.NSYMBT
356 #define HeaderLSKFLG Header.ContCCP4.LSKFLG
357 #define HeaderEXTRA Header.Cont.EXTRA
358 #define HeaderOriginX Header.Cont.OriginX
359 #define HeaderOriginY Header.Cont.OriginY
360 #define HeaderLabelN Header.Cont.LabelN
361 #define HeaderLabel Header.Cont.Label
363 typedef enum mrcPixelDataType {
373 typedef enum mrcPixelDataHowToGet {
374 mrcPixelHowNearest = 0,
376 mrcPixelHowCubicConv,
378 } mrcPixelDataHowToGet;
383 typedef struct lmrcImageSmoothingInfo {
385 mrcImageParaTypeReal sx; /* Filter kernel size */
386 mrcImageParaTypeReal sy;
387 mrcImageParaTypeReal sz;
388 double sigma; /* for Lee-Sigma filter */
389 } lmrcImageSmoothingInfo;
391 typedef struct lmrcImageCVEInfo {
392 long sx; /* CVE domain size. */
393 long sy; /* Apr.30,1996 */
397 typedef struct lmrcImageTfunctionInfo {
398 long sx; /* Tfunction domain size. */
399 long sy; /* June 11,1996 */
401 } lmrcImageTfunctionInfo;
403 typedef struct lmrcImageHighlightInfo {
405 float Bias; /* May 1,1996 */
407 } lmrcImageHighlightInfo;
409 typedef struct lmrcImageLowPassFilterInfo
411 long mode; /* June 4,1996 */
413 } lmrcImageLowPassFilterInfo;
415 typedef struct lmrcImageHighPassFilterInfo
417 long mode; /* June 5,1996 */
420 float pathWindowHigh;
421 } lmrcImageHighPassFilterInfo;
423 typedef struct lmrcImageBandPassFilterInfo
425 long mode; /* June 5,1996 */
426 float hvl, hvh, wl, wh;
429 } lmrcImageBandPassFilterInfo;
432 /* Utility Routines */
436 /* prototype begin */
438 extern mrcStatusType mrcInit(mrcImage* mrc, char* filaname);
439 extern mrcStatusType mrcDefaultHeaderValueSet(mrcImage* mrc);
440 extern mrcStatusType mrcDefaultHeaderValueSetOnlyFixedValue(mrcImage* mrc);
441 extern mrcStatusType mrcHiddenDataSet(mrcImage* mrc, long mode);
442 extern void mrcImageFree(mrcImage* mrc, char* message);
444 extern void mrcTailerInit(mrcImage* mrc, long mode);
445 extern void mrcTailerCopy(mrcImage* dst, mrcImage* src, long mode);
446 /* mode 1: Tailer Memory Allocation */
448 extern mrcStatusType mrcFileRead (mrcImage* mrc, char* filename, char* message, long mode);
449 extern mrcStatusType mrcImageRead (mrcImage* mrc, char* filename, char* message, long mode);
450 extern mrcStatusType mrcHeaderRead(mrcImage* mrc, char* filename, char* message, long mode);
451 extern mrcStatusType mrcTailerRead(mrcImage* mrc, char* filename, char* message, long mode);
453 #define mrcFileWriteModeGet(x) BYTE4GETBYTE(x,0)
454 #define mrcImageWriteModeGet(x) BYTE4GETBYTE(x,1)
455 #define mrcHeaderWriteModeGet(x) BYTE4GETBYTE(x,2)
456 #define mrcTailerWriteModeGet(x) BYTE4GETBYTE(x,3)
458 #define mrcFileWriteMode_InfoPrint 1
459 #define mrcFileWriteMode_NoCallForStatData 2
461 extern mrcStatusType mrcFileWrite (mrcImage* mrc, char* filename, char* message, long mode);
462 extern mrcStatusType mrcImageWrite (mrcImage* mrc, char* filename, char* message, long mode);
463 extern mrcStatusType mrcHeaderWrite(mrcImage* mrc, char* filename, char* message, long mode);
464 extern mrcStatusType mrcTailerWrite(mrcImage* mrc, char* filename, char* message, long mode);
466 extern mrcStatusType mrcFileWriteLowerResolution(mrcImage* mrc, char* filename, char* message, long sample , long mode);
468 extern double mrcImageDataGetbyAU(mrcImage* mrc,
469 mrcImageParaTypeReal x /* Angstrom */,
470 mrcImageParaTypeReal y /* Angstrom */,
471 mrcImageParaTypeReal z /* Angstrom */,
473 mrcPixelDataType mode,
474 mrcPixelDataHowToGet how);
475 extern double mrcPixelDataGet(mrcImage* mrc,
476 mrcImageParaTypeReal x /* Pixel Unit */,
477 mrcImageParaTypeReal y /* Pixel Unit */,
478 mrcImageParaTypeReal z /* Pixel Unit */,
480 mrcPixelDataType mode,
481 mrcPixelDataHowToGet how);
483 extern inline double mrcPixelDataGetFloatImage(mrcImage* img,
484 mrcImageParaTypeInteger x, mrcImageParaTypeInteger y, mrcImageParaTypeInteger z)
486 return img->ImageFloatImage[x + y*img->HeaderN.x + z*img->HeaderN.x*img->HeaderN.y];
489 extern inline double mrcPixelDataGetFloatFTRe(mrcImage* fft,
490 mrcImageParaTypeInteger x, mrcImageParaTypeInteger y, mrcImageParaTypeInteger z)
492 return fft->ImageFloatImage[2*(x + y*(fft->HeaderN.x/2+1) + z*(fft->HeaderN.x/2+1)*fft->HeaderN.y)];
494 extern inline double mrcPixelDataGetFloatFTIm(mrcImage* fft,
495 mrcImageParaTypeInteger x, mrcImageParaTypeInteger y, mrcImageParaTypeInteger z)
497 return fft->ImageFloatImage[2*(x + y*(fft->HeaderN.x/2+1) + z*(fft->HeaderN.x/2+1)*fft->HeaderN.y)+1];
500 /* in mrcImageSet.c */
501 extern void mrcInfoSet(mrcImage* mrc, FILE* fptIn, FILE* fptOut, mrcImageParaTypeInteger mode);
506 /* in mrcImageDataSet.c */
507 typedef enum mrcImageDataSetMode {
508 mrcImageDataSetModeCentre = 0,
509 mrcImageDataSetModeOrigin = 1
510 } mrcImageDataSetMode;
513 /* prototype begin */
514 extern void mrcImageDataSet(mrcImage* out,
516 mrcImageParaTypeReal x,
517 mrcImageParaTypeReal y,
518 mrcImageParaTypeReal z,
520 mrcImageDataSetMode mode);
523 extern double mrcImageDataSetbyAU(mrcImage* mrc,
524 mrcImageParaTypeReal x /* Angstrom */,
525 mrcImageParaTypeReal y /* Angstrom */,
526 mrcImageParaTypeReal z /* Angstrom */,
528 mrcPixelDataType mode);
529 extern double mrcPixelDataSet(mrcImage* mrc,
530 mrcImageParaTypeReal x /* Pixel Unit */,
531 mrcImageParaTypeReal y /* Pixel Unit */,
532 mrcImageParaTypeReal z /* Pixel Unit */,
534 mrcPixelDataType mode);
536 extern inline void mrcPixelDataSetFloatImage(mrcImage* img,
537 mrcImageParaTypeInteger x, mrcImageParaTypeInteger y, mrcImageParaTypeInteger z, double data)
539 img->ImageFloatImage[x + y*img->HeaderN.x + z*img->HeaderN.x*img->HeaderN.y] = (float)data;
542 extern inline void mrcPixelDataSetFloatFTRe(mrcImage* fft,
543 mrcImageParaTypeInteger x, mrcImageParaTypeInteger y, mrcImageParaTypeInteger z, double data)
545 fft->ImageFloatImage[2*(x + y*(fft->HeaderN.x/2+1) + z*(fft->HeaderN.x/2+1)*fft->HeaderN.y)] = (float)data;
548 extern inline void mrcPixelDataSetFloatFTIm(mrcImage* fft,
549 mrcImageParaTypeInteger x, mrcImageParaTypeInteger y, mrcImageParaTypeInteger z, double data)
551 fft->ImageFloatImage[2*(x + y*(fft->HeaderN.x/2+1) + z*(fft->HeaderN.x/2+1)*fft->HeaderN.y)+1] = (float)data;
555 extern void mrcStatDataSet(mrcImage* mrc, mrcImageParaTypeInteger mode);
559 /* in mrcImageInfo.c */
560 extern void lmrcImageXSection(mrcImage* proj, mrcImage* img, double Y);
561 extern void lmrcImageYSection(mrcImage* proj, mrcImage* img, double X);
562 extern void lmrcImageXProjection(mrcImage* proj, mrcImage* img);
563 extern void lmrcImageYProjection(mrcImage* proj, mrcImage* img);
564 extern void lmrcImageZProjection(mrcImage* proj, mrcImage* img);
565 extern void lmrcImageXYProjection(mrcImage* proj, mrcImage* img);
566 extern void lmrcImageYZProjection(mrcImage* proj, mrcImage* img);
567 extern void lmrcImageZXProjection(mrcImage* proj, mrcImage* img);
569 /* Frequecy max -> 1 */
570 extern void lmrcImageHistgram(double** hist, unsigned long nlevel, mrcImage* img);
571 extern void lmrcImageHistgram2(double** hist, double delta, mrcImage* img);
572 extern void lmrcImageHistgram5(double** hist, unsigned long nlevel, double Low, double High, mrcImage* img);
574 extern void lmrcImageHistgram3(double** hist, unsigned long nlevel, mrcImage* img);
575 extern void lmrcImageHistgram4(double** hist, double delta, mrcImage* img);
576 extern void lmrcImageHistgram6(double** hist, unsigned long nlevel, double Low, double High, mrcImage* img);
577 extern void lmrcImageInformation(mrcImageInformation* info, mrcImage* img);
580 /* in mrcImageCopy.c */
581 extern void lmrcImageCopy(mrcImage* dst, mrcImage* src, mrcImageParaTypeRealCoord to);
584 extern int IsFloatImage(mrcImage* mrc, char* message, mrcImageParaTypeInteger mode);
585 extern int IsFloatFT(mrcImage* mrc, char* message, mrcImageParaTypeInteger mode);
586 extern int IsImage(mrcImage* mrc, char* message, mrcImageParaTypeInteger mode);
587 extern int IsFT(mrcImage* mrc, char* message, mrcImageParaTypeInteger mode);
588 extern int IsFFT(mrcImage* mrc, char* message, mrcImageParaTypeInteger mode);
589 extern void mrcImageInfoSet(mrcImage* mrc, FILE* fptIn, FILE* fptOut, long mode);
591 /* in mrcImageOperation.c */
592 extern void lmrcImageDevidedByImage(mrcImage* img, mrcImage* i1, mrcImage* i2);
593 extern void lmrcImagetMapForZero(mrcImage* t, mrcImage* avg, mrcImage* se);
594 extern void lmrcImageSN(mrcImage* sn, mrcImage* avg, mrcImage* sig);
595 extern void lmrcImageDevidedByReal(mrcImage* img, double d);
596 extern void lmrcImageDevidedByRealForOnlyPositive(mrcImage* img, double d);
597 extern void lmrcImageAddedByReal(mrcImage* img, double d);
598 extern void lmrcImageStdDev(mrcImage* sig, mrcImage* avg, mrcImage* avg2, long num);
599 extern void lmrcImageStdErr(mrcImage* sig, mrcImage* avg, mrcImage* avg2, long num);
600 extern void lmrcImageAdd(mrcImage* img2, mrcImage* img1, long* num);
601 extern void lmrcSQRImageAdd(mrcImage* img2, mrcImage* img1, long* num);
602 extern void lmrcImageSquare(mrcImage* in);
603 extern void lmrcImageRoot(mrcImage* in ,double eps);
604 extern void lmrcImageAbs(mrcImage* out, mrcImage* in);
605 extern void lmrcImageConvolution(mrcImage* out, mrcImage* in, mrcImage* kernel, int mode);
607 /* in mrcImageToIntImage.c */
608 extern void lmrcImageToIntImage(mrcImage* dst, mrcImage* src, mrcImageParaTypeInteger mode);
611 extern void lfft2d(mrcImage* fft, mrcImage* img);
613 extern void lmrcImageFFT(mrcImage* fft, mrcImage* img, long mode);
614 extern void lmrcImageFFTFirstDimensionOnly(mrcImage* fft, mrcImage* img, long mode);
616 extern void lmrcImageFFTWFlagSet(unsigned int flag);
618 extern void lmrcFFTFGconj(mrcImage* out, mrcImage* in1, mrcImage* in2);
619 extern void lmrcFFTFxG(mrcImage* out, mrcImage* in1, mrcImage* in2);
620 extern void lmrcImageCorrelation(mrcImage* out, mrcImage* in, mrcImage* ref, long mode);
621 extern void lmrcImageCorrelationModePrint(FILE* fpt);
624 extern void lmrcImageCorrelationWithCTFCompensation(mrcImage* out, mrcImage* in, ctfInfo* inctf, mrcImage* ref, ctfInfo* refctf, long mode);
628 extern mrcStatusType mrcError(char* message, char* inRtnName, char* callRtnName, mrcStatusType status);
629 extern mrcStatusType mrcErrorMsg(FILE* fpt, char* message, char* inRtnName, char* callRtnName, mrcStatusType status);
630 /* in lmrcFFTInfo.c */
632 extern floatVector* lmrcFSInfoXAxisMag(mrcImage* fft);
633 extern floatVector* lmrcFSInfoXAxisPhase(mrcImage* fft);
634 extern floatVector* lmrcFSInfoYAxisMag(mrcImage* fft);
635 extern floatVector* lmrcFSInfoYAxisPhase(mrcImage* fft);
636 /* The returned values are not magnitudes but powers */
637 extern floatVector* lmrcFSInfoScatteringAngularDistribution(mrcImage* fft);
638 extern floatVector* lmrcFSInfoScatteringAngularDistributionAverage(mrcImage* fft);
639 extern floatVector* lmrcFSInfoScatteringAngularDistributionSD(mrcImage* fft);
640 extern floatVector* lmrcFSInfoSpacing(mrcImage* fft);
642 /* in mrcImageCheckSameSize.c */
643 extern void lmrcImageCheckSameSize(mrcImage* in, mrcImage* ref);
645 /* in mrcImageCheckFFT.c */
646 extern void lmrcImageCheckFFT(mrcImage* in, mrcImage* ref);
648 /* in lmrcImageSmoothing */
649 extern void lmrcImageSmoothingModeInfo(FILE* fpt);
650 extern void lmrcImageSmoothing(mrcImage* dst, mrcImage* src, lmrcImageSmoothingInfo* info, long mode);
652 /* in lmrcImageCVE */
653 extern void lmrcImageCVE(mrcImage* dst, mrcImage* src, lmrcImageCVEInfo* info);
655 /* in lmrcImageTfunction */
656 extern void lmrcImageTfunction(mrcImage* dst, mrcImage* src, lmrcImageTfunctionInfo* info, long mode);
658 /* in lmrcImageHighlighting */
659 extern void lmrcImageHighlightingInfoPrint(FILE* fpt);
660 extern void lmrcImageHighlighting(mrcImage* dst, mrcImage* src, lmrcImageHighlightInfo* info);
662 /* in lmrcImageLowPassFilter */
663 extern void lmrcImageLowPassFilter(mrcImage* dst, mrcImage* src, lmrcImageLowPassFilterInfo* info, long mode);
665 /* in lmrcImageHighPassFilter */
666 extern void lmrcImageHighPassFilter(mrcImage* dst, mrcImage* src, lmrcImageHighPassFilterInfo* info, long mode);
668 /* in lmrcImageBandPassFilter */
669 extern void lmrcImageBandPassFilter(mrcImage* dst, mrcImage* src, lmrcImageBandPassFilterInfo* info, long mode);
671 /* in lmrcImageShrink */
672 extern void lmrcImageShrink(mrcImage* dst, mrcImage* src, mrcImageParaTypeIntegerCoord S, long mode);
674 /* in lmrcImageShift */
675 extern void lmrcImageShift(mrcImage* out, mrcImage* in, mrcImageParaTypeRealCoord shift, mrcPixelDataHowToGet mode);
676 extern void lmrcImageShiftFollowingGC(mrcImage* out, mrcImage* in, int mode);
678 /* in mrcImagePrint */
679 extern void mrcInfoPrint(FILE* fpt, mrcImage* mrc, mrcImageParaTypeInteger mode);
684 /* in lmrcImageMultiCTFCompensation.c */
687 typedef enum lmrcImageMultiCTFCompensationSolventFlatteningMode {
688 lmrcImageMultiCTFCompensationSolventFlatteningModeDensityPeakIsSolvent=0,
689 lmrcImageMultiCTFCompensationSolventFlatteningModeDefinedSTDIsSolvent=1
690 } lmrcImageMultiCTFCompensationSolventFlatteningMode;
692 typedef struct lmrcImageMultiCTFCompensationInfo {
699 lmrcImageMultiCTFCompensationSolventFlatteningMode solventMode;
701 } lmrcImageMultiCTFCompensationInfo;
706 /* prototype begin */
708 extern void lmrcImageMultiCTFCompensationInfoInit(lmrcImageMultiCTFCompensationInfo* info);
709 extern void lmrcImageMultiCTFCompensationInfoSet(lmrcImageMultiCTFCompensationInfo* info);
710 extern void lmrcImageMultiCTFCompensation(mrcImage* dst, mrcImage* src, ctfInfo* ctf, long nfile, lmrcImageMultiCTFCompensationInfo info, long mode);
712 /* in lmrcImageCTFObservation.c */
713 extern void lmrcImageCTFObservation(mrcImage* dst, mrcImage* src, ctfInfo* ctf, long mode);
714 extern void lmrcImagesCTFObservation(mrcImage* dst, mrcImage* src, ctfInfo* ctf, long mode);
716 /* in lmrcImageCTFCompensation.c */
717 extern void lmrcImageCTFCompensation(mrcImage* src, ctfInfo* ctf, long mode);
722 /* in lmrcImageCTFSN.c */
724 typedef struct lmrcImageCTFSNInfo
726 long mode, deg1, deg2;
728 } lmrcImageCTFSNInfo;
731 /* prototype begin */
732 extern void lmrcImageCTFSN(mrcImage *outMrc, const mrcImage *inMrc, lmrcImageCTFSNInfo *info, long mode);
735 /* in lmrcImageFourierPowerSpectrum.c */
737 typedef struct mrcImageFourierPowerSpectrum
741 } mrcImageFourierPowerSpectrum;
743 typedef struct lmrcImageFourierPowerSpectrumInfo
746 } lmrcImageFourierPowerSpectrumInfo;
749 /* prototype begin */
751 extern mrcImageFourierPowerSpectrum lmrcImageFourierPowerSpectrumMakeSpectrum(const mrcImage *inFFT, lmrcImageFourierPowerSpectrumInfo *info);
752 extern void lmrcImageFourierPowerSpectrumDeleteSpectrum(mrcImageFourierPowerSpectrum theSpectrum);
753 extern mrcImageFourierPowerSpectrum lmrcImageFourierPowerSpectrum(const mrcImage *inMrc, lmrcImageFourierPowerSpectrumInfo *info, long mode);
755 extern void lmrcImageRotation3DFollowingEulerAngle(mrcImage* dst, mrcImage* src, const char* m,
756 mrcImageParaTypeReal rot1, mrcImageParaTypeReal rot2, mrcImageParaTypeReal rot3, mrcPixelDataHowToGet mode, int mode2);
758 #include "Matrix3D.h"
759 extern void lmrcImageRotation3DFollowingMatrix3D(mrcImage* dst, mrcImage* src, Matrix3D mat, mrcPixelDataHowToGet mode, int mode2);
761 extern void lmrcImageRotation3DZXY(mrcImage* dst, mrcImage* src,
762 mrcImageParaTypeReal rotx, mrcImageParaTypeReal roty, mrcImageParaTypeReal rotz, mrcPixelDataHowToGet mode, int mode2);
764 extern void lmrcImageRotation2D(mrcImage* dst, mrcImage* src, double angle, mrcPixelDataHowToGet mode);
765 extern void lmrcImageRotation2DPeriodicBoundary(mrcImage* dst, mrcImage* src, double angle, mrcPixelDataHowToGet mode);
767 /* in mrcImageSectionGet.c */
768 extern char* mrcImageSectionGetModeDescription(long mode);
769 extern void mrcImageSectionGet(mrcImage* dst, mrcImage* src, mrcImageParaTypeReal z, long mode);
771 /* in mrcImageSectionSet.c */
772 extern void mrcImageSectionSet(mrcImage* dst, mrcImage* src, mrcImageParaTypeReal z, long mode);
775 extern double lmrcImageMaxDataGet(mrcImage* src, long mode);
783 #endif /* MRC_IMAGE_H */