IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
DiskImage.h
1 // DiskImage.h:
3 // ------------
4 //
14 
15 #ifndef __IPSDKIMAGE_DISKIMAGE_H__
16 #define __IPSDKIMAGE_DISKIMAGE_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::image::DiskImage::_pDiskImageAccessor' : class 'boost::shared_ptr<T>' needs to have dll-interface to be used by clients of class 'ipsdk::image::DiskImage'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
23 #include <IPSDKImage/Image/BaseCompleteImage.h>
25 #include <boost/shared_array.hpp>
26 
27 namespace ipsdk {
28 namespace image {
29 
32 
34 {
35  // declare serial class
37 
38  // friend class for protected members access
39  friend boost::shared_ptr<DiskImage> boost::make_shared<DiskImage>();
40 
41 // predefined public types
42 public:
44  static const eImageType::domain g_imageType = eImageType::eIT_Disk;
45 
46 protected:
48  DiskImage();
49 
50 public:
52  ~DiskImage();
53 
54 // methods
55 public:
57  eImageType getImageType() const;
58 
60  ipBool isGpuImage() const;
61 
63  ipBool isDiskImage() const;
64 
71  BoolResult init(const DiskImageAccessorPtr& pDiskImageAccessor);
72 
75  virtual BoolResult init(const BaseImageGeometry& geometry);
76 
78  BoolResult fromSubImage(const PlanStorageColl3d& imagePlans);
79 
82  eImageAccessMode getAccessMode() const;
83 
86  const BaseDiskImageAccessor& getDiskImageAccessor() const;
87 
90  const boost::filesystem::path& getFilePath() const;
91 
96  BoolResult resize(const BaseImageGeometry& geometry);
97 
100  ipsdk::image::ImagePtr loadPlan(const ipUInt64 z, const ipUInt64 c, const ipUInt64 t,
101  const ipUInt64 sizeX = 0, const ipUInt64 sizeY = 0,
102  const ipUInt64 offsetX = 0, const ipUInt64 offsetY = 0,
103  const ipUInt64 strideX = 1, const ipUInt64 strideY = 1) const;
104 
107  ipsdk::image::ImagePtr loadColorPlan(const ipUInt64 z, const ipUInt64 t,
108  const ipUInt64 sizeX = 0, const ipUInt64 sizeY = 0,
109  const ipUInt64 offsetX = 0, const ipUInt64 offsetY = 0,
110  const ipUInt64 strideX = 1, const ipUInt64 strideY = 1) const;
111 
114  ipReal64 readPixel(const ipUInt64 x, const ipUInt64 y, const ipUInt64 z = 0, const ipUInt64 c = 0, const ipUInt64 t = 0);
115 
118  BoolResult writePixel(const ipReal64 value, const ipUInt64 x, const ipUInt64 y, const ipUInt64 z=0, const ipUInt64 c=0, const ipUInt64 t=0);
119 
120 protected:
122  void createImagePlans(const BaseImageGeometry& geometry,
123  PlanStorageColl3d& imagePlans);
124 
126  void clearDerived();
127 
129  template <typename T>
130  BoolResult loadToMemory(const PlanStorageConstPtr pPlanStorage,
131  const ipUInt64 offsetX, const ipUInt64 offsetY,
132  const ipUInt64 strideX, const ipUInt64 strideY,
133  const ipUInt64 sizeX, const ipUInt64 sizeY,
134  const ipUInt64 imageSizeX, const ipUInt64 imageSizeY,
135  T* pBuffer) const;
136 
138  template <typename T>
139  BoolResult readPixelValue(ipReal64& value, const ipUInt64 x, const ipUInt64 y, const ipUInt64 sizeX, const PlanStoragePtr pPlanStorage);
140 
142  template <typename T>
143  BoolResult writePixelValue(const ipReal64 value, const ipUInt64 x, const ipUInt64 y, const ipUInt64 sizeX, const PlanStoragePtr pPlanStorage);
144 
145 // attributes
146 protected:
149 };
150 
153 
154 inline eImageType
156 {
157  return g_imageType;
158 }
159 
160 inline ipBool
162 {
163  return false;
164 }
165 
166 inline ipBool
168 {
169  return true;
170 }
171 
174 
175 } // end of namespace image
176 } // end of namespace ipsdk
177 
178 #pragma warning (pop)
179 
180 #endif // __IPSDKIMAGE_DISKIMAGE_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Predefined types for image file manipulation.
Base class for image files accessors.
Definition: BaseDiskImageAccessor.h:31
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
boost::shared_ptr< BaseDiskImageAccessor > DiskImageAccessorPtr
shared pointer to disk image accessor
Definition: DiskImageTypes.h:23
boost::shared_ptr< BaseImage > ImagePtr
Definition: ImageTypes.h:139
ipBool isGpuImage() const
returns true if the image is loaded on GPU
Definition: DiskImage.h:161
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
DiskImageAccessorPtr _pDiskImageAccessor
pointer to image file accessor
Definition: DiskImage.h:148
eImageType getImageType() const
retrieve image type
Definition: DiskImage.h:155
Base class for image geometry.
Definition: BaseImageGeometry.h:38
IPSDKIMAGE_API ImageGeometryPtr geometry(const eImageBufferType &imageBufferType, const ipUInt64 sizeX, const ipUInt64 sizeY, const VolumeGeometry &volumeGeometry, const ColorGeometry &colorGeometry, const TemporalGeometry &temporalGeometry)
create an image geometry
disk image
Definition: ImageTypes.h:62
Image class with disk data storage support.
Definition: DiskImage.h:33
#define IPSDK_DECLARE_SERIAL_WITHOUT_COPY(libraryName, className)
macro enabling serialization on class
Definition: SerializationHdrMacro.h:79
boost::shared_ptr< const BasePlanStorage > PlanStorageConstPtr
shared pointer to const image plan storage
Definition: PlanStorageTypes.h:58
eImageType
Enumerate describing image type.
Definition: ImageTypes.h:58
std::vector< PlanStorageColl2d > PlanStorageColl3d
Definition: ImageTypes.h:196
#define IPSDKIMAGE_API
Import/Export macro for library IPSDKImage.
Definition: IPSDKImageExports.h:27
ipBool isDiskImage() const
returns true if the image is a disk one
Definition: DiskImage.h:167
bool ipBool
Base types definition.
Definition: BaseTypes.h:47
boost::shared_ptr< BasePlanStorage > PlanStoragePtr
shared pointer to image plan storage
Definition: PlanStorageTypes.h:55
static const eImageType::domain g_imageType
type associated to attribute
Definition: DiskImage.h:44
Base class for complete images.
Definition: BaseCompleteImage.h:34
eImageAccessMode
Image access mode.
Definition: ImageTypes.h:110