MeVisLab Toolbox Reference
mlDicomTreeAccess.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_DICOM_TREE_ACCESS_H
14#define ML_DICOM_TREE_ACCESS_H
15
17
18#include <mlUtilsSystem.h>
20
22
27
31 const std::string& tagName);
32
36bool getTagIdByATString (const std::string& atString, DCMTree::TagId& tagId);
37
40bool MLIsATString (const std::string& supposedATString);
41
42
44
45
47#define ML_DICOM_TREE_IMAGE_PROPERTY_EXTENSION_CLASS_NAME \
48 ml::DicomTreeImagePropertyExtension::getClassTypeId()->getName()
49
50
51
53#define ML_GET_DICOM_TREE_CONST(constTreePtr, medicalImageProperties) \
54 const RuntimeType* runtimeType = DicomTreeImagePropertyExtension::getClassTypeId(); \
55 const ImagePropertyExtensionContainer& propContainer = medicalImageProperties->getConstImagePropertyContainer(); \
56 const DicomTreeImagePropertyExtension* propExtension = static_cast<const DicomTreeImagePropertyExtension*>( \
57 propContainer.getFirstEntryOfType(runtimeType)); \
58 constTreePtr = getDicomTreeFromImagePropertyExtension(propExtension);
59
60
61
64#define ML_GET_DICOM_TREE_FROM_FIELD_CONST(constTreePtr, mlField) { \
65 \
66 const ml::ImagePropertyExtension* extension = NULL; \
67 \
68 MLErrorCode errorCode = MLImageGetFirstImagePropertyExtensionByType(mlField, \
69 ML_DICOM_TREE_IMAGE_PROPERTY_EXTENSION_CLASS_NAME, \
70 reinterpret_cast<void**>( \
71 const_cast<ml::ImagePropertyExtension**>(&extension))); \
72 if (errorCode){ \
73 std::cerr << "Failed to get dicom image property extension (" \
74 << MLGetErrorCodeDescription(errorCode) << ")" << std::endl; \
75 } else if(extension != NULL) { \
76 constTreePtr = ml::getDicomTreeFromImagePropertyExtension(extension); \
77 } \
78}
79
80
85#define ML_GET_DICOM_TAG_BY_NAME_CONST(constTagPtr, constTreePtr, name) \
86 if (constTreePtr) { \
87 try { \
88 constTagPtr = treePtr->getTag(tagName); \
89 } catch (DCMTree::Exception&) { } \
90 } else if (constTagPtr) { \
91 constTagPtr = DCMTree::Const_TagPtr(); \
92 }
93
94
95#endif // __mlDicomTreeAccess_H
#define MLDICOM_TREE_IMAGE_PROPERTY_EXTENSION_EXPORT
Global and OS specific declarations for the MLDicomTreeImagePropertyExtension project.
Class to wrap a tag-id.
Base class from which one can derive own image properties.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
boost::shared_ptr< const Tag > Const_TagPtr
Definition DCMTree_Lib.h:63
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:73
MLDICOM_TREE_IMAGE_PROPERTY_EXTENSION_EXPORT bool MLIsATString(const std::string &supposedATString)
Checks if the given string is a well-formed AT string.
MLDICOM_TREE_IMAGE_PROPERTY_EXTENSION_EXPORT bool getTagIdByATString(const std::string &atString, DCMTree::TagId &tagId)
Gets the tag id for (group,element) string (AT format).
MLDICOM_TREE_IMAGE_PROPERTY_EXTENSION_EXPORT DCMTree::Const_TagPtr getDicomTagByName(const ImagePropertyExtension *imagePropertyExtensionPtr, const std::string &tagName)
Returns the tag with the given name from the property extension. If it is not found,...
MLDICOM_TREE_IMAGE_PROPERTY_EXTENSION_EXPORT DCMTree::Const_TreePtr getDicomTreeFromImagePropertyExtension(const ImagePropertyExtension *dicomTreeImagePropertyExtensionPtr)
Casts the ImagePropertyExtension pointer into a DicomTreeImagePropertyExtension pointer and returns t...