vega
Public Member Functions | List of all members
vega::dicom::File Class Reference

A class which is used to read/build a DICOM file. More...

#include <vega/dicom/file.h>

Public Member Functions

 File (const std::string &file_name, bool allow_any_explicit_vr=false)
 Reads in existing file with the given file_name. More...
 
 File (std::shared_ptr< std::istream > input, bool allow_any_explicit_vr=false)
 Reads in existing file from a user supplied input stream input. More...
 
 File (const SOPClass &sop_class)
 Builds a blank DICOM file. More...
 
 File (const SOPClass &sop_class, const UID &media_storage_instance_uid)
 Builds a blank DICOM file. More...
 
const std::shared_ptr< FileMeta > & file_meta () const
 
const std::shared_ptr< DataSet > & data_set () const
 
void write (const std::string &filename) const
 
void write (std::shared_ptr< std::ostream > os) const
 

Detailed Description

A class which is used to read/build a DICOM file.

This is the main I/O class for reading and writing of DICOM files. It has constructors that are used for reading in existing DICOM files into an internal DataSet, and also constructors for building a blank DICOM file.

Constructor & Destructor Documentation

◆ File() [1/4]

vega::dicom::File::File ( const std::string &  file_name,
bool  allow_any_explicit_vr = false 
)

Reads in existing file with the given file_name.

Parameters
file_namethe name of the file to be read in.
allow_any_explicit_vrwill skip checking the dictionary to see if any element's VR is valid if the DICOM file has explicit VR.

◆ File() [2/4]

vega::dicom::File::File ( std::shared_ptr< std::istream >  input,
bool  allow_any_explicit_vr = false 
)

Reads in existing file from a user supplied input stream input.

Parameters
inputis a pointer to the input stream to read from. This allows reading in of DICOM files that are stored in both file streams and string streams (ostream).
allow_any_explicit_vrwill skip checking the dictionary to see if any element's VR is valid if the DICOM file has explicit VR.

◆ File() [3/4]

vega::dicom::File::File ( const SOPClass sop_class)

Builds a blank DICOM file.

This constructor will automatically populate the FileMeta with the appropriate tags, and will generate a random SOP instance UID.

Parameters
sop_classis the SOPClass that defines the type of DICOM file to build.

◆ File() [4/4]

vega::dicom::File::File ( const SOPClass sop_class,
const UID media_storage_instance_uid 
)

Builds a blank DICOM file.

This constructor will automatically populate the FileMeta with the appropriate tags, and will set the media storage SOP instance UID to the user supplied value media_storage_instance_uid.

Parameters
sop_classis the SOPClass that defines the type of DICOM file to build.
media_storage_instance_uidis the media storage SOP instance UID to be included in the FileMeta (with tag (0x0002,0x0003)).

Member Function Documentation

◆ data_set()

const std::shared_ptr<DataSet>& vega::dicom::File::data_set ( ) const
Returns
a pointer to the internal DataSet object that is the root of the DICOM file, containing all the DataElements in the body of the DICOM file (not in the FileMeta).

◆ file_meta()

const std::shared_ptr<FileMeta>& vega::dicom::File::file_meta ( ) const
Returns
a pointer to the internal FileMeta object.

◆ write() [1/2]

void vega::dicom::File::write ( const std::string &  filename) const

Writes this DICOM file to the given filename.

◆ write() [2/2]

void vega::dicom::File::write ( std::shared_ptr< std::ostream >  os) const

Writes this DICOM file to the given output stream os.

Parameters
osis the output stream to write the file to (can be std::ofstream to write to file, or std::sstream to write to a string).

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