ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ReaderImpl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Stan Coleby (scoleby@intelisum.com)
3  * Copyright (c) 2020 PTC Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person or organization
6  * obtaining a copy of the software and accompanying documentation covered by
7  * this license (the "Software") to use, reproduce, display, distribute,
8  * execute, and transmit the Software, and to prepare derivative works of the
9  * Software, and to permit third-parties to whom the Software is furnished to
10  * do so, all subject to the following:
11  *
12  * The copyright notices in the Software and this entire statement, including
13  * the above license grant, this restriction and the following disclaimer,
14  * must be included in all copies of the Software, in whole or in part, and
15  * all derivative works of the Software, unless such copies or derivative
16  * works are solely in the form of machine-executable object code generated by
17  * a source language processor.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  * DEALINGS IN THE SOFTWARE.
26  */
27 
28 #pragma once
29 
30 #include "E57SimpleData.h"
31 
32 namespace e57
33 {
34 
36  class ReaderImpl
37  {
38  public:
39  ReaderImpl( const ustring &filePath );
40 
41  ~ReaderImpl();
42 
43  bool IsOpen() const;
44 
45  bool Close();
46 
47  bool GetE57Root( E57Root &fileHeader ) const;
48 
49  int64_t GetImage2DCount() const;
50 
51  bool ReadImage2D( int64_t imageIndex, Image2D &Image2DHeader ) const;
52 
53  bool GetImage2DSizes( int64_t imageIndex, Image2DProjection &imageProjection, Image2DType &imageType,
54  int64_t &imageWidth, int64_t &imageHeight, int64_t &imageSize, Image2DType &imageMaskType,
55  Image2DType &imageVisualType ) const;
56 
57  int64_t ReadImage2DData( int64_t imageIndex, Image2DProjection imageProjection, Image2DType imageType,
58  void *pBuffer, int64_t start, int64_t count ) const;
59 
60  int64_t GetData3DCount() const;
61 
62  bool ReadData3D( int64_t dataIndex, Data3D &data3DHeader ) const;
63 
64  bool GetData3DSizes( int64_t dataIndex, int64_t &rowMax, int64_t &columnMax, int64_t &pointsSize,
65  int64_t &groupsSize, int64_t &countSize, bool &bColumnIndex ) const;
66 
67  bool ReadData3DGroupsData( int64_t dataIndex, int64_t groupCount, int64_t *idElementValue,
68  int64_t *startPointIndex, int64_t *pointCount ) const;
69 
70  template <typename COORDTYPE>
71  CompressedVectorReader SetUpData3DPointsData( int64_t dataIndex, size_t pointCount,
72  const Data3DPointsData_t<COORDTYPE> &buffers ) const;
73 
75 
76  VectorNode GetRawData3D() const;
77 
78  VectorNode GetRawImages2D() const;
79 
80  ImageFile GetRawIMF() const;
81 
82  private:
83  ImageFile imf_;
84  StructureNode root_;
85 
86  VectorNode data3D_;
87 
88  VectorNode images2D_;
89 
98  bool GetImage2DNodeSizes( StructureNode image, Image2DType &imageType, int64_t &imageWidth, int64_t &imageHeight,
99  int64_t &imageSize, Image2DType &imageMaskType ) const;
100 
108  int64_t ReadImage2DNode( StructureNode image, Image2DType imageType, void *pBuffer, int64_t start,
109  int64_t count ) const;
110  }; // end Reader class
111 
112 } // end namespace e57
Data structures for E57 Simple API.
std::shared_ptr< core::Tensor > image
int count
most of the functions follows Reader
Definition: ReaderImpl.h:37
bool GetImage2DSizes(int64_t imageIndex, Image2DProjection &imageProjection, Image2DType &imageType, int64_t &imageWidth, int64_t &imageHeight, int64_t &imageSize, Image2DType &imageMaskType, Image2DType &imageVisualType) const
Definition: ReaderImpl.cpp:411
ReaderImpl(const ustring &filePath)
Definition: ReaderImpl.cpp:33
bool GetData3DSizes(int64_t dataIndex, int64_t &rowMax, int64_t &columnMax, int64_t &pointsSize, int64_t &groupsSize, int64_t &countSize, bool &bColumnIndex) const
bool ReadData3DGroupsData(int64_t dataIndex, int64_t groupCount, int64_t *idElementValue, int64_t *startPointIndex, int64_t *pointCount) const
VectorNode GetRawImages2D() const
Definition: ReaderImpl.cpp:529
int64_t ReadImage2DData(int64_t imageIndex, Image2DProjection imageProjection, Image2DType imageType, void *pBuffer, int64_t start, int64_t count) const
Definition: ReaderImpl.cpp:463
int64_t GetData3DCount() const
Definition: ReaderImpl.cpp:514
StructureNode GetRawE57Root() const
Definition: ReaderImpl.cpp:519
bool IsOpen() const
Definition: ReaderImpl.cpp:48
bool ReadData3D(int64_t dataIndex, Data3D &data3DHeader) const
Definition: ReaderImpl.cpp:539
bool GetE57Root(E57Root &fileHeader) const
Definition: ReaderImpl.cpp:66
bool ReadImage2D(int64_t imageIndex, Image2D &Image2DHeader) const
Definition: ReaderImpl.cpp:109
int64_t GetImage2DCount() const
Definition: ReaderImpl.cpp:103
ImageFile GetRawIMF() const
Definition: ReaderImpl.cpp:534
VectorNode GetRawData3D() const
Definition: ReaderImpl.cpp:524
CompressedVectorReader SetUpData3DPointsData(int64_t dataIndex, size_t pointCount, const Data3DPointsData_t< COORDTYPE > &buffers) const
Image2DProjection
Identifies the representation for the image data.
Image2DType
Identifies the format representation for the image data.
std::string ustring
UTF-8 encodeded Unicode string.
Definition: E57Format.h:54
Stores pointers to user-provided buffers.
Stores the top-level information for a single lidar scan.
Stores the top-level information for the XML section of the file.
Stores an image from a camera.