GRALESHELL

cmdimagesdata.h

00001 /*
00002 
00003   This file is a part of GRALESHELL, a program to facilitate the simulation
00004   and inversion of gravitational lenses, based on the GRALE library.
00005 
00006   Copyright (C) 2008-2012 Jori Liesenborgs
00007 
00008   Contact: jori.liesenborgs@gmail.com
00009   
00010   This program is free software; you can redistribute it and/or modify
00011   it under the terms of the GNU General Public License as published by
00012   the Free Software Foundation; either version 2 of the License, or
00013   (at your option) any later version.
00014   
00015   This program is distributed in the hope that it will be useful,
00016   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018   GNU General Public License for more details.
00019   
00020   You should have received a copy of the GNU General Public License
00021   along with this program; if not, write to the Free Software
00022   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023   
00024 */
00025 
00026 #ifndef CMDIMAGESDATA_H
00027 
00028 #define CMDIMAGESDATA_H
00029 
00030 #include <shellp/shellcommand.h>
00031 #include <shellp/shellcmdstringarg.h>
00032 #include <shellp/shellcmdrealarg.h>
00033 #include <shellp/shellcmdboolarg.h>
00034 #include <shellp/shellcmdintarg.h>
00035 #include <grale/triangle2d.h>
00036 #include <list>
00037 
00038 class CmdImagesDataLoadSave : public shellp::ShellCommand
00039 {
00040 public:
00041         CmdImagesDataLoadSave(const std::string &cmdname);
00042         ~CmdImagesDataLoadSave();
00043 protected:
00044         std::string GetFileName() const                                         { return fnamearg->getValue(); }
00045 private:
00046         shellp::ShellCmdStringArg *fnamearg;
00047 };
00048 
00049 class CmdImagesDataLoad : public CmdImagesDataLoadSave
00050 {
00051 public:
00052         CmdImagesDataLoad(const std::string &cmdname);
00053         ~CmdImagesDataLoad();
00054         bool execute();
00055 };
00056 
00057 class CmdImagesDataSave : public CmdImagesDataLoadSave
00058 {
00059 public:
00060         CmdImagesDataSave(const std::string &cmdname);
00061         ~CmdImagesDataSave();
00062         bool execute();
00063 };
00064 
00065 class CmdImagesDataTriangulationCreate : public shellp::ShellCommand
00066 {
00067 public:
00068         CmdImagesDataTriangulationCreate(const std::string &cmdname);
00069         ~CmdImagesDataTriangulationCreate();
00070         bool execute();
00071 };
00072 
00073 class CmdImagesDataTriangulationClear : public shellp::ShellCommand
00074 {
00075 public:
00076         CmdImagesDataTriangulationClear(const std::string &cmdname);
00077         ~CmdImagesDataTriangulationClear();
00078         bool execute();
00079 };
00080 
00081 class CmdImagesDataImport : public shellp::ShellCommand
00082 {
00083 protected:
00084         CmdImagesDataImport(const std::string &cmdname);
00085 public:
00086         ~CmdImagesDataImport();
00087 protected:
00088         std::string GetFileName() const                                 { return fnamearg->getValue(); }
00089         std::string GetMaskFileName() const                             { if (masknamearg->getValue() == std::string("*")) return std::string(""); return masknamearg->getValue(); }
00090         double GetX1() const                                            { return x1arg->getValue(); }
00091         double GetY1() const                                            { return y1arg->getValue(); }
00092         double GetX2() const                                            { return x2arg->getValue(); }
00093         double GetY2() const                                            { return y2arg->getValue(); }
00094         bool UseNullSpace() const                                       { return nullarg->getValue(); }
00095         bool getTriangulationFlag() const                               { return m_pTriangArg->getValue(); }
00096 private:
00097         shellp::ShellCmdStringArg *fnamearg;
00098         shellp::ShellCmdStringArg *masknamearg;
00099         shellp::ShellCmdRealArg *x1arg,*y1arg,*x2arg,*y2arg;
00100         shellp::ShellCmdBoolArg *nullarg;
00101         shellp::ShellCmdBoolArg *m_pTriangArg;
00102 };
00103 
00104 class CmdImagesDataImportPNG : public CmdImagesDataImport
00105 {
00106 public:
00107         CmdImagesDataImportPNG(const std::string &cmdname);
00108         ~CmdImagesDataImportPNG();
00109         bool execute();
00110 };
00111 
00112 class CmdImagesDataImportFITS : public CmdImagesDataImport
00113 {
00114 public:
00115         CmdImagesDataImportFITS(const std::string &cmdname);
00116         ~CmdImagesDataImportFITS();
00117         bool execute();
00118 };
00119 
00120 class CmdImagesDataImportFITSAuto : public shellp::ShellCommand
00121 {
00122 public:
00123         CmdImagesDataImportFITSAuto(const std::string &cmdname);
00124         ~CmdImagesDataImportFITSAuto();
00125         bool execute();
00126 private:
00127         shellp::ShellCmdStringArg *fnamearg;
00128         shellp::ShellCmdStringArg *masknamearg;
00129         shellp::ShellCmdRealArg *unitmultarg;
00130         shellp::ShellCmdStringArg *unitbasearg;
00131         shellp::ShellCmdBoolArg *nullarg;
00132         shellp::ShellCmdBoolArg *m_pTriangArg;
00133 };
00134 
00135 class CmdImagesDataImportFITSWCS : public shellp::ShellCommand
00136 {
00137 public:
00138         CmdImagesDataImportFITSWCS(const std::string &cmdname);
00139         ~CmdImagesDataImportFITSWCS();
00140         bool execute();
00141 private:
00142         shellp::ShellCmdStringArg *fnamearg;
00143         shellp::ShellCmdStringArg *masknamearg;
00144         shellp::ShellCmdBoolArg *nullarg;
00145         shellp::ShellCmdBoolArg *m_pTriangArg;
00146 };
00147 
00148 class CmdImagesDataSourceImage : public shellp::ShellCommand
00149 {
00150 public:
00151         CmdImagesDataSourceImage(const std::string &cmdName);
00152         ~CmdImagesDataSourceImage();
00153         bool execute();
00154 private:
00155         shellp::ShellCmdIntArg *m_pImageNumberArg;
00156         shellp::ShellCmdRealArg *m_pDsArg;
00157         shellp::ShellCmdRealArg *m_pDdsArg;
00158         shellp::ShellCmdStringArg *m_pFileArg;
00159         shellp::ShellCmdIntArg *m_pNumXArg;
00160         shellp::ShellCmdIntArg *m_pNumYArg;
00161         shellp::ShellCmdBoolArg *m_pFastArg;
00162         shellp::ShellCmdIntArg *m_pResampleArg;
00163         shellp::ShellCmdBoolArg *m_pUseMagnifications;
00164 };
00165 
00166 class CmdImagesDataListAdd : public shellp::ShellCommand
00167 {
00168 public:
00169         CmdImagesDataListAdd(const std::string &cmdname);
00170         ~CmdImagesDataListAdd();
00171         bool execute();
00172 private:
00173         shellp::ShellCmdRealArg *Dsarg;
00174         shellp::ShellCmdRealArg *Ddsarg;
00175         shellp::ShellCmdBoolArg *extraarg;
00176         shellp::ShellCmdStringArg *fnamearg;
00177         shellp::ShellCmdRealArg *valarg;
00178         std::vector<shellp::ShellCmdArg *> imgargs;
00179 };
00180 
00181 class CmdImagesDataListClear : public shellp::ShellCommand
00182 {
00183 public:
00184         CmdImagesDataListClear(const std::string &cmdname);
00185         ~CmdImagesDataListClear();
00186         bool execute();
00187 };
00188 
00189 class CmdImagesDataBackProjectAll : public shellp::ShellCommand
00190 {
00191 public:
00192         CmdImagesDataBackProjectAll(const std::string &cmdname);
00193         ~CmdImagesDataBackProjectAll();
00194         bool execute();
00195 private:
00196         shellp::ShellCmdStringArg *fnamearg;
00197 };
00198 
00199 class CmdImagesDataSelect : public shellp::ShellCommand
00200 {
00201 public:
00202         CmdImagesDataSelect(const std::string &cmdname);
00203         ~CmdImagesDataSelect();
00204         bool execute();
00205 private:
00206         shellp::ShellCmdIntArg *numarg;
00207 };
00208 
00209 class CmdImagesDataFitness : public shellp::ShellCommand
00210 {
00211 public:
00212         CmdImagesDataFitness(const std::string &cmdname);
00213         ~CmdImagesDataFitness();
00214         bool execute();
00215 private:
00216         shellp::ShellCmdStringArg *fnamearg;
00217         shellp::ShellCmdRealArg *m_pZArg;
00218 };
00219 
00220 class CmdImagesDataRegularBase : public shellp::ShellCommand
00221 {
00222 public:
00223         CmdImagesDataRegularBase(const std::string &cmdname);
00224         ~CmdImagesDataRegularBase();
00225 protected:
00226         bool getAvoidTriangles(std::list<grale::Triangle2D<double> > &triangles);
00227 
00228         shellp::ShellCmdRealArg *x1arg;
00229         shellp::ShellCmdRealArg *y1arg;
00230         shellp::ShellCmdRealArg *x2arg;
00231         shellp::ShellCmdRealArg *y2arg;
00232         shellp::ShellCmdIntArg *numxarg;
00233         shellp::ShellCmdIntArg *numyarg;
00234         shellp::ShellCmdBoolArg *m_pNeedTriangArg;
00235         shellp::ShellCmdBoolArg *m_pTriangulateArg;
00236 };
00237 
00238 class CmdImagesDataNewRegular : public CmdImagesDataRegularBase
00239 {
00240 public:
00241         CmdImagesDataNewRegular(const std::string &cmdname);
00242         ~CmdImagesDataNewRegular();
00243         bool execute();
00244 private:
00245         shellp::ShellCmdBoolArg *m_pIntensFlagArg;
00246         shellp::ShellCmdBoolArg *m_pCutArg;
00247         shellp::ShellCmdBoolArg *m_pMinDistArg;
00248 };
00249 
00250 class CmdImagesDataAddRegular : public CmdImagesDataRegularBase
00251 {
00252 public:
00253         CmdImagesDataAddRegular(const std::string &cmdname);
00254         ~CmdImagesDataAddRegular();
00255         bool execute();
00256 };
00257 
00258 class CmdImagesDataSubtractPosition : public shellp::ShellCommand
00259 {
00260 public:
00261         CmdImagesDataSubtractPosition(const std::string &cmdname);
00262         ~CmdImagesDataSubtractPosition();
00263         bool execute();
00264 private:
00265         shellp::ShellCmdRealArg *xarg;
00266         shellp::ShellCmdRealArg *yarg;
00267 };
00268 
00269 class CmdImagesDataSubtractIntensity : public shellp::ShellCommand
00270 {
00271 public:
00272         CmdImagesDataSubtractIntensity(const std::string &cmdname);
00273         ~CmdImagesDataSubtractIntensity();
00274         bool execute();
00275 private:
00276         shellp::ShellCmdRealArg *varg;
00277 };
00278 
00279 class CmdImagesDataNonDominatedSet : public shellp::ShellCommand
00280 {
00281 public:
00282         CmdImagesDataNonDominatedSet(const std::string &cmdname);
00283         ~CmdImagesDataNonDominatedSet();
00284         bool execute();
00285 private:
00286         class FitnessValues
00287         {
00288         public:
00289                 FitnessValues(int n,const std::string f);
00290                 ~FitnessValues();
00291                 float *GetValues()                                                                      { return values; }
00292                 std::string GetFilename() const                                                         { return fname; }
00293         private:
00294                 float *values;
00295                 std::string fname;
00296         };
00297 
00298         shellp::ShellCmdStringArg *fnamearg;
00299         shellp::ShellCmdRealArg *m_pZArg;
00300         std::vector<shellp::ShellCmdArg *> fileargs;
00301         shellp::ShellCmdStringArg *fnamearg2;
00302 };
00303 
00304 class CmdImagesDataNewPoints : public shellp::ShellCommand
00305 {
00306 public:
00307         CmdImagesDataNewPoints(const std::string &cmdName);
00308         ~CmdImagesDataNewPoints();
00309         bool execute();
00310 private:
00311         shellp::ShellCmdStringArg *m_pFileArg;
00312         std::vector<shellp::ShellCmdArg *> m_coordArgs;
00313         shellp::ShellCmdRealArg *m_pXArg;
00314         shellp::ShellCmdRealArg *m_pYArg;
00315 };
00316 
00317 class CmdImagesDataNew : public shellp::ShellCommand
00318 {
00319 public:
00320         CmdImagesDataNew(const std::string &cmdName);
00321         ~CmdImagesDataNew();
00322         bool execute();
00323 private:
00324         shellp::ShellCmdIntArg *m_pNumImagesArg;
00325         shellp::ShellCmdBoolArg *m_pIntensFlagArg;
00326         shellp::ShellCmdBoolArg *m_pShearFlagArg;
00327 };
00328 
00329 class CmdImagesDataAddPoints : public shellp::ShellCommand
00330 {
00331 public:
00332         CmdImagesDataAddPoints(const std::string &cmdName);
00333         ~CmdImagesDataAddPoints();
00334         bool execute();
00335 private:
00336         shellp::ShellCmdIntArg *m_pImageNumberArg;
00337         shellp::ShellCmdStringArg *m_pFileArg;
00338         std::vector<shellp::ShellCmdArg *> m_pointInfoArgs;
00339         shellp::ShellCmdRealArg *m_pXArg;
00340         shellp::ShellCmdRealArg *m_pYArg;
00341         shellp::ShellCmdRealArg *m_pIntensArg;
00342         shellp::ShellCmdRealArg *m_pShearAngle;
00343         shellp::ShellCmdRealArg *m_pShearSize;
00344 };
00345 
00346 class CmdImagesDataAddShearInfo : public shellp::ShellCommand
00347 {
00348 public:
00349         CmdImagesDataAddShearInfo(const std::string &cmdName);
00350         ~CmdImagesDataAddShearInfo();
00351         bool execute();
00352 private:
00353         shellp::ShellCmdBoolArg *m_pReducedArg;
00354 };
00355 
00356 #endif // CMDIMAGESDATA_H
00357