24#ifndef _HUGINAPP_IMAGECACHE_H
25#define _HUGINAPP_IMAGECACHE_H
28#include "hugin_config.h"
33#include <vigra/stdimage.hxx>
34#include <vigra/imageinfo.hxx>
38#define HUGIN_IMGCACHE_MAPPING_INTEGER 0l
39#define HUGIN_IMGCACHE_MAPPING_FLOAT 1l
85 DEBUG_TRACE(
"Constructing an empty ImageCache::Entry");
94 const std::string &
typ)
135 {
return m_filename;};
156 : asyncLoadCompleteSignal(0), upperBound(100*1024*1024ull),
157 m_progress(
NULL), m_accessCounter(0)
188 EntryPtr getImage(
const std::string & filename);
197 EntryPtr getImageIfAvailable(
const std::string & filename);
208 EntryPtr getSmallImage(
const std::string & filename);
219 EntryPtr getSmallImageIfAvailable(
const std::string & filename);
227 RequestPtr requestAsyncImage(
const std::string & filename);
235 RequestPtr requestAsyncSmallImage(
const std::string & filename);
240 void removeImage(
const std::string & filename);
291 static void importAndConvertImage(
const vigra::ImageImportInfo& info,
292 vigra::pair<DestIterator, DestAccessor>
dest,
293 const std::string& type);
297 static void importAndConvertAlphaImage(
const vigra::ImageImportInfo & info,
298 vigra::pair<DestIterator, DestAccessor>
dest,
299 vigra::pair<MaskIterator, MaskAccessor> mask,
300 const std::string & type);
306 { m_progress =
disp; }
310 { m_progress =
NULL; }
328 void spawnAsyncThread();
343 static EntryPtr loadImageSafely(
const std::string & filename);
377 : filename(
str), level(
lv)
380 std::string toString();
Request for an image to load Connect to the ready signal so when the image loads you can respond.
Request(std::string filename, bool request_small)
std::vector< std::function< void(EntryPtr, std::string, bool)> > ready
Signal that fires when the image is loaded.
const std::string & getFilename() const
This is a cache for all the images we use.
std::shared_ptr< vigra::FRGBImage > ImageCacheRGBFloatPtr
AppBase::ProgressDisplay * m_progress
std::shared_ptr< vigra::BRGBImage > ImageCacheRGB8Ptr
use reference counted pointers
std::shared_ptr< vigra::BImage > ImageCache8Ptr
std::map< std::string, RequestPtr > m_smallRequests
static ImageCache * instance
void setProgressDisplay(AppBase::ProgressDisplay *disp)
std::map< std::string, RequestPtr > m_requests
unsigned long long upperBound
std::shared_ptr< vigra::UInt16RGBImage > ImageCacheRGB16Ptr
std::map< std::string, vigra::BImage * > pyrImages
void clearProgressDisplay(AppBase::ProgressDisplay *disp)
std::shared_ptr< Request > RequestPtr
Reference counted request for an image to load.
std::shared_ptr< vigra::ImageImportInfo::ICCProfile > ImageCacheICCProfile
std::shared_ptr< Entry > EntryPtr
a shared pointer to the entry
void SetUpperLimit(const unsigned long long newUpperLimit)
sets the upper limit, which is used by softFlush()
std::map< std::string, EntryPtr > images
virtual ~ImageCache()
dtor.
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Implementation of fast vector type with support of linear algebra operations Copyright (C) 2009 Lukáš...
information about an image inside the cache
ImageCacheRGB16Ptr image16
ImageCacheRGBFloatPtr imageFloat
ImageCacheICCProfile iccProfile
Entry(ImageCacheRGB8Ptr &img, ImageCacheRGB16Ptr &img16, ImageCacheRGBFloatPtr &imgFloat, ImageCache8Ptr &imgMask, ImageCacheICCProfile &ICCProfile, const std::string &typ)
PyramidKey(const std::string &str, int lv)
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.