29 #ifndef IMG_IMAGE_HANDLE_H
30 #define IMG_IMAGE_HANDLE_H
32 #include <boost/shared_ptr.hpp>
51 namespace ost {
namespace img {
53 using image_state::ImageStateBase;
55 using image_state::ImageStateNonModVisitorBase;
56 using image_state::ImageStateModIPVisitorBase;
57 using image_state::ImageStateConstModIPVisitorBase;
58 using image_state::ImageStateModOPVisitorBase;
59 using image_state::ImageStateConstModOPVisitorBase;
60 using image_state::ImageStateMorphVisitorBase;
66 class NonModAlgorithm;
68 class ConstModIPAlgorithm;
70 class ConstModOPAlgorithm;
80 class ConstImageHandle;
121 typedef boost::shared_ptr<DataObservable> ObsPtr;
123 typedef boost::shared_ptr<ImageStateBasePtr> StatePtrPtr;
520 operator const Data& ()
const {
return handle_;}
Abstract base class for read-only data.
read-only ImageHandle implementation
ConstImageHandle()
Empty, ie invalid handle.
bool operator==(const ConstImageHandle &ih) const
PixelSampling & Sampling()
see ImageHandle::Sampling()
DataDomain GetDomain() const
see ImageHandle::GetDomain()
void Detach(DataObserver *o) const
see ImageHandle::Detach()
void Attach(DataObserver *o) const
see ImageHandle::Attach()
Extent GetExtent() const
see ImageHandle::GetExtent()
ConstImageHandle & operator=(const ConstImageHandle &h)
Assign another image based on handle.
long MemSize() const
Returns size in bytes of allocated memory.
Complex GetComplex(const Point &p) const
see ImageHandle::GetComplex()
ConstImageHandle(const ImageHandle &h)
Initialize with an existing non-const handle.
void Notify(const Point &p) const
ConstImageHandle & operator=(const ImageHandle &h)
Assign another image based on a non-const handle.
Point GetSpatialOrigin() const
see ImageHandle::GetSpatialOrigin()
ExtentIterator GetIterator() const
Get ExtentIterator.
ImageHandle Extract(const Extent &e) const
see ImageHandle::Copy(const Extent&)
virtual Complex GetIntpolComplex(const Real &d) const
bool operator!=(const ConstImageHandle &ih) const
ImageHandle StateApply(const ImageStateConstModOPVisitorBase &v) const
see ImageHandle::StateApply(ImageStateConstModOPVisitorBase&)
bool operator!=(const ImageHandle &ih) const
const ImageStateBasePtr & ImageStatePtr() const
Vec3 FractionalIndexToCoord(const Vec3 &p) const
See ImageHandle::FractionalIndexToCoord()
ImageHandle Apply(ModIPAlgorithm &a) const
see ImageHandle::Apply(ModIPAlgorithm&)
void Notify() const
see ImageHandle::Notify()
void Apply(NonModAlgorithm &a) const
see ImageHandle::Apply(NonModAlgorithm&)
virtual Complex GetIntpolComplex(const Vec2 &v) const
Real GetReal(const Point &p) const
see ImageHandle::GetReal()
Vec3 CoordToIndex(const Vec3 &c) const
see ImageHandle::CoordToIndex()
void Notify(const Extent &e) const
const PixelSampling & Sampling() const
see ImageHandle::Sampling()
ImageHandle Apply(const ConstModOPAlgorithm &a) const
see ImageHandle::Apply(const ConstModOPAlgorithm)
virtual Complex GetIntpolComplex(const Vec3 &v) const
Get interpolated complex value from 3D,2D or 1D vec.
Vec3 IndexToCoord(const Point &p) const
see ImageHandle::IndexToCoord()
ImageHandle Apply(const ConstModIPAlgorithm &a) const
see ImageHandle::Apply(const ConstModIPAlgorithm&)
bool IsValid() const
Returns true if handle is valid.
void ApplyIP(NonModAlgorithm &a) const
ImageHandle StateApply(ImageStateModOPVisitorBase &v) const
see ImageHandle::StateApply(ImageStateModOPVisitorBase&)
ImageHandle StateApply(const ImageStateConstModIPVisitorBase &v) const
see ImageHandle::StateApply(ImageStateConstModIPVisitorBase&)
ImageHandle StateApply(ImageStateMorphVisitorBase &v) const
see ImageHandle::StateApply(ImageStateMorphVisitorBase&)
bool operator==(const ImageHandle &ih) const
Vec3 GetAbsoluteOrigin() const
see ImageHandle::GetAbsoluteOrigin()
ConstImageHandle(const ConstImageHandle &h)
Initialize with an existing handle.
ImageHandle Apply(ModOPAlgorithm &a) const
see ImageHandle::Apply(ModOPAlgorithm)
ImageHandle StateApply(ImageStateModIPVisitorBase &v) const
see ImageHandle::StateApply(ImageStateModIPVisitorBase&)
DataType GetType() const
see ImageHandle::GetType()
virtual Real GetIntpolReal(const Real &d) const
void StateApply(ImageStateNonModVisitorBase &v) const
see ImageHandle::StateApply(ImageStateNonModVisitorBase&)
virtual Real GetIntpolReal(const Vec3 &v) const
Get interpolated real value from 3D,2D or 1D vec.
virtual Real GetIntpolReal(const Vec2 &v) const
In-place modification const algorithm.
out-of-place modification const algorithm
Abstract base class for data.
Abstract base class of data observer.
Defines lower and upper valid indices.
Manage shared instances of images.
virtual void Notify(const Extent &e) const
void ApplyIP(ModIPAlgorithm &a)
Apply in-place Algorithm in-place.
ImageHandle & operator+=(const ConstImageHandle &h)
void SetAbsoluteOrigin(const Vec3 &c)
Sets the absolute coordinate for the spatial origin of the image.
virtual void Notify() const
Notify each observer that state has changed.
void Set(const ImageHandle &h)
sets content of image to that of the given one
ImageHandle & operator*=(const Complex &v)
long MemSize() const
Returns size in bytes of allocated memory.
virtual void Detach(DataObserver *o) const
Detach observer.
friend ImageHandle DoCreateImage(const Extent &e, DataType type, DataDomain dom)
virtual Complex GetComplex(const Point &p) const
Retrieve value at given Point as a Complex.
ImageHandle(const ImageHandle &h)
Initialize with an existing handle.
void StateApplyIP(ImageStateModOPVisitorBase &v)
Applies out-of-place visitor in-place.
ImageHandle & operator/=(const Complex &v)
void StateApplyIP(const ImageStateConstModIPVisitorBase &v)
Applies in-place const visitor in-place.
void SetComplex(const Point &p, const Complex &c)
Set explicit complex value.
ImageHandle & operator-=(const Complex &v)
void ApplyIP(const ConstModOPAlgorithm &a)
Apply out-of-place const Algorithm in-place.
ExtentIterator GetIterator() const
Get ExtentIterator.
ImageHandle Extract(const Extent &e) const
return a handle to a new image containing a partial copy
virtual Complex GetIntpolComplex(const Real &d) const
ImageHandle StateApply(const ImageStateConstModOPVisitorBase &v) const
Applies out-of-place const visitor out-of-place.
ImageHandle(const StatePtrPtr &spp)
Initialization based on a StatePtrPtr.
ImageHandle()
Creates an empty, ie invalid handle.
ImageHandle Copy(bool cc=true) const
return a handle that manages a new instance of the image
static ImageHandle Create(const Extent &e, DataType type, DataDomain dom)
used by CreateImage factory function
void SetSpatialOrigin(const Point &p)
set spatial origin of image
void StateApplyIP(ImageStateMorphVisitorBase &v)
Applies morph visitor in-place.
bool operator!=(const ImageHandle &ih) const
virtual const PixelSampling & Sampling() const
see Data::Sampling()
void CenterSpatialOrigin()
set origin in center
const ImageStateBasePtr & ImageStatePtr() const
ImageHandle & operator-=(Real v)
Vec3 FractionalIndexToCoord(const Vec3 &p) const
Index to coordinate conversion.
virtual DataType GetType() const
Return data type: REAL or COMPLEX.
virtual Point GetSpatialOrigin() const
return spatial origin of the image
ImageHandle Apply(ModIPAlgorithm &a) const
Apply in-place Algorithm, return new image with modifications.
void Apply(NonModAlgorithm &a) const
Apply a const algorithm to this image.
virtual Real GetReal(const Point &p) const
Retrieve value at given Point as a Real.
virtual Complex GetIntpolComplex(const Vec2 &v) const
virtual Extent GetExtent() const
retrieve Extent
Vec3 CoordToIndex(const Vec3 &c) const
Convert coordinates back to (fractional) indices.
virtual DataDomain GetDomain() const
Return domain: SPATIAL, FREQUENCY or HALF_FREQUENCY.
void ApplyIP(const ConstModIPAlgorithm &a)
Apply in-place const Algorithm in-place.
ImageHandle & operator*=(const ConstImageHandle &h)
ImageHandle & operator/=(Real v)
ImageHandle Apply(const ConstModOPAlgorithm &a) const
Apply out-of-place const Algorithm.
virtual Complex GetIntpolComplex(const Vec3 &v) const
Get interpolated complex value from 3D,2D or 1D vec.
Vec3 IndexToCoord(const Point &p) const
Index to coordinate conversion.
ImageStateBasePtr & ImageStatePtr()
ImageHandle & operator/=(const ConstImageHandle &h)
ImageHandle Apply(const ConstModIPAlgorithm &a) const
Apply in-place const Algorithm, return new image with modifications.
bool IsValid() const
Returns true if handle is valid.
void ApplyIP(NonModAlgorithm &a) const
Apply a const algorithm to this image.
ImageHandle & operator+=(Real v)
ImageHandle StateApply(ImageStateModOPVisitorBase &v) const
Applies out-of-place visitor out-of-place.
ImageHandle & operator-=(const ConstImageHandle &h)
virtual PixelSampling & Sampling()
see Data::Sampling()
ImageHandle & operator+=(const Complex &v)
void ApplyIP(ModOPAlgorithm &a)
Apply out-of-place Algorithm in-place.
ImageHandle StateApply(const ImageStateConstModIPVisitorBase &v) const
Applies in-place const visitor out-of-place.
void StateApplyIP(ImageStateModIPVisitorBase &v)
Applies in-place visitor in-place.
void SetReal(const Point &p, Real r)
ImageHandle StateApply(ImageStateMorphVisitorBase &v) const
Applies morph visitor out-of-place.
void Swap(ImageHandle &h)
swap guts with another handle
bool operator==(const ImageHandle &ih) const
Vec3 GetAbsoluteOrigin() const
Get absolute coordinate for the spatial origin of the image.
void Paste(const Data &d)
pastes given data to this image, using data extent
ImageHandle & operator=(const ImageHandle &h)
Assign another image based on handle.
virtual void Attach(DataObserver *o) const
Attach observer.
void StateApplyIP(const ImageStateConstModOPVisitorBase &v)
Applies out-of-place const visitor in-place.
void Reset(const Extent &e, DataType type=REAL, DataDomain dom=SPATIAL)
Reset image state to given size, type and domain.
ImageHandle Apply(ModOPAlgorithm &a) const
Apply out-of-place Algorithm.
ImageHandle & operator*=(Real v)
ImageHandle StateApply(ImageStateModIPVisitorBase &v) const
Applies in-place visitor out-of-place.
virtual Real GetIntpolReal(const Real &d) const
void StateApply(ImageStateNonModVisitorBase &v) const
Apply non-modifying state visitor.
virtual void Notify(const Point &p) const
virtual Real GetIntpolReal(const Vec3 &v) const
Get interpolated real value from 3D,2D or 1D vec.
virtual Real GetIntpolReal(const Vec2 &v) const
Exception thrown upon invalid image handle usage.
In-place modification algorithm.
out-of-place modification algorithm
Non-modifying Algorithm, abstract base class.
templated observable class
Helper class to handle pixel sampling.
class encapsulating 1D to 3D point
in-place modifying image state const visitor base class
out-of-place modifying image state const visitor base class
in-place modifying image state visitor base class
out-of-place modifying image state visitor base class
morphing image state visitor base class
non-modifying image state visitor base class
#define DLLEXPORT_OST_IMG_BASE
std::complex< Real > Complex
boost::shared_ptr< ImageStateBase > ImageStateBasePtr
DLLEXPORT_OST_IMG_BASE ImageHandle operator/(const ConstImageHandle &h, Real v)
DLLEXPORT_OST_IMG_BASE ImageHandle operator*(const ConstImageHandle &h, Real v)
DataDomain
underlying data type
DLLEXPORT_OST_IMG_BASE ImageHandle operator-(const ConstImageHandle &h, Real v)
DLLEXPORT_OST_IMG_BASE bool operator!=(const ImageHandle &lhs, const ConstImageHandle &rhs)
DLLEXPORT_OST_IMG_BASE ImageHandle operator+(const ConstImageHandle &h, Real v)
DLLEXPORT_OST_IMG_BASE bool operator==(const ImageHandle &lhs, const ConstImageHandle &rhs)