fw4spl
ProgressItkToFw.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWITKIO_HELPER_PROGRESSITKTOFW_HPP__
8 #define __FWITKIO_HELPER_PROGRESSITKTOFW_HPP__
9 
10 #include <itkCommand.h>
11 #include <itkProcessObject.h>
12 
13 #include <fwTools/ProgressAdviser.hpp>
14 
15 namespace fwItkIO
16 {
17 
18 //------------------------------------------------------------------------------
19 
21 {
22 public:
23  typedef SPTR (ProgressorBase) sptr;
24 };
25 
26 //------------------------------------------------------------------------------
27 
28 template< typename OBSERVEE >
30 {
31 public:
32  ProgressItkToFw(OBSERVEE observee, SPTR(::fwTools::ProgressAdviser)observer, std::string msg);
33 
34  virtual ~ProgressItkToFw();
35 
36 protected:
37 
38  OBSERVEE m_observee;
39  // observertag used by itk
40  unsigned long m_obsTag;
41  bool m_initialized;
42 };
43 
44 //------------------------------------------------------------------------------
45 
47 {
48 public:
49  typedef SPTR (Progressor) sptr;
50 
51  template<typename OBS >
52  Progressor(OBS filter, SPTR(::fwTools::ProgressAdviser)observer, std::string message)
53  {
54  typedef ProgressItkToFw< OBS > ProgressType;
55  m_progressor = ProgressorBase::sptr(
56  new ProgressType( filter, observer, message )
57  );
58  }
59 
60  ProgressorBase::sptr m_progressor;
61 };
62 
63 }
64 
65 #include "fwItkIO/helper/ProgressItkToFw.hxx"
66 
67 #endif /* __FWITKIO_HELPER_PROGRESSITKTOFW_HPP__ */
#define SPTR(_cls_)
Subclasses Inherited from ProgressAdviser can notify progression This class is used as base class to ...
The namespace fwItkIO contains reader, writer and helper for itk image.