Odil
A C++11 library for the DICOM standard
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
odil::Writer Class Reference

Write DICOM objects to a stream. More...

#include <Writer.h>

Public Types

enum class  ItemEncoding { ExplicitLength , UndefinedLength }
 Encodings of sequence items. More...
 

Public Member Functions

 Writer (std::ostream &stream, ByteOrdering byte_ordering, bool explicit_vr, ItemEncoding item_encoding=ItemEncoding::ExplicitLength, bool use_group_length=false)
 Build a writer. More...
 
 Writer (std::ostream &stream, std::string const &transfer_syntax, ItemEncoding item_encoding=ItemEncoding::ExplicitLength, bool use_group_length=false)
 Build a writer, derive byte ordering and explicit-ness of VR from transfer syntax. More...
 
void write_data_set (std::shared_ptr< DataSet const > data_set) const
 Write a data set. More...
 
void write_tag (Tag const &tag) const
 Write a tag. More...
 
void write_element (Element const &element) const
 Write an element (VR, VL and value). More...
 

Static Public Member Functions

template<typename T >
static void write_binary (T const &value, std::ostream &stream, ByteOrdering byte_ordering)
 Write binary data to an stream encoded with the given endianness, ensure stream is still good. More...
 
static void write_encapsulated_pixel_data (Value::Binary const &value, std::ostream &stream, ByteOrdering byte_ordering, bool explicit_vr)
 Write pixel data in encapsulated form. More...
 
static void write_file (std::shared_ptr< DataSet const > data_set, std::ostream &stream, std::shared_ptr< DataSet const > meta_information={}, std::string const &transfer_syntax=registry::ExplicitVRLittleEndian, ItemEncoding item_encoding=ItemEncoding::ExplicitLength, bool use_group_length=false)
 Write a file (meta-information and data set). More...
 

Public Attributes

std::ostream & stream
 Output stream. More...
 
ByteOrdering byte_ordering
 Endianness. More...
 
bool explicit_vr
 Explicit-ness of the Value Representations. More...
 
ItemEncoding item_encoding
 Encoding of sequence items. More...
 
bool use_group_length
 Presence of group length elements. More...
 

Detailed Description

Write DICOM objects to a stream.

Member Enumeration Documentation

◆ ItemEncoding

enum class odil::Writer::ItemEncoding
strong

Encodings of sequence items.

Enumerator
ExplicitLength 
UndefinedLength 

Constructor & Destructor Documentation

◆ Writer() [1/2]

odil::Writer::Writer ( std::ostream &  stream,
ByteOrdering  byte_ordering,
bool  explicit_vr,
ItemEncoding  item_encoding = ItemEncoding::ExplicitLength,
bool  use_group_length = false 
)

Build a writer.

◆ Writer() [2/2]

odil::Writer::Writer ( std::ostream &  stream,
std::string const &  transfer_syntax,
ItemEncoding  item_encoding = ItemEncoding::ExplicitLength,
bool  use_group_length = false 
)

Build a writer, derive byte ordering and explicit-ness of VR from transfer syntax.

Member Function Documentation

◆ write_binary()

template<typename T >
static void odil::Writer::write_binary ( T const &  value,
std::ostream &  stream,
ByteOrdering  byte_ordering 
)
static

Write binary data to an stream encoded with the given endianness, ensure stream is still good.

◆ write_data_set()

void odil::Writer::write_data_set ( std::shared_ptr< DataSet const >  data_set) const

Write a data set.

◆ write_element()

void odil::Writer::write_element ( Element const &  element) const

Write an element (VR, VL and value).

◆ write_encapsulated_pixel_data()

static void odil::Writer::write_encapsulated_pixel_data ( Value::Binary const &  value,
std::ostream &  stream,
ByteOrdering  byte_ordering,
bool  explicit_vr 
)
static

Write pixel data in encapsulated form.

◆ write_file()

static void odil::Writer::write_file ( std::shared_ptr< DataSet const >  data_set,
std::ostream &  stream,
std::shared_ptr< DataSet const >  meta_information = {},
std::string const &  transfer_syntax = registry::ExplicitVRLittleEndian,
ItemEncoding  item_encoding = ItemEncoding::ExplicitLength,
bool  use_group_length = false 
)
static

Write a file (meta-information and data set).

◆ write_tag()

void odil::Writer::write_tag ( Tag const &  tag) const

Write a tag.

Member Data Documentation

◆ byte_ordering

ByteOrdering odil::Writer::byte_ordering

Endianness.

◆ explicit_vr

bool odil::Writer::explicit_vr

Explicit-ness of the Value Representations.

◆ item_encoding

ItemEncoding odil::Writer::item_encoding

Encoding of sequence items.

◆ stream

std::ostream& odil::Writer::stream

Output stream.

◆ use_group_length

bool odil::Writer::use_group_length

Presence of group length elements.


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