28 namespace DicomToMLTools {
45 bool isFromRootIn =
false)
51 isFromRoot = isFromRootIn;
61 inline void setPos(
unsigned int z,
unsigned int t,
unsigned int u)
76 bool doFrameExistsAtPosCheck =
true,
77 bool frameExistsAtPosIn =
false)
87 bool frameExistsAtPos = doFrameExistsAtPosCheck ? (smfTree.
tagTree() ? true :
false) : frameExistsAtPosIn;
91 const unsigned int zExt = gridExtent.size() > 0u ? gridExtent[0] : 1u;
92 const unsigned int tExt = gridExtent.size() > 1u ? gridExtent[1] : 1u;
93 const unsigned int uExt = gridExtent.size() > 2u ? gridExtent[2] : 1u;
110 if (gridDimension > 0){
112 if (localPos[0] >= zExt){
113 if (gridDimension < 2){
115 frameExistsAtPos =
false;
119 if (localPos[1] < tExt) {
120 localPos[0] = zExt-1;
125 if (gridDimension > 1){
127 if (localPos[1] >= tExt){
128 if (gridDimension < 3){
130 frameExistsAtPos =
false;
134 if (localPos[2] < uExt) {
135 localPos[1] = uExt-1;
140 if (localPos[2] >= uExt){
142 frameExistsAtPos =
false;
151 if (frameExistsAtPos) {
160 if(!tagPtr && smfTree.
tagTree()){
161 tagPtr = smfTree.
tagTree()->getTag(tagId);
162 if (tagPtr){ isFromRoot =
true; }
181 bool isFromRoot =
false;
186 template <
typename VALUE_TYPE>
199 frameSpecificTag(frameSpecificTagIn),
201 valueIsValid(valueIsValidIn){}
204 template <
typename GET_VALUE_FUNC_TYPE>
206 const unsigned int z,
const unsigned int t,
const unsigned int u,
208 const GET_VALUE_FUNC_TYPE & getTagValueFunc)
210 frameSpecificTag.setPos(z,t,u);
211 frameSpecificTag.tagId = rawTagId;
213 frameSpecificTag.setUpFrameSpecificTagInfos(smfTree,
true,
false);
216 if (frameSpecificTag.tagPtr){
218 value = getTagValueFunc(frameSpecificTag.tagPtr);
232 bool valueIsValid =
false;
239 const unsigned int z,
const unsigned int t,
const unsigned int u,
246 return tagPtr ? tagPtr->toDouble() : 0.;
256 const unsigned int z,
const unsigned int t,
const unsigned int u,
263 return tagPtr ? tagPtr->toString() : std::string();
266 return std::string();
Exception class for DCMTree.
Support for structured multi-frame (SMF) DICOM objects.
const IndexVector & getGridExtent() const
Returns the extents of the logical grid (i.e., the size in each dimension).
Const_TreePtr tagTree() const
Returns a const pointer to the contained tag tree.
Const_TagPtr tagForGridPosition(TagId tagId, IndexVector gridPosition) const
Returns a pointer to the specified tag for a given grid position.
boost::uint32_t getGridDimension() const
Returns the dimension of the logical grid (i.e., the number of dimensions).
std::vector< unsigned int > IndexVector
Index vector type, ordered as (z, t, u1, u2, ...)
boost::shared_ptr< const Tag > Const_TagPtr