ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkXMLFilterWatcher.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkXMLFilterWatcher_h
19 #define __itkXMLFilterWatcher_h
20 
21 #include "itkSimpleFilterWatcher.h"
22 
23 namespace itk
24 {
32 {
33 public:
34  XMLFilterWatcher(ProcessObject *o, const char *comment = ""):
35  SimpleFilterWatcher(o, comment) {}
36 
37 protected:
38 
40  virtual void ShowProgress()
41  {
42  if ( this->GetProcess() )
43  {
44  int steps = this->GetSteps();
45  steps++;
46  this->SetSteps(steps);
47  if ( !this->GetQuiet() )
48  {
49  std::cout << "<filter-progress>"
50  << this->GetProcess()->GetProgress()
51  << "</filter-progress>"
52  << std::endl;
53  std::cout << std::flush;
54  }
55  }
56  }
58 
60  virtual void StartFilter()
61  {
62  this->SetSteps(0);
63  this->SetIterations(0);
64  this->GetTimeProbe().Start();
65  if ( !this->GetQuiet() )
66  {
67  std::cout << "<filter-start>"
68  << std::endl;
69  std::cout << "<filter-name>"
70  << ( this->GetProcess()
71  ? this->GetProcess()->GetNameOfClass() : "None" )
72  << "</filter-name>"
73  << std::endl;
74  std::cout << "<filter-comment>"
75  << " \"" << this->GetComment() << "\" "
76  << "</filter-comment>"
77  << std::endl;
78  std::cout << "</filter-start>"
79  << std::endl;
80  std::cout << std::flush;
81  }
82  }
84 
86  virtual void EndFilter()
87  {
88  }
89 };
90 } // end namespace itk
91 
92 #endif
virtual const float & GetProgress() const
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
XMLFilterWatcher(ProcessObject *o, const char *comment="")
Simple mechanism for monitoring the pipeline events of a filter and reporting these events to std::co...
virtual const char * GetNameOfClass() const
Simple mechanism for monitoring the pipeline events of a filter and reporting these events to std::co...