1 /*=========================================================================
5 Author : Pierre Seroul (pierre.seroul@gmail.com)
8 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
9 CREATIS-LRMN http://www.creatis.insa-lyon.fr
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, version 3 of the License.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 =========================================================================*/
27 #include <QApplication>
29 #include <QSplashScreen>
31 #include <QDesktopWidget>
34 #include "vvMainWindow.h"
35 #include "vvConstants.h"
37 //------------------------------------------------------------------------------
38 int main( int argc, char** argv )
41 HWND hWnd = GetConsoleWindow();
42 ShowWindow( hWnd, SW_HIDE );
47 QApplication app( argc, argv );
48 Q_INIT_RESOURCE(vvIcons);
49 //QPixmap pixmap(":/splashscreen.PNG");
50 QSplashScreen *splash = new QSplashScreen(QPixmap(QString::fromUtf8(":/new/prefix1/splashscreen.PNG")));
51 /*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));*/
53 QTimer::singleShot(2000, splash, SLOT(close()));
54 while (!splash->isHidden())
59 //Try to give the window a sensible default size
60 int width=QApplication::desktop()->width()*0.8;
61 int height=QApplication::desktop()->height()*0.9;
62 if (width> 1.5*height)
64 window.resize(width,height);
68 std::vector<std::string> filenames;
69 std::vector<std::pair<int ,std::string> > overlays;
70 std::vector<std::pair<int ,std::string> > vector_fields;
73 for (int i = 1; i < argc; i++)
75 std::string temp = argv[i];
78 assert(filenames.size()>=1);
79 vector_fields.push_back(std::make_pair(filenames.size()-1,argv[i+1]));
82 else if (temp=="--overlay")
84 assert(filenames.size()>=1);
85 overlays.push_back(std::make_pair(filenames.size()-1,argv[i+1]));
86 i++; //skip overlay name
89 filenames.push_back(temp);
91 window.LoadImages(filenames,IMAGE);
92 for (std::vector<std::pair<int ,std::string> >::iterator i=overlays.begin();
93 i!=overlays.end();i++)
94 window.AddOverlayImage((*i).first,(*i).second.c_str());
95 for (std::vector<std::pair<int ,std::string> >::iterator i=vector_fields.begin();
96 i!=vector_fields.end();i++)
97 window.AddField((*i).second.c_str(), (*i).first);