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,P_WINDOW,P_LEVEL};
64 int parse_mode=P_NORMAL;
66 std::string win(""), lev("");
69 for (int i = 1; i < argc; i++) {
70 std::string current = argv[i];
71 if (!current.compare(0,2,"--")) { //We are parsing an option
72 if (parse_mode == P_SEQUENCE) {//First finish the current sequence
73 window.LoadImages(sequence_filenames,MERGEDWITHTIME);
74 sequence_filenames.clear();
77 if (current=="--vf") {
78 if (!n_image_loaded) load_image_first_error();
79 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
85 } else if (current=="--roi") {
86 if (!n_image_loaded) load_image_first_error();
87 window.AddROI(n_image_loaded-1,argv[i+1]);
89 } else if (current=="--fusion") {
90 if (!n_image_loaded) load_image_first_error();
91 window.AddFusionImage(n_image_loaded-1,argv[i+1]);
92 i++; //skip fusion name
93 } else if (current == "--sequence") {
94 n_image_loaded++; //count only one for the sequence
95 parse_mode=P_SEQUENCE;
96 } else if (current == "--window") {
98 } else if (current == "--level") {
101 } else if (parse_mode == P_SEQUENCE) {
102 sequence_filenames.push_back(current);
103 } else if (parse_mode == P_WINDOW) {
106 } else if (parse_mode == P_LEVEL) {
110 std::vector<std::string> image;
111 image.push_back(current);
112 window.LoadImages(image,IMAGE);
116 if (parse_mode == P_SEQUENCE) { //Finish any current sequence
117 window.LoadImages(sequence_filenames,MERGEDWITHTIME);
118 sequence_filenames.clear();
123 if(win!="" && lev!="") {
124 window.WindowLevelChanged(atof(win.c_str()), atof(lev.c_str()), 6, 0);
125 window.ApplyWindowLevelToAllImages();