MeVisLab Toolbox Reference
mlDirectDicomImportDPLLogger.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
5
12
13//----------------------------------------------------------------------------------
14#pragma once
15
16// Local includes
18
19// ML includes
21#include "mlTimeCounter.h"
22#include <FMEThirdPartyWarningsDisable.h>
23#include <string>
24#include <FMEThirdPartyWarningsRestore.h>
25
26// Logger class used in DirectDicomImport.
27#include "mlProgressLogger.h"
28
29// Some error define from windows causes trouble in logger include...
30#ifdef ERROR
31 #define _DPL_SAVE_ERROR_DEF ERROR
32 #undef ERROR
33#endif
34
35// For the logger.
36#include "DPL_TypeDefs.h"
37#include "DPL_Logger.h"
38
40
41 class DirectDicomImportDPLTagValueProvider;
42
43 //----------------------------------------------------------------------------------
45 //----------------------------------------------------------------------------------
47 {
48 public:
51
53 typedef void ProgressCB(void *usrData,
54 const std::string &info,
55 float state);
56
58 virtual void setProgressCB(ProgressCB *callback = nullptr,
59 void *userData = nullptr,
60 float progressStart = 0.2f,
61 float progressRange = 0.3f);
62
65
68
70 void setVerboseLevel(unsigned int verboseLevel);
71
73 unsigned int getVerboseLevel() const;
74
77
80
84
87
88
89 protected:
93 void log( Logger::LogTypes logType, const std::string& msgArg ) override;
94
99 void log( Logger::LogTypes logType, DPL::ErrorInfo* error ) override;
100
101 private:
103 ProgressLogger *_ddiLogger;
104
106 unsigned int _verboseLevel;
107
109 bool _logPartingAndSortingInformationOn;
110
112 DirectDicomImportDPLTagValueProvider *_tagValueProvider;
113
115 ProgressCB *_updateProgressInfos;
116
118 void *_userData;
119
121 float _progressStart;
122
124 float _progressRange;
125
127 TimeCounter _timeCounter;
128
130 MLdouble _recentTime;
131
134 void _selfTest();
135
140 };
141
143
144// Restore previous ERROR define from Windows.
145#ifdef _DPL_SAVE_ERROR_DEF
146 #define ERROR _DPL_SAVE_ERROR_DEF
147#endif
Project global and OS specific declarations.
#define MLDIRECTDICOMIMPORT_EXPORT
Only for diagnostic purposes.
Extended DPL logger class redirecting messages from the DPL to a DirectDicomImport instance.
virtual void setProgressCB(ProgressCB *callback=nullptr, void *userData=nullptr, float progressStart=0.2f, float progressRange=0.3f)
Defines the currently used progress callback or resets it if nothing is passed.
void ProgressCB(void *usrData, const std::string &info, float state)
Progress callback which can be registered for DPL progress logging.
unsigned int getVerboseLevel() const
Returns verbose level.
void setProgressLogger(ProgressLogger *ddiLogger=nullptr)
Set the used ProgressLogger instance, defaults to nullptr.
DirectDicomImportDPLTagValueProvider * getTagValueProvider() const
Returns the currently set tag value provider or nullptr if not set.
void setLogPartingAndSortingInformationOn(bool on)
Enables logging of partitioning and sorting information if enabled, default is off/false.
ProgressLogger * getProgressLogger() const
Returns the currently set ProgressLogger.
void setVerboseLevel(unsigned int verboseLevel)
Verbose level (0 = only warnings and errors, other values = full information).
void log(Logger::LogTypes logType, DPL::ErrorInfo *error) override
Receives the DPL error and sends it to the console of the DirectDicomImport instance.
bool isPartingAndSortingInformationOn()
Returns true if logging of partitioning and sorting information is enabled, otherwise false.
void setTagValueProvider(DirectDicomImportDPLTagValueProvider *prov=nullptr)
An optional tag value provider from which information about the recent frame can be retrieved for mor...
void log(Logger::LogTypes logType, const std::string &msgArg) override
Receives the DPL message and sends it to the console of the DirectDicomImport instance.
DirectDicomImportDPLLogger(ProgressLogger *ddiLogger=nullptr)
Constructor: A class logging DPl messages to the console of the instance of a ProgressLogger.
An DPL::TagValueProvider class for the DirectDicomImport module.
Configurable logger and progress handler class which can be used as base class for logging,...
Class to measure precise time intervals.
Configurable logger and progress handler class which can be used as base class for logging,...
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
double MLdouble
Definition mlTypeDefs.h:217