comparison OrthancFramework/Sources/DicomFormat/DicomStreamReader.h @ 4493:b57ca702a430

DicomStreamReader::LookupPixelDataOffset()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Feb 2021 11:42:25 +0100
parents d9473bd5ed43
children 39192eb9b43d
comparison
equal deleted inserted replaced
4492:0b2484663233 4493:b57ca702a430
56 56
57 // Return "false" to stop processing 57 // Return "false" to stop processing
58 virtual bool VisitDatasetTag(const DicomTag& tag, 58 virtual bool VisitDatasetTag(const DicomTag& tag,
59 const ValueRepresentation& vr, 59 const ValueRepresentation& vr,
60 const std::string& value, 60 const std::string& value,
61 bool isLittleEndian) = 0; 61 bool isLittleEndian,
62 uint64_t fileOffset) = 0;
62 }; 63 };
63 64
64 private: 65 private:
66 class PixelDataVisitor;
67
65 enum State 68 enum State
66 { 69 {
67 State_Preamble, 70 State_Preamble,
68 State_MetaHeader, 71 State_MetaHeader,
69 State_DatasetTag, 72 State_DatasetTag,
77 StreamBlockReader reader_; 80 StreamBlockReader reader_;
78 State state_; 81 State state_;
79 DicomTransferSyntax transferSyntax_; 82 DicomTransferSyntax transferSyntax_;
80 DicomTag danglingTag_; // Current root-level tag 83 DicomTag danglingTag_; // Current root-level tag
81 ValueRepresentation danglingVR_; 84 ValueRepresentation danglingVR_;
85 uint64_t danglingOffset_;
82 unsigned int sequenceDepth_; 86 unsigned int sequenceDepth_;
83 87
84 bool IsLittleEndian() const; 88 bool IsLittleEndian() const;
85 89
86 void HandlePreamble(IVisitor& visitor, 90 void HandlePreamble(IVisitor& visitor,
92 void HandleDatasetTag(const std::string& block, 96 void HandleDatasetTag(const std::string& block,
93 const DicomTag& untilTag); 97 const DicomTag& untilTag);
94 98
95 void HandleDatasetExplicitLength(uint32_t length); 99 void HandleDatasetExplicitLength(uint32_t length);
96 100
97 void HandleDatasetExplicitLength(const std::string& block); 101 void HandleDatasetExplicitLength(IVisitor& visitor,
102 const std::string& block);
98 103
99 void HandleSequenceExplicitLength(const std::string& block); 104 void HandleSequenceExplicitLength(const std::string& block);
100 105
101 void HandleSequenceExplicitValue(); 106 void HandleSequenceExplicitValue();
102 107
119 void Consume(IVisitor& visitor); 124 void Consume(IVisitor& visitor);
120 125
121 bool IsDone() const; 126 bool IsDone() const;
122 127
123 uint64_t GetProcessedBytes() const; 128 uint64_t GetProcessedBytes() const;
129
130 static bool LookupPixelDataOffset(uint64_t& offset,
131 const std::string& dicom);
124 }; 132 };
125 } 133 }