GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmStreamImageReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18 #ifndef GDCMSTREAMIMAGEREADER_H
19 #define GDCMSTREAMIMAGEREADER_H
20
21 #include "gdcmReader.h"
22
23 namespace gdcm
24 {
25
26 class MediaStorage;
38 class GDCM_EXPORT StreamImageReader
39 {
40
41 public:
42 StreamImageReader();
43 virtual ~StreamImageReader();
44
48 void SetFileName(const char* inFileName);
49 void SetStream(std::istream& inStream);
50
51 std::vector<unsigned int> GetDimensionsValueForResolution( unsigned int );
52
60 void DefinePixelExtent(uint16_t inXMin, uint16_t inXMax,
61 uint16_t inYMin, uint16_t inYMax, uint16_t inZMin = 0, uint16_t inZMax = 1);
62
67 uint32_t DefineProperBufferLength() const;
68
76 bool Read(char* inReadBuffer, const std::size_t& inBufferLength);
77
83 bool CanReadImage() const;
84
88 virtual bool ReadImageInformation();
89
93 File const & GetFile() const;
94
95 protected:
96 private:
97 //contains a reader for being able to ReadUpToTag
98 //however, we don't want the user to be able to call Read
99 //either directly or via a parent class call, so we hide the reader in here.
100 Reader mReader;
101
102 std::streamoff mFileOffset; //the file offset for getting header information
103 std::streamoff mFileOffset1;
104 DataSet mHeaderInformation; //all the non-pixel information
105
106 //for thread safety, these should not be stored here, but should be used
107 //for every read subregion operation.
108 uint16_t mXMin, mYMin, mXMax, mYMax, mZMin, mZMax;
109
114 bool ReadImageSubregionRAW(char* inReadBuffer, const std::size_t& inBufferLength);
115
118 bool ReadImageSubregionJpegLS(char* inReadBuffer, const std::size_t& inBufferLength);
119 };
120
121 } // end namespace gdcm
122
123 #endif //GDCMSTREAMIMAGEREADER_H
124