]> Creatis software - clitk.git/blob - vv/vvQProgressDialogITKCommand.cxx
Debug RTStruct conversion with empty struc
[clitk.git] / vv / vvQProgressDialogITKCommand.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
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.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef VVQPROGRESSDIALOGITKCOMMAND_CXX
19 #define VVQPROGRESSDIALOGITKCOMMAND_CXX
20 #include "clitkImageCommon.h"
21 #include "clitkPortability.h"
22 #include "vvQProgressDialogITKCommand.h"
23
24 //====================================================================
25 vvQProgressDialogITKCommand::vvQProgressDialogITKCommand()
26 {
27   progress.setWindowModality(Qt::WindowModal);
28   progress.setCancelButtonText("Cancel");
29 }
30 //====================================================================
31
32 //====================================================================
33 void vvQProgressDialogITKCommand::Initialize(QString title, float sec, int max)
34 {
35   progress.setMinimumDuration((int)lrint(1000.0*sec)); // number of seconds to wait before displaying dialog
36   progress.setLabelText(title);
37   i=0;
38   progress.setMaximum(max);
39 }
40 //====================================================================
41
42 //====================================================================
43 void vvQProgressDialogITKCommand::Execute(itk::Object *caller, const itk::EventObject & event)
44 {
45   i++;
46   progress.setValue(i);
47   if (progress.wasCanceled()) {
48     itk::ProcessObject * o = dynamic_cast<itk::ProcessObject *>(caller);
49     o->SetAbortGenerateData(true);
50   }
51 }
52 //====================================================================
53
54 //====================================================================
55 void vvQProgressDialogITKCommand::Execute(const itk::Object *caller, const itk::EventObject & event)
56 {
57   i++;
58   progress.setValue(i);
59 }
60 //====================================================================
61
62 #endif /* end #define VVQPROGRESSDIALOGITKCOMMAND_CXX */
63