xsmmath.h

Go to the documentation of this file.
00001 /* Gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  * 
00005  * Copyright (C) 1999,2000,2001,2002,2003 Percy Zahl
00006  *
00007  * Authors: Percy Zahl <zahl@users.sf.net>
00008  * additional features: Andreas Klust <klust@users.sf.net>
00009  * WWW Home: http://gxsm.sf.net
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00024  */
00025 
00026 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
00027 
00028 #ifndef XSMMATH__H
00029 #define XSMMATH__H
00030 
00031 #include <config.h>
00032 
00033 # include <complex>
00034 # include <fftw3.h>
00035 #define c_re(c) ((c)[0])
00036 #define c_im(c) ((c)[1])
00037 
00038 
00039 /* Math Errors */
00040 
00041 #define MATH_OK           0
00042 #define MATH_SIZEERR      1
00043 #define MATH_SELECTIONERR 2
00044 #define MATH_DIVZERO      3
00045 #define MATH_UNDEFINED    4
00046 #define MATH_NOMEM        5
00047 #define MATH_FILE_ERROR   6
00048 #define MATH_LIB_ERR      7
00049 
00050 extern char *MathErrString[];
00051 
00052 /* für alle Math Funktionen diese Argumente !! */
00053 #define MATHOPPARAMSNODEST  Scan *Src
00054 #define MATHOPVARSNODEST    Src
00055 
00056 #define MATHOPPARAMS        Scan *Src, Scan *Dest
00057 #define MATHOPVARS          Src, Dest
00058 
00059 #define MATH2OPPARAMS       Scan *Src1, Scan *Src2, Scan *Dest
00060 #define MATH2OPVARS         Src1, Src2, Dest
00061 
00062 
00063 #include "scan.h"
00064 
00065 // used to set progressbar of main window (P: 0..1)
00066 #define SET_PROGRESS(P) { gapp->SetProgress((gfloat)(P)); while (gtk_events_pending()) gtk_main_iteration(); }
00067 
00068 #define SHTRANGE   32765
00069 #define ZEROVALUE  0.
00070 
00071 typedef struct {
00072   int xLeft, xRight;
00073   int yBottom, yTop;
00074   int xSize, ySize;
00075   double xRatio, yRatio;
00076   double Aspect;
00077   double Area;
00078   double Radius2;            // circle r^2
00079   double xCenter, yCenter;   // and middle point coords.
00080 } MOUSERECT;
00081 
00082 extern void MkMausSelect(Point2D *List, MOUSERECT *msel, int mx, int my);
00083 gboolean F2D_ift_ft(MATH2OPPARAMS, gboolean (*spkfkt)(MATH2OPPARAMS, fftw_complex *dat));
00084 
00085 
00086 /* Edit/Cut/Crop */
00087 extern gboolean CopyScan(MATHOPPARAMS);
00088 extern gboolean CropScan(MATHOPPARAMS);
00089 extern gboolean ZoomInScan(MATHOPPARAMS);
00090 extern gboolean ZoomOutScan(MATHOPPARAMS);
00091 
00092 /* Background */
00093 extern gboolean BgLin1DScan(MATHOPPARAMS);
00094 extern gboolean BgParabolRegress(MATHOPPARAMS);
00095 extern gboolean BgERegress(MATHOPPARAMS);
00096 
00097 /* Filter 1D */
00098 extern gboolean F1D_Despike(MATHOPPARAMS);
00099 extern gboolean F1D_LogPowerSpec(MATHOPPARAMS);
00100 extern gboolean F1D_FT_Window(MATH2OPPARAMS);
00101 extern gboolean F1D_FT_GaussStop(MATH2OPPARAMS);
00102 extern gboolean F1D_FT_GaussPass(MATH2OPPARAMS);
00103 
00104 
00105 /* Filter 2D */
00106 extern gboolean F2D_Despike(MATHOPPARAMS);
00107 extern gboolean F2D_RemoveRect(MATHOPPARAMS);
00108 extern gboolean F2D_LineShifts(MATHOPPARAMS);
00109 extern gboolean F2D_LineInterpol(MATHOPPARAMS);
00110 extern gboolean F2D_LogPowerSpec(MATHOPPARAMS);
00111 extern gboolean F2D_AutoCorr(MATHOPPARAMS);
00112 extern gboolean F2D_iftXft(MATH2OPPARAMS);
00113 extern gboolean F2D_FT_GaussStop(MATH2OPPARAMS);
00114 extern gboolean F2D_FT_GaussPass(MATH2OPPARAMS);
00115 
00116 /* Transformations */
00117 extern gboolean TR_QuenchScan(MATHOPPARAMS); /* needed by core, has to remain here! */
00118 
00119 gboolean SpkWindow(MATH2OPPARAMS, fftw_complex*);
00120 gboolean SpkGaussStop(MATH2OPPARAMS, fftw_complex*);
00121 gboolean SpkGaussPass(MATH2OPPARAMS, fftw_complex*);
00122 gboolean SpkAutoCorr(MATH2OPPARAMS, fftw_complex*);
00123 
00124 /* Statistics */
00125 // all Plugins now...
00126 
00127 
00128 // Macro for fft quadrant swap
00129 #define QSWP(X,N) ((X) >= ((N)/2) ? ((X)-(N)/2) : ((X)+(N)/2))
00130 
00131 // virtual base class for filters with special parameters
00132 class Filter
00133 {
00134 public:
00135         virtual ~Filter() {};
00136 
00137         virtual void hide() {};
00138         virtual void draw() {};
00139         
00140         virtual gboolean exec(MATHOPPARAMS) {return MATH_OK;};
00141 };
00142 
00143 #endif

Generated on Sat Apr 1 09:04:09 2006 for GXSM by  doxygen 1.4.6