GDCM 2.2.1

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

- File List
- File Members

gdcmStreamImageWriter.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
19 #ifndef GDCMSTREAMIMAGEWRITER_H
20 #define GDCMSTREAMIMAGEWRITER_H
21
22 #include "gdcmWriter.h"
23 #include <iostream>
24 #include "gdcmDataSet.h"
25
26 namespace gdcm
27 {
28
29 class MediaStorage;
30 class RAWCodec;
42 class GDCM_EXPORT StreamImageWriter
43 {
44
45 public:
46 StreamImageWriter();
47 virtual ~StreamImageWriter();
48
49
53 void SetFileName(const char* inFileName);
54 void SetStream(std::ostream& inStream);
55
64 void DefinePixelExtent(uint16_t inXMin, uint16_t inXMax,
65 uint16_t inYMin, uint16_t inYMax, uint16_t inZMin = 0, uint16_t inZMax = 1);
66
67
73 uint32_t DefineProperBufferLength();
74
82 bool Write(void* inWriteBuffer, const std::size_t& inBufferLength);
83
87 virtual bool WriteImageInformation();
88
92 bool CanWriteFile() const;
93
94
97 void SetFile(const File& inFile);
98
99 protected:
100
101 //contains the PrepareWrite function, which will get the given dataset ready
102 //for writing to disk by manufacturing the header information.
103 //note that if there is a pixel element in the given dataset, that will be removed
104 //during the copy, so that the imagewriter can write everything else out
105 Writer mWriter;
106
107 //is the offset necessary if we always append?
108 //std::streamoff mFileOffset; //the fileoffset for getting header information
109 SmartPointer<File> mspFile; //all the non-pixel information
110
111 //for thread safety, these should not be stored here, but should be used
112 //for every read subregion operation.
113 uint16_t mXMin, mYMin, mXMax, mYMax, mZMin, mZMax;
114
119 //virtual bool ReadImageSubregionRAW(std::ostream& os);
120 virtual bool WriteImageSubregionRAW(char* inWriteBuffer, const std::size_t& inBufferLength);
121
131 int WriteRawHeader(RAWCodec* inCodec, std::ostream* inStream);
132
137 int mElementOffsets;
138 int mElementOffsets1;
139
140 };
141
142
143 } // end namespace gdcm
144
145 #endif //GDCMSTREAMIMAGEWRITER_H