1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
20 #include <QApplication>
22 #include <QSplashScreen>
24 #include <QDesktopWidget>
27 #include "vvMainWindow.h"
28 #include "vvConstants.h"
30 void load_image_first_error()
32 std::cerr << "You need to load an image before adding an overlay!" << std::endl;
36 //------------------------------------------------------------------------------
37 int main( int argc, char** argv )
41 QApplication app( argc, argv );
42 Q_INIT_RESOURCE(vvIcons);
43 //QPixmap pixmap(":/splashscreen.PNG");
44 QSplashScreen *splash = new QSplashScreen(QPixmap(QString::fromUtf8(":/new/prefix1/splashscreen.PNG")));
45 /*splash->showMessage("VV 1.0 developped by Léon Bérard c`ancer center http://oncora1.lyon.fnclcc.fr and CREATIS-LRMN http://www.creatis.insa-lyon.fr",(Qt::AlignRight | Qt::AlignBottom));*/
47 QTimer::singleShot(2000, splash, SLOT(close()));
48 while (!splash->isHidden())
53 //Try to give the window a sensible default size
54 int width=QApplication::desktop()->width()*0.8;
55 int height=QApplication::desktop()->height()*0.9;
56 if (width> 1.5*height)
58 window.resize(width,height);
62 std::vector<std::string> sequence_filenames;
63 enum {P_NORMAL,P_SEQUENCE};
64 int parse_mode=P_NORMAL;
68 for (int i = 1; i < argc; i++) {
69 std::string current = argv[i];
70 if (!current.compare(0,2,"--")) { //We are parsing an option
71 if (parse_mode == P_SEQUENCE) {//First finish the current sequence
72 window.LoadImages(sequence_filenames,MERGEDWITHTIME);
73 sequence_filenames.clear();
76 if (current=="--vf") {
77 if (!n_image_loaded) load_image_first_error();
78 window.AddField(argv[i+1],n_image_loaded-1);
81 else if (current=="--overlay") {
82 if (!n_image_loaded) load_image_first_error();
83 window.AddOverlayImage(n_image_loaded-1,argv[i+1]);
84 i++; //skip overlay name
86 else if (current=="--roi") {
87 if (!n_image_loaded) load_image_first_error();
88 window.AddROI(n_image_loaded-1,argv[i+1]);
91 else if (current=="--fusion") {
92 if (!n_image_loaded) load_image_first_error();
93 window.AddFusionImage(n_image_loaded-1,argv[i+1]);
94 i++; //skip fusion name
96 else if (current == "--sequence") {
97 n_image_loaded++; //count only one for the sequence
98 parse_mode=P_SEQUENCE; }
100 else if (parse_mode == P_SEQUENCE)
101 sequence_filenames.push_back(current);
104 std::vector<std::string> image; image.push_back(current);
105 window.LoadImages(image,IMAGE);
109 if (parse_mode == P_SEQUENCE) {//Finish any current sequence
110 window.LoadImages(sequence_filenames,MERGEDWITHTIME);
111 sequence_filenames.clear();