1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
/// MetaHeader.cpp
/**
*/
#include "MetaHeader.h"
using namespace jcs;
bool
MetaHeader::IsMetaHeaderElement(DicomElementInstance de)
{
bool retval = false;
if (de.tag.group == 0x0002) {
retval = true;
}
return retval;
}
///
/** Gets the transfer syntax for the main part of the file.
*/
wxUint8
MetaHeader::GetMainTransferSyntaxCode()
{
wxUint8 retval = LEI_CODE; // Default transfer syntax for DICOM.
std::vector<DicomElementInstance>::iterator it = mhElements.begin();
std::vector<DicomElementInstance>::iterator it_end = mhElements.end();
for (; it < it_end; ++it) {
if (it->tag == DT_MFTRANSFERSYNTAX) {
if (it->myValue->first().Cmp(wxString::FromAscii(LEE_UID))) {
retval = LEE_CODE;
}
if (it->myValue->first().Cmp(wxString::FromAscii(LEI_UID))) {
retval = LEI_CODE;
}
if (it->myValue->first().Cmp(wxString::FromAscii(BEE_UID))) {
retval = BEE_CODE;
}
break;
}
}
return retval;
}
std::istream &
jcs::operator>> (std::istream &in, MetaHeader &mh)
{
DicomElementInstance de;
de.transferSyntaxCode = LEE_CODE;
std::streampos save_position;
while (true) {
save_position = in.tellg();
in >> de;
if (mh.IsMetaHeaderElement(de)) {
mh.mhElements.push_back(de);
}
else {
in.seekg(save_position);
break;
}
}
return in;
}
|