21 #ifndef __PyramidImage_hh__
22 #define __PyramidImage_hh__
24 #include <Base/Common/BIASpragmaStart.hh>
26 #include <Base/Common/SharedPtr.hh>
27 #include <Base/Image/Image.hh>
28 #include <Filter/Rescale.hh>
29 #include <Image/PyramidImageInterface.hh>
36 #define PYRAMID_BORDER 2
37 #define PYRAMID_BACKGROUND 0
39 #define D_PYRAMID_CREATE 0x00000001
40 #define D_PYRAMID_SINGLE_IM 0x00000002
54 template <
class StorageType>
55 class BIASImage_EXPORT PyramidImage
56 :
public Debug,
public PyramidImageInterface<StorageType>
61 PyramidImage(
const PyramidImage<StorageType>& pim);
63 PyramidImage(
const double factor,
64 const std::vector<SharedPtr<Image<StorageType> > > &imgs);
72 void Init(
const Image<StorageType>& image,
const unsigned py_size=0);
78 void InitFromImageBase(
const ImageBase& image,
const unsigned py_size=0);
81 void Init(
const unsigned int width,
const unsigned int height,
82 const unsigned int channelcount,
const unsigned py_size);
85 void Init(
const unsigned pyramid_size);
88 inline void clear() { Clear(); }
104 { BIASASSERT(index<=_Images.size());
return _Images[index]; }
108 { BIASASSERT(index<_Images.size());
109 BIASASSERT(
Get(_Images[index])!=NULL);
110 return _Images[index]; }
114 int GetAnisotropicImageValue(
const double& xsource,
115 const double& ysource,
118 unsigned int channel = 0)
const;
129 int GetTrilinearImageValue(
const double& x,
133 int channel=0)
const;
143 double GetImageValue(
const double& x,
const double& y,
144 unsigned int scale,
int channel=0)
const;
163 int CreateAdditionalLayer(
unsigned int numnewLayers = 1,
164 unsigned int minImageWidth = 32);
173 int SetROI(
unsigned minx,
unsigned miny,
unsigned maxx,
unsigned maxy);
176 int SetROI(
const ROI &roi);
178 inline bool IsEmpty()
const {
return _Images.empty(); }
179 inline unsigned Size()
const {
return (
unsigned)_Images.size(); }
187 int WriteImages(
const std::string& prefix)
const;
194 { _RescaleFactor=factor; _rescale.SetFactor(factor); }
198 { _rescale.SetLowPassFilter(filter); }
200 { _rescale.SetLowPassType(lpt); }
203 inline const std::vector<double>&
GetFactors()
const {
return _vFactor; };
205 inline std::vector<double>
GetFactors() {
return _vFactor; };
212 virtual void resize(
const unsigned size);
214 void Dump(std::ostream& os = std::cout)
const;
216 bool IsInROI(
double x,
double y,
int layer)
const;
220 std::vector<SharedPtr<Image<StorageType> > >
_Images;
246 void _CreateLevels();
249 { _Images.push_back(img); }
257 #include <Base/Common/BIASpragmaEnd.hh>
std::vector< SharedPtr< Image< StorageType > > > _Images
class for handling different region of interest (ROI) representations...
T * Get(SharedPtr< T > &t)
void SetLowPassType(int lpt)
Rescale< StorageType, StorageType > _rescale
SharedPtr< Image< StorageType > > & operator[](const unsigned index)
element access
pointer with reference count and automatic deletion
std::vector< double > _vFactor
double GetPositionOffset() const
std::vector< double > GetFactors()
void SetLowPassFilter(const FilterNToN< StorageType, StorageType > &filter)
SharedPtr< const Image< StorageType > > operator[](const unsigned index) const
double _PositionOffset
Offset which needs to be used when transferring point locations between pyramid levels: ...
The image template class for specific storage types.
interface definition of all pyramid images
const std::vector< double > & GetFactors() const
interface class for producing/storing Universally Unique IDentifiers
virtual void push_back(SharedPtr< Image< StorageType > > img)
void SetRescaleFactor(const double factor)
double GetRescaleFactor() const