psdadd.C

Go to the documentation of this file.
00001 /* Gnome gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  * 
00005  * Gxsm Plugin Name: dummy.C
00006  * ========================================
00007  * 
00008  * Copyright (C) 1999 The Free Software Foundation
00009  *
00010  * Authors: Percy Zahl <zahl@fkp.uni-hannover.de>
00011  * additional features: Andreas Klust <klust@fkp.uni-hannover.de>
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00026  */
00027 /* Please do not change the Begin/End lines of this comment section!
00028  * this is a LaTeX style section used for auto generation of the PlugIn Manual 
00029  * Chapter. Add a complete PlugIn documentation inbetween the Begin/End marks!
00030  * All "% PlugInXXX" commentary tags are mandatory
00031  * All "% OptPlugInXXX" tags are optional
00032  * --------------------------------------------------------------------------------
00033 % BeginPlugInDocuSection
00034 % PlugInDocuCaption: PSD add -- SARLS
00035 % PlugInName: psdadd
00036 % PlugInAuthor: Martin Langer, PZ
00037 % PlugInAuthorEmail: stefan_fkp@users.sf.net
00038 % PlugInMenuPath: Math/Misc/PSD Add
00039 
00040 % PlugInDescription
00041 Experimental filter for adding PSD-slope-signals.
00042 
00043 % PlugInUsage
00044 It is only available form \GxsmMenu{Math/Misc/PSD Add} if the
00045 instrument type is set to SARLS or a reload of all PlugIns is forced.
00046 
00047 % OptPlugInSources
00048 The active and X channel is used as data sources.
00049 
00050 %% OptPlugInObjects
00051 %A optional rectangle is used for data extraction...
00052 
00053 %% OptPlugInDest
00054 %The computation result is placed into an existing math channel, else
00055 %into a new created math channel.
00056 
00057 %% OptPlugInRefs
00058 %Any references?
00059 
00060 %% OptPlugInKnownBugs
00061 %Are there known bugs? List! How to work around if not fixed?
00062 
00063 % OptPlugInNotes
00064 I would appreciate if one of the current SARLS group members could
00065 figure out more about this piece of code.
00066 
00067 %% OptPlugInHints
00068 %Any tips and tricks?
00069 
00070 % EndPlugInDocuSection
00071  * -------------------------------------------------------------------------------- 
00072  */
00073 
00074 #include <gtk/gtk.h>
00075 #include "config.h"
00076 #include "gxsm/plugin.h"
00077 
00078 static void psdadd_init( void );
00079 static void psdadd_about( void );
00080 static void psdadd_configure( void );
00081 static void psdadd_cleanup( void );
00082 static gboolean psdadd_run( Scan *Src1, Scan *Src2, Scan *Dest );
00083 
00084 GxsmPlugin psdadd_pi = {
00085   NULL,
00086   NULL,
00087   0,
00088   NULL,
00089   "PsdAdd-M2S-Misc",
00090   "+SARLS",
00091   NULL,
00092   "Martin Langer, PZ",
00093   N_("_Math/_Misc/"),
00094   N_("PSD Add"),
00095   N_("Sorry, no help for psdadd filter!"),
00096   "no more info",
00097   NULL,
00098   NULL,
00099   psdadd_init,
00100   NULL,
00101   psdadd_about,
00102   psdadd_configure,
00103   NULL,
00104   psdadd_cleanup
00105 };
00106 
00107 GxsmMathTwoSrcPlugin psdadd_m2s_pi = {
00108   psdadd_run
00109 };
00110 
00111 static const char *about_text = N_("Gxsm Psdadd Plugin\n\n"
00112                                    "PSD Add.");
00113 
00114 GxsmPlugin *get_gxsm_plugin_info ( void ){ 
00115   psdadd_pi.description = g_strdup_printf(N_("Gxsm MathTwoArg psdadd plugin %s"), VERSION);
00116   return &psdadd_pi; 
00117 }
00118 
00119 GxsmMathTwoSrcPlugin *get_gxsm_math_two_src_plugin_info( void ) { 
00120   return &psdadd_m2s_pi; 
00121 }
00122 
00123 static void psdadd_init(void)
00124 {
00125   PI_DEBUG (DBG_L2, "Psdadd Plugin Init");
00126 }
00127 
00128 static void psdadd_about(void)
00129 {
00130   const gchar *authors[] = { psdadd_pi.authors, NULL};
00131   gtk_widget_show(gnome_about_new ( psdadd_pi.name,
00132                                     VERSION,
00133                                     N_("(C) 2000 the Free Software Foundation"),
00134                                     about_text,
00135                                     authors,
00136                                     NULL, NULL, NULL
00137                                     ));
00138 }
00139 
00140 static void psdadd_configure(void)
00141 {
00142   if(psdadd_pi.app)
00143     psdadd_pi.app->message("Psdadd Plugin Configuration");
00144 }
00145 
00146 static void psdadd_cleanup(void)
00147 {
00148   PI_DEBUG (DBG_L2, "Psdadd Plugin Cleanup");
00149 }
00150 
00151 static gboolean psdadd_run(Scan *Src1, Scan *Src2, Scan *Dest)
00152 {
00153 // Dest = Src1 (X) Src2
00154 // Experimentierfilter
00155   int line, col;
00156   long int LengthX, LengthY; 
00157   double ScaleFactorX, ScaleFactorY;
00158   PI_DEBUG (DBG_L2, "Experimental Filter -- PSD ADD");
00159 
00160   if(Src1->data.s.nx != Src2->data.s.nx || Src1->data.s.ny != Src2->data.s.ny)
00161     return MATH_SIZEERR;
00162 
00163 /*      Funktion zum Addieren von PSD-Bildern mit Neigungsinformationen                             */
00164 /*      LengthX, ..Y    : Abstand zwischen 2 Datenpunkten (in 1/100 Angstroem)                      */
00165 /*      ScaleFactorX,..Y: Skalierungsparameter 1Grad=1Count/ScaleFactor                             */
00166 
00167   LengthX=125000;
00168   LengthY=125000;
00169   ScaleFactorX=845112.7;
00170   ScaleFactorY=13636339.5;
00171 
00172   for(line=0; line<Dest->data.s.ny; line++)
00173     for(col=0; col<Dest->data.s.nx; col++)
00174       if (line==0)  
00175         if (col==0)     
00176           Dest->mem2d->PutDataPkt(0,col, line);
00177         else 
00178           Dest->mem2d->PutDataPkt( (LengthX*tan((double)
00179                                                 (Src1->mem2d->GetDataPkt(col-1,line))/ScaleFactorX)
00180                                     + (Dest->mem2d->GetDataPkt(col-1,line))), col, line);
00181       else
00182         if (col==0)
00183           Dest->mem2d->PutDataPkt( (LengthY*tan((double)
00184                                                 (Src2->mem2d->GetDataPkt(col,line-1))/ScaleFactorY)
00185                                     + (Dest->mem2d->GetDataPkt(col,line-1))), col, line);
00186         else
00187 /*        die Routine für Mittelung aus x und y-Daten -> Diagonal-Verzerrung          
00188           Dest->mem2d->PutDataPkt((SHT) ((LengthX*tan((double)
00189                                         (Src1->mem2d->GetDataPkt(col-1, line))/ScaleFactorX)
00190                                        + LengthY*tan((double)
00191                                         (Src2->mem2d->GetDataPkt(col, line-1))/ScaleFactorY)
00192                                        + (Dest->mem2d->GetDataPkt(col-1,line)
00193                                        + (Dest->mem2d->GetDataPkt(col,line-1))))/2), col, line);  */
00194           Dest->mem2d->PutDataPkt( (LengthX*tan((double)
00195                                                 (Src1->mem2d->GetDataPkt(col-1, line))/ScaleFactorX)
00196                                     + (Dest->mem2d->GetDataPkt(col-1,line))), col, line);
00197   return MATH_OK;
00198 }

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