comparison Plugins/Engine/OrthancPlugins.cpp @ 3709:1f4910999fe7

Fix issue #168 (Plugins can't read private tags from the configuration file)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Feb 2020 13:23:11 +0100
parents 4922bdd046dd
children 1c69af37d8ae 2a170a8f1faf
comparison
equal deleted inserted replaced
3708:bc25deb40302 3709:1f4910999fe7
2920 } 2920 }
2921 2921
2922 std::string dicom; 2922 std::string dicom;
2923 2923
2924 { 2924 {
2925 // Fix issue 168 (Plugins can't read private tags from the
2926 // configuration file)
2927 // https://bitbucket.org/sjodogne/orthanc/issues/168/
2928 std::string privateCreator;
2929 {
2930 OrthancConfiguration::ReaderLock lock;
2931 privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator();
2932 }
2933
2925 std::auto_ptr<ParsedDicomFile> file 2934 std::auto_ptr<ParsedDicomFile> file
2926 (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(p.flags), 2935 (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(p.flags),
2927 "" /* TODO - private creator */)); 2936 privateCreator));
2928 2937
2929 if (p.pixelData) 2938 if (p.pixelData)
2930 { 2939 {
2931 file->EmbedImage(*reinterpret_cast<const ImageAccessor*>(p.pixelData)); 2940 file->EmbedImage(*reinterpret_cast<const ImageAccessor*>(p.pixelData));
2932 } 2941 }
3095 3104
3096 DicomTag tag(FromDcmtkBridge::ParseTag(p.name)); 3105 DicomTag tag(FromDcmtkBridge::ParseTag(p.name));
3097 DcmTagKey tag2(tag.GetGroup(), tag.GetElement()); 3106 DcmTagKey tag2(tag.GetGroup(), tag.GetElement());
3098 3107
3099 DictionaryReadLocker locker; 3108 DictionaryReadLocker locker;
3100 const DcmDictEntry* entry = locker->findEntry(tag2, NULL); 3109 const DcmDictEntry* entry = NULL;
3110
3111 if (tag.IsPrivate())
3112 {
3113 // Fix issue 168 (Plugins can't read private tags from the
3114 // configuration file)
3115 // https://bitbucket.org/sjodogne/orthanc/issues/168/
3116 std::string privateCreator;
3117 {
3118 OrthancConfiguration::ReaderLock lock;
3119 privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator();
3120 }
3121
3122 entry = locker->findEntry(tag2, privateCreator.c_str());
3123 }
3124 else
3125 {
3126 entry = locker->findEntry(tag2, NULL);
3127 }
3101 3128
3102 if (entry == NULL) 3129 if (entry == NULL)
3103 { 3130 {
3104 throw OrthancException(ErrorCode_UnknownDicomTag); 3131 throw OrthancException(ErrorCode_UnknownDicomTag);
3105 } 3132 }