gdcm::Writer Class Reference

Writer ala DOM (Document Object Model). More...

`#include <gdcmWriter.h>`

Inheritance diagram for gdcm::Writer:
[legend]
Collaboration diagram for gdcm::Writer:
[legend]

## Public Member Functions

| Writer ()
virtual | ~Writer ()
void | CheckFileMetaInformationOff ()
void | CheckFileMetaInformationOn ()
File & | GetFile ()
void | SetCheckFileMetaInformation (bool b)
| Undocumented function, do not use (= leave default).
void | SetFile (const File &f)
| Set/Get the DICOM file (DataSet + Header).
void | SetFileName (const char *filename_native)
| Set the filename of DICOM file to write:
void | SetStream (std::ostream &output_stream)
| Set user ostream buffer.
virtual bool | Write ()
| Main function to tell the writer to write.

## Protected Member Functions

bool | GetCheckFileMetaInformation () const
std::ostream * | GetStreamPtr () const
void | SetWriteDataSetOnly (bool b)

## Protected Attributes

std::ofstream * | Ofstream
std::ostream * | Stream

## Friends

class | StreamImageWriter

## Detailed Description

Writer ala DOM (Document Object Model).

This class is a non-validating writer, it will only performs well- formedness check only.

Detailed description here To avoid GDCM being yet another broken DICOM lib we try to be user level and avoid writing illegal stuff (odd length, non-zero value for Item start/end length ...) Therefore you cannot (well unless you are really smart) write DICOM with even length tag. All the checks are consider basics:

- Correct Meta Information Header (see gdcm::FileMetaInformation)
- Zero value for Item Length (0xfffe, 0xe00d/0xe0dd)
- Even length for any elements
- Alphabetical order for elements (guaranteed by design of internals)
- 32bits VR will be rewritten with 00

Warning
  gdcm::Writer cannot write a DataSet if no SOP Instance UID (0008,0018) is found, unless a DICOMDIR is being written out

See also
  Reader DataSet File

Examples
  ChangePrivateTags.cxx, ChangeSequenceUltrasound.cxx, ClinicalTrialAnnotate.cxx, CreateFakeRTDOSE.cxx, CreateJPIPDataSet.cxx, DeriveSeries.cxx, DuplicatePCDE.cxx, EncapsulateFileInRawData.cxx, Extracting_All_Resolution.cxx, Fake_Image_Using_Stream_Image_Writer.cxx, FixBrokenJ2K.cxx, FixJAIBugJPEGLS.cxx, FixOrientation.cxx, GenAllVR.cxx, GenFakeIdentifyFile.cxx, GenLongSeqs.cxx, GenSeqs.cxx, GenerateDICOMDIR.cs, HelloWorld.cxx, LargeVRDSExplicit.cxx, MakeTemplate.cxx, ManipulateFile.cs, NewSequence.cs, PatchFile.cxx, QIDO-RS.cxx, ReformatFile.cs, StreamImageReaderTest.cxx, pmsct_rgb1.cxx, and rle2img.cxx.

## Constructor & Destructor Documentation

## Writer()

gdcm::Writer::Writer | ( |  | ) |

## ~Writer()

virtual gdcm::Writer::~Writer | ( |  | ) |

virtual

## Member Function Documentation

## CheckFileMetaInformationOff()

void gdcm::Writer::CheckFileMetaInformationOff | ( |  | ) |

inline

Examples
  CreateFakeRTDOSE.cxx, FixBrokenJ2K.cxx, and HelloWorld.cxx.

## CheckFileMetaInformationOn()

void gdcm::Writer::CheckFileMetaInformationOn | ( |  | ) |

inline

## GetCheckFileMetaInformation()

bool gdcm::Writer::GetCheckFileMetaInformation | ( |  | ) | const

inline protected

## GetFile()

File & gdcm::Writer::GetFile | ( |  | ) |

inline

Examples
  CreateJPIPDataSet.cxx, EncapsulateFileInRawData.cxx, Extracting_All_Resolution.cxx, Fake_Image_Using_Stream_Image_Writer.cxx, GenAllVR.cxx, GenFakeIdentifyFile.cxx, GetSubSequenceData.cxx, MpegVideoInfo.cs, QIDO-RS.cxx, StreamImageReaderTest.cxx, TemplateEmptyImage.cxx, iU22tomultisc.cxx, pmsct_rgb1.cxx, and rle2img.cxx.

## GetStreamPtr()

std::ostream * gdcm::Writer::GetStreamPtr | ( |  | ) | const

inline protected

References Stream.

## SetCheckFileMetaInformation()

void gdcm::Writer::SetCheckFileMetaInformation | ( | bool | b | ) |

inline

Undocumented function, do not use (= leave default).

Examples
  GenAllVR.cxx, GenFakeIdentifyFile.cxx, and PatchFile.cxx.

## SetFile()

void gdcm::Writer::SetFile | ( | const File & | f | ) |

inline

Set/Get the DICOM file (DataSet + Header).

Examples
  BasicAnonymizer.cs, BasicImageAnonymizer.cs, ChangePrivateTags.cxx, ChangeSequenceUltrasound.cxx, Cleaner.cs, ClinicalTrialAnnotate.cxx, ClinicalTrialIdentificationWorkflow.cs, CompressImage.cxx, CompressLossyJPEG.cs, CreateFakeRTDOSE.cxx, DecompressImage.cs, DeriveSeries.cxx, DuplicatePCDE.cxx, FixBrokenJ2K.cxx, FixJAIBugJPEGLS.cxx, FixOrientation.cxx, GenFakeImage.cxx, GenLongSeqs.cxx, GenSeqs.cxx, GenerateDICOMDIR.cs, HelloWorld.cxx, LargeVRDSExplicit.cxx, MakeTemplate.cxx, ManipulateFile.cs, MergeTwoFiles.cxx, NewSequence.cs, PatchFile.cxx, ReformatFile.cs, StandardizeFiles.cs, pmsct_rgb1.cxx, and rle2img.cxx.

## SetFileName()

void gdcm::Writer::SetFileName | ( | const char * | filename_native | ) |

Set the filename of DICOM file to write:

Examples
  BasicAnonymizer.cs, BasicImageAnonymizer.cs, ChangePrivateTags.cxx, ChangeSequenceUltrasound.cxx, Cleaner.cs, ClinicalTrialAnnotate.cxx, ClinicalTrialIdentificationWorkflow.cs, CompressImage.cxx, CompressLossyJPEG.cs, CreateARGBImage.cxx, CreateCMYKImage.cxx, CreateFakeRTDOSE.cxx, CreateJPIPDataSet.cxx, DecompressImage.cs, DeriveSeries.cxx, DuplicatePCDE.cxx, EncapsulateFileInRawData.cxx, FixBrokenJ2K.cxx, FixJAIBugJPEGLS.cxx, FixOrientation.cxx, GenAllVR.cxx, GenFakeIdentifyFile.cxx, GenFakeImage.cxx, GenLongSeqs.cxx, GenSeqs.cxx, GenerateDICOMDIR.cs, GetSubSequenceData.cxx, HelloVizWorld.cxx, HelloWorld.cxx, LargeVRDSExplicit.cxx, MakeTemplate.cxx, ManipulateFile.cs, MergeTwoFiles.cxx, MpegVideoInfo.cs, NewSequence.cs, PatchFile.cxx, QIDO-RS.cxx, ReformatFile.cs, StandardizeFiles.cs, TemplateEmptyImage.cxx, csa2img.cxx, iU22tomultisc.cxx, pmsct_rgb1.cxx, and rle2img.cxx.

## SetStream()

void gdcm::Writer::SetStream | ( | std::ostream & | output_stream | ) |

inline

Set user ostream buffer.

References Stream.

## SetWriteDataSetOnly()

void gdcm::Writer::SetWriteDataSetOnly | ( | bool | b | ) |

inline protected

## Write()

virtual bool gdcm::Writer::Write | ( |  | ) |

virtual

Main function to tell the writer to write.

Reimplemented in gdcm::ImageWriter, gdcm::PixmapWriter, gdcm::SegmentWriter, and gdcm::SurfaceWriter.

Examples
  BasicAnonymizer.cs, ChangePrivateTags.cxx, ChangeSequenceUltrasound.cxx, Cleaner.cs, ClinicalTrialAnnotate.cxx, ClinicalTrialIdentificationWorkflow.cs, CreateFakeRTDOSE.cxx, CreateJPIPDataSet.cxx, DeriveSeries.cxx, DuplicatePCDE.cxx, EncapsulateFileInRawData.cxx, FixBrokenJ2K.cxx, FixJAIBugJPEGLS.cxx, FixOrientation.cxx, GenAllVR.cxx, GenFakeIdentifyFile.cxx, GenLongSeqs.cxx, GenSeqs.cxx, GenerateDICOMDIR.cs, HelloWorld.cxx, LargeVRDSExplicit.cxx, MakeTemplate.cxx, ManipulateFile.cs, NewSequence.cs, PatchFile.cxx, QIDO-RS.cxx, ReformatFile.cs, pmsct_rgb1.cxx, and rle2img.cxx.

## Friends And Related Symbol Documentation

## StreamImageWriter

friend class StreamImageWriter

friend

References StreamImageWriter.

Referenced by StreamImageWriter.

## Member Data Documentation

## Ofstream

std::ofstream* gdcm::Writer::Ofstream

protected

## Stream

std::ostream* gdcm::Writer::Stream

protected

Referenced by GetStreamPtr(), and SetStream().

The documentation for this class was generated from the following file:

- gdcmWriter.h