GDCM 2.2.0

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

- File List
- File Members

gdcmWriter.h
Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004
    00005   Copyright (c) 2006-2011 Mathieu Malaterre
    00006   All rights reserved.
    00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00008
    00009      This software is distributed WITHOUT ANY WARRANTY; without even
    00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00011      PURPOSE.  See the above copyright notice for more information.
    00012
    00013 =========================================================================*/
    00014
    00015 #ifndef GDCMWRITER_H
    00016 #define GDCMWRITER_H
    00017
    00018 #include "gdcmFile.h"
    00019
    00020 namespace gdcm
    00021 {
    00022
    00023 class FileMetaInformation;
    00048 class GDCM_EXPORT Writer
    00049 {
    00050 public:
    00051   Writer();
    00052   virtual ~Writer();
    00053
    00055   virtual bool Write(); // Execute()
    00056
    00058   void SetFileName(const char *filename_native);
    00059
    00061   void SetStream(std::ostream &output_stream) {
    00062     Stream = &output_stream;
    00063   }
    00064
    00066   void SetFile(const File& f) { F = f; }
    00067   File &GetFile() { return *F; }
    00068
    00070   void SetCheckFileMetaInformation(bool b) { CheckFileMetaInformation = b; }
    00071   void CheckFileMetaInformationOff() { CheckFileMetaInformation = false; }
    00072   void CheckFileMetaInformationOn() { CheckFileMetaInformation = true; }
    00073
    00074 protected:
    00075   void SetWriteDataSetOnly(bool b) { WriteDataSetOnly = b; }
    00076
    00077 protected:
    00078   friend class StreamImageWriter;
    00079   //this function is added for the StreamImageWriter, which needs to write
    00080   //up to the pixel data and then stops right before writing the pixel data.
    00081   //after that, for the raw codec at least, zeros are written for the length of the data
    00082   std::ostream* GetStreamPtr() const { return Stream; }
    00083
    00084 protected:
    00085   std::ostream *Stream;
    00086   std::ofstream *Ofstream;
    00087
    00088 private:
    00089   SmartPointer<File> F;
    00090   bool CheckFileMetaInformation;
    00091   bool WriteDataSetOnly;
    00092 };
    00093
    00094 } // end namespace gdcm
    00095
    00096 #endif //GDCMWRITER_H