1 /*=========================================================================
4 Module: $RCSfile: vv.cxx,v $
6 Date: $Date: 2010/01/06 13:31:57 $
7 Version: $Revision: 1.1 $
8 Author : Pierre Seroul (pierre.seroul@gmail.com)
11 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
12 CREATIS-LRMN http://www.creatis.insa-lyon.fr
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, version 3 of the License.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 =========================================================================*/
29 #include <QApplication>
31 #include <QSplashScreen>
33 #include <QDesktopWidget>
35 #include "clitkCommon.h"
36 #include "vvMainWindow.h"
39 #include "vvConstants.h"
41 int main( int argc, char** argv )
45 QApplication app( argc, argv );
46 Q_INIT_RESOURCE(vvIcons);
47 //QPixmap pixmap(":/splashscreen.PNG");
48 QSplashScreen *splash = new QSplashScreen(QPixmap(QString::fromUtf8(":/new/prefix1/splashscreen.PNG")));
49 /*splash->showMessage("VV 1.0 developped by Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr and CREATIS-LRMN http://www.creatis.insa-lyon.fr",(Qt::AlignRight | Qt::AlignBottom));*/
51 QTimer::singleShot(2000, splash, SLOT(close()));
52 while (!splash->isHidden())
57 //Try to give the window a sensible default size
58 int width=QApplication::desktop()->width()*0.8;
59 int height=QApplication::desktop()->height()*0.9;
60 if (width> 1.5*height)
62 window.resize(width,height);
66 std::vector<std::string> filenames;
67 std::vector<std::pair<int ,std::string> > overlays;
68 std::vector<std::pair<int ,std::string> > vector_fields;
71 for (int i = 1; i < argc; i++)
73 std::string temp = argv[i];
76 assert(filenames.size()>=1);
77 vector_fields.push_back(std::make_pair(filenames.size()-1,argv[i+1]));
80 else if (temp=="--overlay")
82 assert(filenames.size()>=1);
83 overlays.push_back(std::make_pair(filenames.size()-1,argv[i+1]));
84 i++; //skip overlay name
87 filenames.push_back(temp);
89 window.LoadImages(filenames,IMAGE);
90 for (std::vector<std::pair<int ,std::string> >::iterator i=overlays.begin();
91 i!=overlays.end();i++)
92 window.AddOverlayImage((*i).first,(*i).second.c_str());
93 for (std::vector<std::pair<int ,std::string> >::iterator i=vector_fields.begin();
94 i!=vector_fields.end();i++)
95 window.AddField((*i).second.c_str(), (*i).first);