Odil
A C++11 library for the DICOM standard
Loading...
Searching...
No Matches
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.
 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.
void write_data_set (std::shared_ptr< DataSet const > data_set) const
 Write a data set.
void write_tag (Tag const &tag) const
 Write a tag.
void write_element (Element const &element) const
 Write an element (VR, VL and value).

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.
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.
static std::size_t size (odil::Tag const &, bool explicit_vr, ItemEncoding item_encoding, bool use_group_length)
static std::size_t size (odil::VR vr, odil::Value const &, bool explicit_vr, ItemEncoding item_encoding, bool use_group_length)
static std::size_t size (odil::Element const &, bool explicit_vr, ItemEncoding item_encoding, bool use_group_length)
static std::size_t size (odil::DataSet const &, bool explicit_vr, ItemEncoding item_encoding, bool use_group_length)
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).

Public Attributes

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

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

◆ size() [1/4]

std::size_t odil::Writer::size ( odil::DataSet const & ,
bool explicit_vr,
ItemEncoding item_encoding,
bool use_group_length )
static

◆ size() [2/4]

std::size_t odil::Writer::size ( odil::Element const & ,
bool explicit_vr,
ItemEncoding item_encoding,
bool use_group_length )
static

◆ size() [3/4]

std::size_t odil::Writer::size ( odil::Tag const & ,
bool explicit_vr,
ItemEncoding item_encoding,
bool use_group_length )
static

◆ size() [4/4]

std::size_t odil::Writer::size ( odil::VR vr,
odil::Value const & ,
bool explicit_vr,
ItemEncoding item_encoding,
bool use_group_length )
static

◆ write_binary()

template<typename T>
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()

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()

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:
  • /build/reproducible-path/odil-0.13.0/src/odil/Writer.h