Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Macros | Functions
utils.h File Reference
#include <hugin_shared.h>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <cassert>
#include <vigra/imageinfo.hxx>
#include <lcms2.h>
#include <hugin_utils/platform.h>
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 hugin_utils
 namespace for various utils
 

Macros

#define DEBUG_HEADER   hugin_utils::GetCurrentTimeString() <<" (" << __FILE__ << ":" << __LINE__ << ") " << __func__ << "(): "
 
#define DEBUG_TRACE(msg)
 
#define DEBUG_DEBUG(msg)
 
#define DEBUG_INFO(msg)
 
#define DEBUG_NOTICE(msg)
 
#define DEBUG_WARN(msg)   { std::cerr << "WARN: " << DEBUG_HEADER << msg << std::endl; }
 
#define DEBUG_ERROR(msg)   { std::cerr << "ERROR: " << DEBUG_HEADER << msg << std::endl; }
 
#define DEBUG_FATAL(msg)   { std::cerr << "FATAL: " << DEBUG_HEADER << "(): " << msg << std::endl; }
 
#define DEBUG_ASSERT(cond)   assert(cond)
 
#define UTILS_THROW(class, msg)   { std::stringstream o; o << msg; throw(class(o.str().c_str())); };
 

Functions

std::string hugin_utils::GetCurrentTimeString ()
 current time as a string More...
 
std::string hugin_utils::doubleToString (double d, int fractionaldigits=-1)
 convert a double to a string, suitable for display within a GUI. More...
 
template<typename STR >
bool hugin_utils::stringToDouble (const STR &str_, double &dest)
 convert a string to a double, ignore localisation. More...
 
bool hugin_utils::stringToInt (const std::string &s, int &val)
 convert string to integer value, returns true, if sucessful More...
 
bool hugin_utils::stringToUInt (const std::string &s, unsigned int &val)
 convert string to unsigned integer value, returns true, if sucessful More...
 
std::string hugin_utils::getPathPrefix (const std::string &filename)
 Get the path to a filename. More...
 
std::string hugin_utils::getExtension (const std::string &basename)
 Get extension of a filename. More...
 
std::string hugin_utils::stripPath (const std::string &filename)
 remove the path of a filename (mainly useful for gui display of filenames) More...
 
std::string hugin_utils::stripExtension (const std::string &basename)
 remove extension of a filename More...
 
std::string hugin_utils::StrTrim (const std::string &str)
 remove trailing and leading white spaces and tabs More...
 
std::vector< std::string > hugin_utils::SplitString (const std::string &s, const std::string &sep)
 split string s at given sep, returns vector of strings More...
 
void hugin_utils::ReplaceAll (std::string &s, const std::string &oldChar, char newChar)
 replace all characters oldChar in s with newChar More...
 
bool hugin_utils::StringContainsCaseInsensitive (const std::string &s1, const std::string &s2)
 check if s1 contains s2 using case insensitive comparison More...
 
template<class str >
str hugin_utils::QuoteStringInternal (const str &arg, const str &quotechar, const str &replacements)
 
void hugin_utils::ControlPointErrorColour (const double cperr, double &r, double &g, double &b)
 
bool hugin_utils::FileExists (const std::string &filename)
 checks if file exists More...
 
std::string hugin_utils::GetAbsoluteFilename (const std::string &filename)
 returns the full absolute filename More...
 
bool hugin_utils::IsFileTypeSupported (const std::string &filename)
 return true, if file type by extension is supported by vigra More...
 
void hugin_utils::EnforceExtension (std::string &filename, const std::string &defaultExtension)
 check if filename contains extension, if not add default extension More...
 
std::string hugin_utils::GetOutputFilename (const std::string &out, const std::string &in, const std::string &suffix)
 construct output filename, if ouput is known return this value otherwise use the input filename and append the suffix before the extension More...
 
std::string hugin_utils::GetDataDir ()
 returns the full path to the data directory More...
 
std::string hugin_utils::GetUserAppDataDir ()
 returns the directory for user specific Hugin settings, e.g. More...
 
bool hugin_utils::initGPU (int *argcp, char **argv)
 Try to initalise GLUT and GLEW, and create an OpenGL context for GPU stitching. More...
 
bool hugin_utils::wrapupGPU ()
 cleanup GPU settings More...
 
std::string hugin_utils::GetHuginVersion ()
 return a string with version numbers More...
 
std::string hugin_utils::GetICCDesc (const vigra::ImageImportInfo::ICCProfile &iccProfile)
 returns description of given icc profile More...
 
std::string hugin_utils::GetICCDesc (const cmsHPROFILE &profile)
 
std::vector< std::string > hugin_utils::GetRawExtensions ()
 return vector of known extensions of raw files, all lower case More...
 
bool hugin_utils::IsRawExtension (const std::string testExt)
 return true if extension belongs to a raw file More...
 

Detailed Description

Author
Pablo d'Angelo pablo.nosp@m..dan.nosp@m.gelo@.nosp@m.web..nosp@m.de

$Id$

This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with this software. If not, see http://www.gnu.org/licenses/.

Definition in file utils.h.

Macro Definition Documentation

#define DEBUG_ASSERT (   cond)    assert(cond)

Definition at line 80 of file utils.h.

Referenced by PreviewIdentifyTool::AfterDrawImagesEvent(), vigra_ext::applyRect(), AutoPanoSift::automatch(), AutoPanoSiftPreAlign::automatch(), PreviewIdentifyTool::BeforeDrawImageEvent(), TextureManager::BindTexture(), HuginBase::MaskPolygon::clipPolygon(), MeshManager::MeshInfo::CompileList(), CPListFrame::CPListFrame(), OptimizePhotometricPanel::Create(), ImagesPanel::Create(), OptimizePanel::Create(), PanoPanel::Create(), MaskEditorPanel::Create(), CPEditorPanel::Create(), vigra_ext::createTiffDirectory(), TextureManager::DrawImage(), GreatCircles::drawLineFromSpherical(), GenerateSequenceDialog::FillImagesList(), CPEditorPanel::FineTuneSelectedPoint(), huginApp::Get(), MainFrame::Get(), HuginBase::ConstStandardImageVariableGroups::getLens(), HuginBase::ConstImageVariableGroup::getPartNumber(), HuginBase::PTScriptParsing::getPTDoubleParam(), HuginBase::Panorama::getSrcImage(), TextureManager::GetTextureName(), GLPreviewFrame::GLPreviewFrame(), HFOVDialog::HFOVDialog(), PreviewIdentifyTool::HighlightColour(), ImagesTreeCtrl::Init(), ImagesList::Init(), vigra_ext::ROIImage< RemapImage, AlphaImage >::lowerRight(), MainFrame::MainFrame(), vigra_ext::ROIImage< RemapImage, AlphaImage >::maskLowerRight(), vigra_ext::ROIImage< RemapImage, AlphaImage >::maskUpperLeft(), CPEditorPanel::NewPointChange(), PreviewFrame::OnShowAll(), PreviewFrame::OnShowNone(), GLPreviewFrame::OnShowNone(), HuginBase::Nona::TiffMultiLayerRemapper< ImageType, AlphaImageType >::prepareOutputFile(), PreviewFrame::PreviewFrame(), RawImportProgress::RawImportProgress(), HuginBase::PTScriptParsing::readVar(), HuginBase::Panorama::removeCtrlPoint(), HuginBase::Panorama::setImageFilename(), HuginBase::Panorama::setOptimizeVector(), PreviewIdentifyTool::ShowImageNumber(), HuginBase::ImageCache::softFlush(), HuginBase::Nona::MultiImageRemapper< ImageType, AlphaImageType >::stitch(), HuginBase::Nona::stitchPanorama(), PreviewIdentifyTool::StopUpdating(), HuginBase::Panorama::swapImages(), TextureManager::TextureInfo::TextureInfo(), PanoCommand::PanoCommand::undo(), HuginBase::Panorama::updateMasksForImage(), PreviewIdentifyTool::UpdateWithNewImageSet(), and vigra_ext::ROIImage< RemapImage, AlphaImage >::upperLeft().

#define DEBUG_DEBUG (   msg)

Definition at line 68 of file utils.h.

Referenced by PanosphereOverviewProjectionGridTool::AfterDrawImagesBackEvent(), PreviewProjectionGridTool::AfterDrawImagesEvent(), PanosphereOverviewProjectionGridTool::AfterDrawImagesFrontEvent(), HuginBase::PTOptEstimator::agree(), HuginBase::SrcPanoImage::applyEXIFValues(), AutoPanoSift::automatch(), AutoPanoKolor::automatch(), MaskImageCtrl::calcAutoScaleFactor(), CPImageCtrl::calcAutoScaleFactor(), HuginBase::StraightenPanorama::calcStraighteningRotation(), HuginBase::Panorama::changeFinished(), MeshManager::CheckUpdate(), AutoCtrlPointCreator::Cleanup(), MeshManager::MeshInfo::CompileList(), correctImage(), vigra_ext::correlateImageFast(), PreviewPanel::Create(), ImagesList::Create(), GLwxAuiManager::CreateFloatingFrame(), ImagesList::CreateItem(), TextureManager::TextureInfo::CreateTexture(), CPListCtrl::DeleteSelected(), PanoPanel::DoStitch(), ViewState::DoUpdates(), VisualizationState::DoUpdates(), PreviewPanel::DrawPreview(), HuginBase::estimateImageAlpha(), CPEditorPanel::EstimatePoint(), PanoPanel::FileFormatChanged(), HuginBase::RANSACOptimizer::findInliers(), vigra_ext::findInterestPointsPartial(), FineTuneInterestPoints(), CPEditorPanel::FineTuneSelectedPoint(), VisualizationState::FinishedDraw(), PanoPanel::FusionChanged(), HuginBase::Exiv2Helper::getCropFactor(), HuginBase::PTScriptParsing::getPTDoubleParam(), HuginBase::SmallRemappedImageCache::getRemapped(), HuginBase::ImageCache::getSmallImage(), LocalizedFileTipProvider::GetTip(), HuginBase::PanoramaOptions::getVFOV(), PanoPanel::HDRFileFormatChanged(), PanoPanel::HDRMergeChanged(), HuginBase::Nona::SpaceTransform::InitRadialCorrect(), HuginBase::SmallRemappedImageCache::invalidate(), MyExecPanel::KillProcess(), HuginBase::PTOptEstimator::leastSquaresEstimate(), HuginBase::ImageCache::loadImageSafely(), LoadLensParametersChoose(), MainFrame::LoadProjectFile(), vigra_ext::ROIImage< RemapImage, AlphaImage >::lowerRight(), main(), vigra_ext::ROIImage< RemapImage, AlphaImage >::maskLowerRight(), vigra_ext::ROIImage< RemapImage, AlphaImage >::maskUpperLeft(), CPImageCtrl::mouseMoveEvent(), PreviewPanel::mousePressLMBEvent(), CPImageCtrl::mousePressLMBEvent(), CPImageCtrl::mousePressMMBEvent(), PreviewPanel::mousePressRMBEvent(), CPImageCtrl::mouseReleaseLMBEvent(), CPImageCtrl::mouseReleaseMMBEvent(), CPImageCtrl::mouseReleaseRMBEvent(), GLwxAuiFloatingFrame::OnActivate(), MyExecDialog::OnCancel(), PreviewFrame::OnChangeDisplayedImgs(), PreviewFrame::OnChangeFOV(), GLPreviewFrame::OnChangeFOV(), PreviewFrame::OnClose(), OptimizePhotometricPanel::OnClose(), OptimizePanel::OnClose(), CPListFrame::OnClose(), GLPreviewFrame::OnClose(), CPEditorPanel::OnCPEvent(), HFOVDialog::OnCropFactorChanged(), CPImageCtrl::OnDraw(), MainFrame::OnFineTuneAll(), HFOVDialog::OnFocalLengthChanged(), HFOVDialog::OnHFOVChanged(), huginApp::OnInit(), PanoPanel::OnJPEGQualityText(), CPEditorPanel::OnKey(), CPImageCtrl::OnKey(), CPImageCtrl::OnKeyDown(), TextKillFocusHandler::OnKillFocus(), MaskImageCtrl::OnLeftMouseDown(), MaskImageCtrl::OnLeftMouseUp(), GLwxAuiFloatingFrame::OnMoveFinished(), PreviewFrame::OnNumTransform(), MyExecDialog::OnProcessTerminate(), PreviewFrame::OnProjectionChoice(), GLPreviewFrame::OnProjectionChoice(), MainFrame::OnSaveProject(), ImagesPanel::OnSelectionChanged(), GLPreviewFrame::OnShowEvent(), MyPipedProcess::OnTerminate(), TextKillFocusHandler::OnTextChange(), MyExecPanel::OnTimer(), HFOVDialog::OnTypeChanged(), HuginBase::Nona::StackingBlender::operator()(), PreviewFrame::panoramaChanged(), PreviewPanel::panoramaChanged(), ViewState::panoramaChanged(), CPEditorPanel::panoramaChanged(), GLPreviewFrame::panoramaChanged(), ImagesPanel::panoramaImagesChanged(), ImagesList::panoramaImagesChanged(), CPEditorPanel::panoramaImagesChanged(), GLPreviewFrame::PauseResize(), HuginBase::PhotometricOptimizer::photometricError(), vigra_ext::PointFineTune(), vigra_ext::PointFineTuneRotSearch(), HuginBase::Nona::TiffMultiLayerRemapper< ImageType, AlphaImageType >::prepareOutputFile(), PanoCommand::wxLoadPTProjectCmd::processPanorama(), PanoCommand::wxApplyTemplateCmd::processPanorama(), PanoCommand::wxAddCtrlPointGridCmd::processPanorama(), PanoPanel::ProjectionChanged(), HuginBase::PTOptEstimator::PTOptEstimator(), HuginBase::SrcPanoImage::readEXIF(), HuginBase::PTScriptParsing::readVar(), PanoCommand::CommandHistory::redo(), VisualizationState::Redraw(), GLViewer::RedrawE(), reduceFilesToHDR(), GLViewer::RefreshWrapper(), HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::remapImage(), HuginBase::Nona::remapImage(), PanoPanel::RemapperChanged(), HuginBase::Panorama::removeImage(), CPImageCtrl::rescaleImage(), GLViewer::Resized(), HuginBase::RotatePanorama::rotatePano(), OptimizePhotometricPanel::runOptimizer(), OptimizePanel::runOptimizer(), HuginBase::Nona::TiffMultiLayerRemapper< ImageType, AlphaImageType >::saveRemapped(), CPEditorPanel::SelectGlobalPoint(), CPEditorPanel::SelectLocalPoint(), CPImageCtrl::selectPoint(), HuginBase::PTools::setDestImage(), HuginBase::PanoramaOptions::setHeight(), HuginBase::Panorama::setMemento(), HuginBase::Panorama::setMementoToCopyOf(), CPImageCtrl::setNewPoint(), HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::setPanoImage(), MaskImageCtrl::setScale(), CPImageCtrl::setScale(), GLPreview::setUp(), GLOverview::setUp(), HuginBase::PanoramaOptions::setVFOV(), HuginBase::PanoramaOptions::setWidth(), MainFrame::ShowCtrlPoint(), CPImageCtrl::showPosition(), CPImageCtrl::showSearchArea(), HuginBase::SmartOptimise::smartOptimize(), HuginBase::ImageCache::softFlush(), HuginBase::ImageCache::spawnAsyncThread(), PanoPanel::StackCheck(), HuginBase::Nona::WeightedStitcher< ImageType, AlphaType >::stitch(), HuginBase::Nona::ReduceStitcher< ImageType, AlphaType >::stitch(), HuginBase::Nona::SimpleStitcher< ImageType, AlphaType >::stitch(), HuginBase::Nona::stitchPanorama(), RunStitchPanel::StitchProject(), hugin_utils::stringToDouble(), vigra_ext::subpixelMaxima(), vigra_ext::transformImage(), vigra_ext::transformImageAlpha(), vigra_ext::transformImageAlphaGPU(), vigra_ext::transformImageGPU(), PanoCommand::CommandHistory::undo(), VertexCoordRemapper::UpdateAndResetIndex(), CPEditorPanel::UpdateDisplay(), PreferencesDialog::UpdateDisplayData(), PreviewPanel::updatePreview(), vigra_ext::ROIImage< RemapImage, AlphaImage >::upperLeft(), MainFrame::~MainFrame(), and TextureManager::TextureInfo::~TextureInfo().

#define DEBUG_ERROR (   msg)    { std::cerr << "ERROR: " << DEBUG_HEADER << msg << std::endl; }
#define DEBUG_FATAL (   msg)    { std::cerr << "FATAL: " << DEBUG_HEADER << "(): " << msg << std::endl; }
#define DEBUG_HEADER   hugin_utils::GetCurrentTimeString() <<" (" << __FILE__ << ":" << __LINE__ << ") " << __func__ << "(): "

Definition at line 53 of file utils.h.

#define DEBUG_INFO (   msg)
#define DEBUG_NOTICE (   msg)

Definition at line 70 of file utils.h.

Referenced by HuginBase::PanoramaOptions::setHFOV(), and vigra_ext::subpixelMaxima().

#define DEBUG_TRACE (   msg)

Definition at line 67 of file utils.h.

Referenced by AboutDialog::AboutDialog(), MyExecPanel::AddToOutput(), RunStitchPanel::CancelStitch(), HuginBase::Panorama::changeFinished(), CPEditorPanel::changeState(), CPImageCtrl::clearNewPoint(), CPEditorPanel::CPEditorPanel(), CPListFrame::CPListFrame(), OptimizePhotometricPanel::Create(), ImagesPanel::Create(), OptimizePanel::Create(), PreviewPanel::Create(), PanoPanel::Create(), MaskEditorPanel::Create(), ImagesTreeCtrl::Create(), ImagesList::Create(), CPEditorPanel::Create(), ImagesListMask::Create(), CPEditorPanel::CreateNewPoint(), CPImageCtrl::deselect(), PanoPanel::DoCalcFOV(), PreviewPanel::DrawPreview(), HuginBase::ImageCache::Entry::Entry(), PanoOperation::AddImagesSeriesOperation::GetInternalCommand(), PanoOperation::CelesteOperation::GetInternalCommand(), CPImageCtrl::GetMagBitmap(), GLPreviewFrame::GLPreviewFrame(), huginApp::huginApp(), OptimizePanel::Init(), LensCalFrame::LensCalFrame(), MainFrame::LoadProjectFile(), MainFrame::MainFrame(), MaskEditorPanel::MaskEditorPanel(), CPEditorPanel::NewPointChange(), MainFrame::OnAddImages(), BatchFrame::OnButtonHelp(), CPEditorPanel::OnCelesteButton(), PreviewFrame::OnChangeFOV(), GLPreviewFrame::OnChangeFOV(), PreviewFrame::OnClose(), OptimizePhotometricPanel::OnClose(), OptimizePanel::OnClose(), GLPreviewFrame::OnClose(), CPEditorPanel::OnCPEvent(), CPEditorPanel::OnCPListSelect(), CPEditorPanel::OnDeleteButton(), MainFrame::OnDoStitch(), FileDropTarget::OnDropFiles(), PanoDropTarget::OnDropFiles(), huginApp::OnExit(), MainFrame::OnExit(), stitchApp::OnExit(), MainFrame::OnFineTuneAll(), PreviewFrame::OnFitPano(), GLPreviewFrame::OnFitPano(), LensCalApp::OnInit(), huginApp::OnInit(), ImagesList::OnItemDeselected(), ImagesList::OnItemSelected(), CPImageCtrl::OnKey(), CPImageCtrl::OnKeyDown(), TextKillFocusHandler::OnKillFocus(), CPEditorPanel::OnLeftChoiceChange(), MainFrame::OnLoadProject(), CPImageCtrl::OnMouseEnter(), CPImageCtrl::OnMouseLeave(), MainFrame::OnOptimize(), OptimizePhotometricPanel::OnOptimizeButton(), OptimizePanel::OnOptimizeButton(), GLPreviewFrame::OnOverviewToggle(), RunStitchPanel::OnProcessTerminate(), RunStitchFrame::OnProcessTerminate(), MyExecPanel::OnProcessTerminated(), RunStitchFrame::OnQuit(), MainFrame::OnRedo(), PreviewPanel::OnResize(), PreferencesDialog::OnRestoreDefaults(), CPEditorPanel::OnRightChoiceChange(), MainFrame::OnSaveProject(), MainFrame::OnSaveProjectAs(), MainFrame::OnSavePTStitcherAs(), MainFrame::OnShowCPFrame(), GLPreviewFrame::OnShowEvent(), MainFrame::OnShowPrefs(), MaskImageCtrl::OnSize(), MainFrame::OnSize(), CPImageCtrl::OnSize(), TextKillFocusHandler::OnTextChange(), TextKillFocusHandler::OnTextEnter(), CPEditorPanel::OnTextPointChange(), MyExecPanel::OnTimer(), MainFrame::OnTogglePreviewFrame(), GLPreviewFrame::OnTrackChangeFOV(), MainFrame::OnUndo(), OptimizePanel::OptimizePanel(), PanoPanel::panoramaChanged(), CPEditorPanel::panoramaChanged(), PreviewFrame::panoramaImagesChanged(), PreviewPanel::panoramaImagesChanged(), ImagesPanel::panoramaImagesChanged(), ImagesList::panoramaImagesChanged(), ImagesTreeCtrl::panoramaImagesChanged(), CPEditorPanel::panoramaImagesChanged(), MainFrame::panoramaImagesChanged(), GLPreviewFrame::panoramaImagesChanged(), CPEditorPanel::PointFineTune(), vigra_ext::PointFineTuneRotSearch(), PreferencesDialog::PreferencesDialog(), PreviewFrame::PreviewFrame(), PanoCommand::wxLoadPTProjectCmd::processPanorama(), vigra_ext::reduceToNextLevelOld(), HuginBase::Panorama::removeImage(), RestoreFramePosition(), OptimizePhotometricPanel::runOptimizer(), OptimizePanel::runOptimizer(), CPEditorPanel::SelectLocalPoint(), CPImageCtrl::selectPoint(), MaskImageCtrl::setImage(), MaskEditorPanel::setImage(), CPImageCtrl::setImage(), CPEditorPanel::setLeftImage(), HuginBase::Panorama::setMemento(), CPEditorPanel::setRightImage(), PanoPanel::StackCheck(), stitchApp::stitchApp(), RunStitchPanel::StitchProject(), StoreFramePosition(), HuginBase::Panorama::swapImages(), CPImageCtrl::update(), PreferencesDialog::UpdateConfigData(), MaskEditorPanel::UpdateCropDisplay(), PreviewPanel::updatePreview(), CPEditorPanel::~CPEditorPanel(), CPImageCtrl::~CPImageCtrl(), CPListFrame::~CPListFrame(), HuginBase::ImageCache::Entry::~Entry(), GLPreviewFrame::~GLPreviewFrame(), huginApp::~huginApp(), ImagesList::~ImagesList(), ImagesPanel::~ImagesPanel(), ImagesTreeCtrl::~ImagesTreeCtrl(), LensCalFrame::~LensCalFrame(), MainFrame::~MainFrame(), MaskEditorPanel::~MaskEditorPanel(), OptimizePanel::~OptimizePanel(), OptimizePhotometricPanel::~OptimizePhotometricPanel(), PanoPanel::~PanoPanel(), HuginBase::Panorama::~Panorama(), PreferencesDialog::~PreferencesDialog(), PreviewFrame::~PreviewFrame(), PreviewPanel::~PreviewPanel(), and stitchApp::~stitchApp().

#define DEBUG_WARN (   msg)    { std::cerr << "WARN: " << DEBUG_HEADER << msg << std::endl; }
#define UTILS_THROW (   class,
  msg 
)    { std::stringstream o; o << msg; throw(class(o.str().c_str())); };

Definition at line 83 of file utils.h.

Referenced by HuginBase::Nona::stitchPanorama().