17 #include <itksys/SystemTools.hxx>
18 #include <itkFastMutexLock.h>
19 #include <itkMutexLockHolder.h>
29 : m_DebugEnabled(false)
30 , m_ShowImagesInDebug(false)
31 , m_ShowImagesTimeOut(false)
32 , m_Mutex(
itk::FastMutexLock::
New())
33 , m_DebugImagesOutputDirectory(
"")
38 std::set<std::string> m_FilesToDebug;
39 std::set<std::string> m_SymbolsToDebug;
41 bool m_ShowImagesInDebug;
42 size_t m_ShowImagesTimeOut;
43 std::ofstream m_Stream;
45 std::string m_DebugImagesOutputDirectory;
49 : d ( new EndoDebugData )
56 if(d->m_Stream.is_open())
74 while( filename.empty() || itksys::SystemTools::FileExists( (dir+
"/"+filename).c_str() ) )
78 filename = prefix + s.str() +
"." + ext;
89 return itksys::SystemTools::GetFilenameWithoutExtension( s );
96 std::pair<std::set<std::string>::iterator,
bool> res = d->m_FilesToDebug.insert( s );
105 d->m_FilesToDebug = filesToDebug;
113 return d->m_FilesToDebug;
121 std::pair<std::set<std::string>::iterator,
bool> res = d->m_SymbolsToDebug.insert( symbolToDebug );
130 d->m_SymbolsToDebug = symbolsToDebug;
138 return d->m_SymbolsToDebug;
146 return d->m_SymbolsToDebug.find(s)
147 != d->m_SymbolsToDebug.end();
157 return d->m_FilesToDebug.find(filename)
158 != d->m_FilesToDebug.end();
167 bool debugEnabled =
false;
168 size_t filesSize = 0;
169 size_t symbolsSize = 0;
170 bool symbolFound =
false;
173 debugEnabled = d->m_DebugEnabled;
174 filesSize = d->m_FilesToDebug.size();
175 symbolsSize = d->m_SymbolsToDebug.size();
176 symbolFound = d->m_SymbolsToDebug.find(symbol) != d->m_SymbolsToDebug.end();
187 if( symbolsSize > 0 )
194 if( !symbol.empty() )
207 d->m_DebugEnabled = _DebugEnabled;
215 d->m_DebugImagesOutputDirectory = _DebugImagesOutputDirectory;
224 return d->m_DebugEnabled;
232 d->m_ShowImagesInDebug = _ShowImagesInDebug;
240 return d->m_ShowImagesInDebug;
248 d->m_ShowImagesTimeOut = _ShowImagesTimeOut;
256 return d->m_DebugImagesOutputDirectory;
264 return d->m_ShowImagesTimeOut;
272 d->m_Stream.open ( file.c_str(), std::ios::out | std::ios::app);
280 if(d->m_Stream.is_open())
286 newtime = localtime(&aclock);
287 timestr = asctime(newtime);
289 d->m_Stream << timestr <<
", " << message;
292 std::cout << message << std::flush;
bool AddSymbolToDebug(const std::string &symbolToDebug)
itk::SmartPointer< Self > Pointer
static EndoDebug & GetInstance()
void SetSymbolsToDebug(const std::set< std::string > &symbolsToDebug)
void SetShowImagesInDebug(bool _ShowImagesInDebug)
DataCollection - Class to facilitate loading/accessing structured data.
bool DebugSymbol(const std::string &symbolToDebug)
std::string GetFilenameWithoutExtension(const std::string &s)
void SetDebugEnabled(bool _DebugEnabled)
void SetShowImagesTimeOut(vcl_size_t _ShowImagesTimeOut)
bool AddFileToDebug(const std::string &fileToDebug)
void SetLogFile(const std::string &file)
void ShowMessage(const std::string &message)
static const std::string filename
std::set< std::string > GetFilesToDebug()
bool GetShowImagesInDebug()
std::set< std::string > GetSymbolsToDebug()
std::string GetDebugImagesOutputDirectory() const
void SetFilesToDebug(const std::set< std::string > &filesToDebug)
void SetDebugImagesOutputDirectory(const std::string &_DebugImagesOutputDirectory)
bool Debug(const std::string &fileToDebug, const std::string &symbol="")
vcl_size_t GetShowImagesTimeOut()
static std::string GetUniqueFileName(const std::string &dir, const std::string &ext="jpg", const std::string &prefix="")
bool DebugFile(const std::string &fileToDebug)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.