-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransferSyntax.cpp
73 lines (62 loc) · 1.72 KB
/
TransferSyntax.cpp
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
66
67
68
69
70
71
72
73
/************************************************************************
* DICOMLIB
* Copyright 2003 Sunnybrook and Women's College Health Science Center
* Implemented by Trevor Morgan ([email protected])
*
* See LICENSE.txt for copyright and licensing info.
*************************************************************************/
#include <algorithm>
#include "TransferSyntax.hpp"
#include "UID.hpp"
#include "UIDs.hpp"
#include "Exceptions.hpp"
#include <sstream>
namespace dicom
{
TS::TS(const UID& uid):uid_(uid)
{
//make sure uid represents a known transfer syntax.
dicom::Enforce(
IMPL_VR_LE_TRANSFER_SYNTAX == uid ||
EXPL_VR_LE_TRANSFER_SYNTAX == uid ||
DEFLATED_EXPL_VR_LE_TRANSFER_SYNTAX == uid ||
EXPL_VR_BE_TRANSFER_SYNTAX == uid ||
JPEG_BASELINE_TRANSFER_SYNTAX == uid ||
JPEG_LOSSLESS_NON_HIERARCHICAL == uid ||
JPEG2000_LOSSLESS_ONLY == uid ||
JPEG2000 == uid
,"Syntax not recognised: " + uid.str());
}
UID TS::getUID() const
{
return uid_;
}
/*!
Part 5, Annex 4 (a) says we use Explicit VR, Little endian for jpeg encoded syntaxs.
*/
bool TS::isExplicitVR() const
{
return (IMPL_VR_LE_TRANSFER_SYNTAX!=uid_);
}
bool TS::isBigEndian() const
{
return (EXPL_VR_BE_TRANSFER_SYNTAX==uid_);
}
bool TS::isDeflated() const
{
return (DEFLATED_EXPL_VR_LE_TRANSFER_SYNTAX==uid_);
}
/*!
Does this transfer syntax indicate that pixel data is stored
in encapsulated encoded form, as described in Part 5 annex 4?
*/
bool TS::isEncapsulated() const
{
return (
JPEG_BASELINE_TRANSFER_SYNTAX==uid_||
JPEG_LOSSLESS_NON_HIERARCHICAL==uid_ ||
JPEG2000_LOSSLESS_ONLY==uid_ ||
JPEG2000 ==uid_
);
}
}//namespace dicom