GenericRegistrationLogger.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2016 Imperial College London
5  * Copyright 2013-2016 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_GenericRegistrationLogger_H
21 #define MIRTK_GenericRegistrationLogger_H
22 
23 #include "mirtk/Observer.h"
24 
25 
26 namespace mirtk {
27 
28 
29 /**
30  * Prints progress of registration to output stream
31  */
33 {
34  mirtkObjectMacro(GenericRegistrationLogger);
35 
36  // ---------------------------------------------------------------------------
37  // Attributes
38 
39  /// Whether to always report raw, i.e., unweighted and unnormalized, energy term
40  /// value in parentheses after the weighted (and normalized) energy term value.
41  mirtkPublicAttributeMacro(bool, AlwaysReportRawValue);
42 
43  /// Verbosity level
44  mirtkPublicAttributeMacro(int, Verbosity);
45 
46  /// Output stream for progress report
47  mirtkPublicAggregateMacro(ostream, Stream);
48 
49  /// Whether to use SGR commands for colored terminal output
50  mirtkPublicAttributeMacro(bool, Color);
51 
52  /// Whether to flush stream buffer after each printed message
53  mirtkPublicAttributeMacro(bool, FlushBuffer);
54 
55  int _NumberOfIterations; ///< Number of actual line search iterations
56  int _NumberOfSteps; ///< Number of iterative line search steps
57  int _NumberOfGradientSteps; ///< Number of gradient descent steps
58 
59  // ---------------------------------------------------------------------------
60  // Construction/Destruction
61 private:
62 
63  /// Copy construction
64  /// \note Intentionally not implemented.
66 
67  /// Assignment operator
68  /// \note Intentionally not implemented.
70 
71 public:
72 
73  /// Constructor
74  GenericRegistrationLogger(ostream * = &cout);
75 
76  /// Destructor
78 
79  /// Handle event and print message to output stream
80  void HandleEvent(Observable *, Event, const void *);
81 
82 };
83 
84 
85 } // namespace mirtk
86 
87 #endif // MIRTK_GenericRegistrationLogger_H
Definition: IOConfig.h:41
~GenericRegistrationLogger()
Destructor.
Event
Events that can be observed.
Definition: Event.h:32
void HandleEvent(Observable *, Event, const void *)
Handle event and print message to output stream.