GDCM 3.2.1

gdcmStreamImageWriter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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
gdcm::File
a DICOM File
Definition gdcmFile.h:34
gdcm::MediaStorage
MediaStorage.
Definition gdcmMediaStorage.h:44
gdcm::RAWCodec
RAWCodec class.
Definition gdcmRAWCodec.h:27
gdcm::SmartPointer
Class for Smart Pointer.
Definition gdcmSmartPointer.h:40
gdcm::StreamImageWriter::StreamImageWriter
StreamImageWriter()
gdcm::StreamImageWriter::mZMin
uint16_t mZMin
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::mElementOffsets1
int mElementOffsets1
Definition gdcmStreamImageWriter.h:138
gdcm::StreamImageWriter::mXMax
uint16_t mXMax
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::SetFile
void SetFile(const File &inFile)
gdcm::StreamImageWriter::CanWriteFile
bool CanWriteFile() const
gdcm::StreamImageWriter::DefinePixelExtent
void DefinePixelExtent(uint16_t inXMin, uint16_t inXMax, uint16_t inYMin, uint16_t inYMax, uint16_t inZMin=0, uint16_t inZMax=1)
gdcm::StreamImageWriter::WriteRawHeader
int WriteRawHeader(RAWCodec *inCodec, std::ostream *inStream)
gdcm::StreamImageWriter::mXMin
uint16_t mXMin
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::mspFile
SmartPointer< File > mspFile
Definition gdcmStreamImageWriter.h:109
gdcm::StreamImageWriter::DefineProperBufferLength
uint32_t DefineProperBufferLength()
gdcm::StreamImageWriter::mWriter
Writer mWriter
Definition gdcmStreamImageWriter.h:105
gdcm::StreamImageWriter::~StreamImageWriter
virtual ~StreamImageWriter()
gdcm::StreamImageWriter::mYMin
uint16_t mYMin
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::mElementOffsets
int mElementOffsets
Definition gdcmStreamImageWriter.h:137
gdcm::StreamImageWriter::SetStream
void SetStream(std::ostream &inStream)
gdcm::StreamImageWriter::Write
bool Write(void *inWriteBuffer, const std::size_t &inBufferLength)
gdcm::StreamImageWriter::mZMax
uint16_t mZMax
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::WriteImageSubregionRAW
virtual bool WriteImageSubregionRAW(char *inWriteBuffer, const std::size_t &inBufferLength)
gdcm::StreamImageWriter::WriteImageInformation
virtual bool WriteImageInformation()
gdcm::StreamImageWriter::SetFileName
void SetFileName(const char *inFileName)
gdcm::StreamImageWriter::mYMax
uint16_t mYMax
Definition gdcmStreamImageWriter.h:113
gdcm::Writer
Writer ala DOM (Document Object Model)
Definition gdcmWriter.h:49
gdcmDataSet.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcmWriter.h
gdcm
Definition gdcmASN1.h:21