gdcmFileMetaInformation.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMFILEMETAINFORMATION_H
#define GDCMFILEMETAINFORMATION_H
#include "gdcmPreamble.h"
#include "gdcmDataSet.h"
#include "gdcmDataElement.h"
#include "gdcmMediaStorage.h"
#include "gdcmTransferSyntax.h"
#include "gdcmExplicitDataElement.h"
namespace gdcm_ns
{
class GDCM_EXPORT FileMetaInformation : public DataSet
{
public:
// FIXME: TransferSyntax::TS_END -> TransferSyntax::ImplicitDataElement
FileMetaInformation();
~FileMetaInformation();
friend std::ostream &operator<<(std::ostream &_os, const FileMetaInformation &_val);
bool IsValid() const { return true; }
TransferSyntax::NegociatedType GetMetaInformationTS() const { return MetaInformationTS; }
void SetDataSetTransferSyntax(const TransferSyntax &ts);
const TransferSyntax &GetDataSetTransferSyntax() const { return DataSetTS; }
MediaStorage GetMediaStorage() const;
std::string GetMediaStorageAsString() const;
// FIXME: no virtual function means: duplicate code...
void Insert(const DataElement& de) {
if( de.GetTag().GetGroup() == 0x0002 )
{
InsertDataElement( de );
}
else
{
gdcmErrorMacro( "Cannot add element with group != 0x0002 in the file meta header: " << de );
}
}
void Replace(const DataElement& de) {
Remove(de.GetTag());
Insert(de);
}
std::istream &Read(std::istream &is);
std::istream &ReadCompat(std::istream &is);
std::ostream &Write(std::ostream &os) const;
void FillFromDataSet(DataSet const &ds);
const Preamble &GetPreamble() const { return P; }
Preamble &GetPreamble() { return P; }
void SetPreamble(const Preamble &p) { P = p; }
static void SetImplementationClassUID(const char * imp);
static void AppendImplementationClassUID(const char * imp);
static const char *GetImplementationClassUID();
static void SetImplementationVersionName(const char * version);
static const char *GetImplementationVersionName();
static void SetSourceApplicationEntityTitle(const char * title);
static const char *GetSourceApplicationEntityTitle();
FileMetaInformation(FileMetaInformation const& fmi) = default;
FileMetaInformation& operator=(const FileMetaInformation& fmi) = default;
VL GetFullLength() const {
return P.GetLength() + DataSet::GetLength<ExplicitDataElement>();
}
protected:
void ComputeDataSetTransferSyntax(); // FIXME
template <typename TSwap>
std::istream &ReadCompatInternal(std::istream &is);
void Default();
void ComputeDataSetMediaStorageSOPClass();
TransferSyntax DataSetTS;
TransferSyntax::NegociatedType MetaInformationTS;
MediaStorage::MSType DataSetMS;
protected:
static const char * GetFileMetaInformationVersion();
static const char * GetGDCMImplementationClassUID();
static const char * GetGDCMImplementationVersionName();
static const char * GetGDCMSourceApplicationEntityTitle();
private:
Preamble P;
//static stuff:
static const char GDCM_FILE_META_INFORMATION_VERSION[];
static const char GDCM_IMPLEMENTATION_CLASS_UID[];
static const char GDCM_IMPLEMENTATION_VERSION_NAME[];
static const char GDCM_SOURCE_APPLICATION_ENTITY_TITLE[];
static std::string ImplementationClassUID;
static std::string ImplementationVersionName;
static std::string SourceApplicationEntityTitle;
};
//-----------------------------------------------------------------------------
inline std::ostream& operator<<(std::ostream &os, const FileMetaInformation &val)
{
os << val.GetPreamble() << std::endl;
val.Print( os );
return os;
}
} // end namespace gdcm_ns
#endif //GDCMFILEMETAINFORMATION_H
gdcm::DataElement
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
gdcm::DataElement::GetTag
const Tag & GetTag() const
Get Tag.
Definition gdcmDataElement.h:67
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements).
Definition gdcmDataSet.h:56
gdcm::DataSet::InsertDataElement
void InsertDataElement(const DataElement &de)
Definition gdcmDataSet.h:273
gdcm::DataSet::Remove
SizeType Remove(const Tag &tag)
Completely remove a dataelement from the dataset.
Definition gdcmDataSet.h:172
gdcm::DataSet::Print
void Print(std::ostream &os, std::string const &indent="") const
Definition gdcmDataSet.h:79
gdcm::DataSet::GetLength
VL GetLength() const
Definition gdcmDataSet.h:110
gdcm::FileMetaInformation::GetGDCMSourceApplicationEntityTitle
static const char * GetGDCMSourceApplicationEntityTitle()
gdcm::FileMetaInformation::GetImplementationClassUID
static const char * GetImplementationClassUID()
gdcm::FileMetaInformation::FileMetaInformation
FileMetaInformation()
gdcm::FileMetaInformation::SetPreamble
void SetPreamble(const Preamble &p)
Definition gdcmFileMetaInformation.h:86
gdcm::FileMetaInformation::GetPreamble
Preamble & GetPreamble()
Definition gdcmFileMetaInformation.h:85
gdcm::FileMetaInformation::DataSetMS
MediaStorage::MSType DataSetMS
Definition gdcmFileMetaInformation.h:115
gdcm::FileMetaInformation::FileMetaInformation
FileMetaInformation(FileMetaInformation const &fmi)=default
gdcm::FileMetaInformation::Insert
void Insert(const DataElement &de)
Definition gdcmFileMetaInformation.h:58
gdcm::FileMetaInformation::operator<<
friend std::ostream & operator<<(std::ostream &_os, const FileMetaInformation &_val)
Definition gdcmFileMetaInformation.h:136
gdcm::FileMetaInformation::FillFromDataSet
void FillFromDataSet(DataSet const &ds)
Construct a FileMetaInformation from an already existing DataSet:
gdcm::FileMetaInformation::GetDataSetTransferSyntax
const TransferSyntax & GetDataSetTransferSyntax() const
Definition gdcmFileMetaInformation.h:53
gdcm::FileMetaInformation::GetImplementationVersionName
static const char * GetImplementationVersionName()
gdcm::FileMetaInformation::SetDataSetTransferSyntax
void SetDataSetTransferSyntax(const TransferSyntax &ts)
gdcm::FileMetaInformation::MetaInformationTS
TransferSyntax::NegociatedType MetaInformationTS
Definition gdcmFileMetaInformation.h:114
gdcm::FileMetaInformation::GetMediaStorageAsString
std::string GetMediaStorageAsString() const
gdcm::FileMetaInformation::IsValid
bool IsValid() const
Definition gdcmFileMetaInformation.h:49
gdcm::FileMetaInformation::SetImplementationClassUID
static void SetImplementationClassUID(const char *imp)
Override the GDCM default values:
gdcm::FileMetaInformation::GetGDCMImplementationVersionName
static const char * GetGDCMImplementationVersionName()
gdcm::FileMetaInformation::GetMetaInformationTS
TransferSyntax::NegociatedType GetMetaInformationTS() const
Definition gdcmFileMetaInformation.h:51
gdcm::FileMetaInformation::ComputeDataSetMediaStorageSOPClass
void ComputeDataSetMediaStorageSOPClass()
gdcm::FileMetaInformation::~FileMetaInformation
~FileMetaInformation()
gdcm::FileMetaInformation::operator=
FileMetaInformation & operator=(const FileMetaInformation &fmi)=default
gdcm::FileMetaInformation::SetSourceApplicationEntityTitle
static void SetSourceApplicationEntityTitle(const char *title)
gdcm::FileMetaInformation::DataSetTS
TransferSyntax DataSetTS
Definition gdcmFileMetaInformation.h:113
gdcm::FileMetaInformation::Write
std::ostream & Write(std::ostream &os) const
Write.
gdcm::FileMetaInformation::ReadCompat
std::istream & ReadCompat(std::istream &is)
gdcm::FileMetaInformation::ComputeDataSetTransferSyntax
void ComputeDataSetTransferSyntax()
gdcm::FileMetaInformation::GetGDCMImplementationClassUID
static const char * GetGDCMImplementationClassUID()
gdcm::FileMetaInformation::ReadCompatInternal
std::istream & ReadCompatInternal(std::istream &is)
gdcm::FileMetaInformation::GetSourceApplicationEntityTitle
static const char * GetSourceApplicationEntityTitle()
gdcm::FileMetaInformation::Default
void Default()
gdcm::FileMetaInformation::GetFileMetaInformationVersion
static const char * GetFileMetaInformationVersion()
gdcm::FileMetaInformation::Read
std::istream & Read(std::istream &is)
Read.
gdcm::FileMetaInformation::SetImplementationVersionName
static void SetImplementationVersionName(const char *version)
gdcm::FileMetaInformation::GetFullLength
VL GetFullLength() const
Definition gdcmFileMetaInformation.h:100
gdcm::FileMetaInformation::Replace
void Replace(const DataElement &de)
Definition gdcmFileMetaInformation.h:68
gdcm::FileMetaInformation::GetPreamble
const Preamble & GetPreamble() const
Get Preamble.
Definition gdcmFileMetaInformation.h:84
gdcm::FileMetaInformation::GetMediaStorage
MediaStorage GetMediaStorage() const
gdcm::FileMetaInformation::AppendImplementationClassUID
static void AppendImplementationClassUID(const char *imp)
gdcm::MediaStorage
MediaStorage.
Definition gdcmMediaStorage.h:44
gdcm::MediaStorage::MSType
MSType
Definition gdcmMediaStorage.h:46
gdcm::Preamble
DICOM Preamble (Part 10).
Definition gdcmPreamble.h:27
gdcm::Tag::GetGroup
uint16_t GetGroup() const
Returns the 'Group number' of the given Tag.
Definition gdcmTag.h:55
gdcm::TransferSyntax
Class to manipulate Transfer Syntax.
Definition gdcmTransferSyntax.h:40
gdcm::TransferSyntax::NegociatedType
NegociatedType
Definition gdcmTransferSyntax.h:42
gdcm::VL
Value Length.
Definition gdcmVL.h:30
gdcm::VL::GetLength
VL GetLength() const
Definition gdcmVL.h:68
gdcmDataElement.h
gdcmDataSet.h
gdcmExplicitDataElement.h
gdcmMediaStorage.h
gdcmPreamble.h
gdcmErrorMacro
#define gdcmErrorMacro(msg)
Error this is pretty bad, more than just warning It could mean lost of data, something not handle....
Definition gdcmTrace.h:165
gdcmTransferSyntax.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34