IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Im6ImageFile.h
1 // Im6ImageFile.h:
3 // ---------------
4 //
13 
14 #ifndef __IPSDKIMAGEFILE_IM6IMAGEFILE_H__
15 #define __IPSDKIMAGEFILE_IM6IMAGEFILE_H__
16 
17 // suppression warnings
18 // warning C4251: 'ipsdk::image::file::Im6ImageFile::_stream' : class 'std::basic_fstream<_Elem,_Traits>' needs to have dll-interface to be used by clients of class 'ipsdk::image::file::Im6ImageFile'
19 #pragma warning (push)
20 #pragma warning (disable : 4251)
21 
24 #include <IPSDKImage/Accessor/BaseDiskImageAccessor.h>
25 #include <boost/tuple/tuple.hpp>
26 #include <boost/shared_ptr.hpp>
27 #include <boost/thread/mutex.hpp>
28 #include <boost/thread/thread.hpp>
29 #include <fstream>
30 #include <map>
31 #include <vector>
32 
33 namespace ipsdk {
34 namespace image {
35 namespace file {
36 
39 
41 {
42  // declare serial class
44 
45 public:
48  Im6ImageFile();
49  ~Im6ImageFile();
51 
52 // methods
53 public:
57  bool hasBinary8BitsStorage() const;
58 
61  BoolResult openFile(const boost::filesystem::path& filePath,
62  const eImageAccessMode& accessMode);
63 
66  BoolResult openSharedRemoteFile(const boost::filesystem::path& filePath,
67  const eImageAccessMode& accessMode);
68 
69 protected:
72  BoolResult openFileInternal(const boost::filesystem::path& filePath,
73  const eImageAccessMode& accessMode,
74  const bool bSharedRemoteAccess);
75 
78  ipUInt64 processOffsets(const ipUInt64 dataStartOffset,
80 
83  BoolResult resizeData(const BaseImageGeometry& geometry);
84 
92  BoolResult readRawData(const ipUInt64 zPlanIdx,
93  const ipUInt64 cPlanIdx,
94  const ipUInt64 tPlanIdx,
95  const ipUInt64 pixelStartOffset,
96  const ipUInt64 nbPixels,
97  void* pData) const;
98 
100  ImageGeometryPtr headerToGeometry(const HeaderData& headerData);
101 
103  GeometricCalibrationPtr calibDataToGeometricCalibration(const HeaderData& headerData, const CalibrationData& calibData, const ipBool bIs2d);
104 
112  BoolResult writeRawData(const ipUInt64 zPlanIdx,
113  const ipUInt64 cPlanIdx,
114  const ipUInt64 tPlanIdx,
115  const ipUInt64 pixelStartOffset,
116  const ipUInt64 nbPixels,
117  const void* pData);
118 
120  void clearDerived();
121 
123  typedef boost::shared_ptr<std::fstream> FStreamPtr;
124 
128  BoolResult findThreadFStream(FStreamPtr& pFStream) const;
129 
131  ipBool fileContainsGeometricCalibration(const HeaderData& headerData, const ipUInt64 imageNeededSize, FStreamPtr& pFStream);
132 
133 // attributes
134 protected:
136  typedef boost::tuple<ipUInt64, ipUInt64, ipUInt64> PlanIdentifier;
137 
139  typedef std::map<PlanIdentifier, ipUInt64> OffsetColl;
140 
143 
145  typedef std::map<boost::thread::id, FStreamPtr> FStreamColl;
146 
149 
151  void* _handle;
152 
154  mutable boost::mutex _mutex;
155 };
156 
159 
160 } // end of namespace file
161 } // end of namespace image
162 } // end of namespace ipsdk
163 
164 #pragma warning (pop)
165 
166 #endif // __IPSDKIMAGEFILE_IM6IMAGEFILE_H__
OffsetColl _offsetColl
collection of offset for each image plans
Definition: Im6ImageFile.h:142
std::map< PlanIdentifier, ipUInt64 > OffsetColl
collection of plan offsets definition
Definition: Im6ImageFile.h:139
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Base class for image files accessors.
Definition: BaseDiskImageAccessor.h:31
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
std::map< boost::thread::id, FStreamPtr > FStreamColl
collection of file streams
Definition: Im6ImageFile.h:145
void * _handle
file handle used under windows
Definition: Im6ImageFile.h:151
#define IPSDKIMAGEFILE_API
Import/Export macro for library IPSDKImageFile.
Definition: IPSDKImageFileExports.h:27
boost::shared_ptr< std::fstream > FStreamPtr
shared pointer to file stream
Definition: Im6ImageFile.h:123
boost::shared_ptr< ipsdk::GeometricCalibration > GeometricCalibrationPtr
shared pointer to ipsdk::GeometricCalibration
Definition: GeometricCalibrationTypes.h:22
Definition of import/export macro for library.
Base class for image geometry.
Definition: BaseImageGeometry.h:38
boost::tuple< ipUInt64, ipUInt64, ipUInt64 > PlanIdentifier
plan identifier composed of t, c and z indexes
Definition: Im6ImageFile.h:136
shared pointer to file stream
Definition: Im6ImageFileTypes.h:36
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
#define IPSDK_DECLARE_SERIAL_WITHOUT_COPY(libraryName, className)
macro enabling serialization on class
Definition: SerializationHdrMacro.h:79
boost::mutex _mutex
mutex used for protection against thread concurrent accesses
Definition: Im6ImageFile.h:154
bool ipBool
Base types definition.
Definition: BaseTypes.h:47
Class for im6 disk image access.
Definition: Im6ImageFile.h:40
FStreamColl _fStreamColl
collection of thread file streams associated to object
Definition: Im6ImageFile.h:148
Definition: Im6ImageFileTypes.h:79
boost::shared_ptr< BaseImageGeometry > ImageGeometryPtr
shared pointer to image geometry
Definition: ImageGeometryTypes.h:55
eImageAccessMode
Image access mode.
Definition: ImageTypes.h:110
Predefined types for Im6ImageFile management.