MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00004 00009 // Grants access to the DCMTree inside the MLDicomImagePropertyExtension. 00010 //---------------------------------------------------------------------------------- 00011 00012 #ifndef __mlDicomTreeAccess_H 00013 #define __mlDicomTreeAccess_H 00014 00015 #include <mlUtilsSystem.h> 00016 #include <mlDicomTreeImagePropertyExtension.h> 00017 00018 ML_UTILS_START_NAMESPACE 00019 00022 MLDICOM_TREE_IMAGE_PROPERTY_EXTENSION_EXPORT 00023 DCMTree::Const_TreePtr getDicomTreeFromImagePropertyExtension(const ImagePropertyExtension* dicomTreeImagePropertyExtensionPtr); 00024 00026 MLDICOM_TREE_IMAGE_PROPERTY_EXTENSION_EXPORT 00027 DCMTree::Const_TagPtr getDicomTagByName(const ImagePropertyExtension* imagePropertyExtensionPtr, 00028 const std::string& tagName); 00029 00032 MLDICOM_TREE_IMAGE_PROPERTY_EXTENSION_EXPORT 00033 bool getTagIdByATString (const std::string& atString, DCMTree::TagId& tagId); 00034 00036 MLDICOM_TREE_IMAGE_PROPERTY_EXTENSION_EXPORT 00037 bool MLIsATString (const std::string& supposedATString); 00038 00039 00040 ML_UTILS_END_NAMESPACE 00041 00042 00044 #define ML_DICOM_TREE_IMAGE_PROPERTY_EXTENSION_CLASS_NAME \ 00045 ml::DicomTreeImagePropertyExtension::getClassTypeId()->getName() 00046 00047 00048 00050 #define ML_GET_DICOM_TREE_CONST(constTreePtr, medicalImageProperties) \ 00051 const RuntimeType* runtimeType = DicomTreeImagePropertyExtension::getClassTypeId(); \ 00052 const ImagePropertyExtensionContainer& propContainer = medicalImageProperties->getConstImagePropertyContainer(); \ 00053 const DicomTreeImagePropertyExtension* propExtension = static_cast<const DicomTreeImagePropertyExtension*>( \ 00054 propContainer.getFirstEntryOfType(runtimeType)); \ 00055 constTreePtr = getDicomTreeFromImagePropertyExtension(propExtension); 00056 00057 00058 00061 #define ML_GET_DICOM_TREE_FROM_FIELD_CONST(constTreePtr, mlField) { \ 00062 \ 00063 const ml::ImagePropertyExtension* extension = NULL; \ 00064 \ 00065 MLErrorCode errorCode = MLImageGetFirstImagePropertyExtensionByType(mlField, \ 00066 ML_DICOM_TREE_IMAGE_PROPERTY_EXTENSION_CLASS_NAME, \ 00067 reinterpret_cast<void**>( \ 00068 const_cast<ml::ImagePropertyExtension**>(&extension))); \ 00069 if (errorCode){ \ 00070 std::cerr << "Failed to get dicom image property extension (" \ 00071 << MLGetErrorCodeDescription(errorCode) << ")" << std::endl; \ 00072 } else if(extension != NULL) { \ 00073 constTreePtr = ml::getDicomTreeFromImagePropertyExtension(extension); \ 00074 } \ 00075 } 00076 00077 00082 #define ML_GET_DICOM_TAG_BY_NAME_CONST(constTagPtr, constTreePtr, name) \ 00083 if (constTreePtr) { \ 00084 try { \ 00085 constTagPtr = treePtr->getTag(tagName); \ 00086 } catch (DCMTree::Exception&) { } \ 00087 } else if (constTagPtr) { \ 00088 constTagPtr = DCMTree::Const_TagPtr(); \ 00089 } 00090 00091 00092 #endif // __mlDicomTreeAccess_H