GDCM 2.2.1

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

- File List
- File Members

gdcmWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14
15 #ifndef GDCMWRITER_H
16 #define GDCMWRITER_H
17
18 #include "gdcmFile.h"
19
20 namespace gdcm
21 {
22
23 class FileMetaInformation;
48 class GDCM_EXPORT Writer
49 {
50 public:
51 Writer();
52 virtual ~Writer();
53
55 virtual bool Write(); // Execute()
56
58 void SetFileName(const char *filename_native);
59
61 void SetStream(std::ostream &output_stream) {
62 Stream = &output_stream;
63 }
64
66 void SetFile(const File& f) { F = f; }
67 File &GetFile() { return *F; }
68
70 void SetCheckFileMetaInformation(bool b) { CheckFileMetaInformation = b; }
71 void CheckFileMetaInformationOff() { CheckFileMetaInformation = false; }
72 void CheckFileMetaInformationOn() { CheckFileMetaInformation = true; }
73
74 protected:
75 void SetWriteDataSetOnly(bool b) { WriteDataSetOnly = b; }
76
77 protected:
78 friend class StreamImageWriter;
79 //this function is added for the StreamImageWriter, which needs to write
80 //up to the pixel data and then stops right before writing the pixel data.
81 //after that, for the raw codec at least, zeros are written for the length of the data
82 std::ostream* GetStreamPtr() const { return Stream; }
83
84 protected:
85 std::ostream *Stream;
86 std::ofstream *Ofstream;
87
88 private:
89 SmartPointer<File> F;
90 bool CheckFileMetaInformation;
91 bool WriteDataSetOnly;
92 };
93
94 } // end namespace gdcm
95
96 #endif //GDCMWRITER_H