comparison OrthancServer/QueryRetrieveHandler.cpp @ 3370:872bd3b6ec72

"/modalities/{id}/query": New argument "Normalize"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 14 May 2019 10:30:43 +0200
parents d9eb978a1039
children 94f4a18a79cc
comparison
equal deleted inserted replaced
3369:20b38a533254 3370:872bd3b6ec72
60 FromDcmtkBridge::ExecuteToDicom(query, call); 60 FromDcmtkBridge::ExecuteToDicom(query, call);
61 } 61 }
62 } 62 }
63 63
64 64
65 static void FixQueryBuiltin(DicomMap& query,
66 ModalityManufacturer manufacturer)
67 {
68 /**
69 * Introduce patches for specific manufacturers below.
70 **/
71
72 switch (manufacturer)
73 {
74 default:
75 break;
76 }
77 }
78
79
80 void QueryRetrieveHandler::Invalidate() 65 void QueryRetrieveHandler::Invalidate()
81 { 66 {
82 done_ = false; 67 done_ = false;
83 answers_.Clear(); 68 answers_.Clear();
84 } 69 }
89 if (!done_) 74 if (!done_)
90 { 75 {
91 // Firstly, fix the content of the query for specific manufacturers 76 // Firstly, fix the content of the query for specific manufacturers
92 DicomMap fixed; 77 DicomMap fixed;
93 fixed.Assign(query_); 78 fixed.Assign(query_);
94 FixQueryBuiltin(fixed, modality_.GetManufacturer());
95 79
96 // Secondly, possibly fix the query with the user-provider Lua callback 80 // Secondly, possibly fix the query with the user-provider Lua callback
97 FixQueryLua(fixed, context_, modality_.GetApplicationEntityTitle()); 81 FixQueryLua(fixed, context_, modality_.GetApplicationEntityTitle());
98 82
99 { 83 {
100 DicomUserConnection connection(localAet_, modality_); 84 DicomUserConnection connection(localAet_, modality_);
101 connection.Open(); 85 connection.Open();
102 connection.Find(answers_, level_, fixed); 86 connection.Find(answers_, level_, fixed, findNormalized_);
103 } 87 }
104 88
105 done_ = true; 89 done_ = true;
106 } 90 }
107 } 91 }
110 QueryRetrieveHandler::QueryRetrieveHandler(ServerContext& context) : 94 QueryRetrieveHandler::QueryRetrieveHandler(ServerContext& context) :
111 context_(context), 95 context_(context),
112 localAet_(context.GetDefaultLocalApplicationEntityTitle()), 96 localAet_(context.GetDefaultLocalApplicationEntityTitle()),
113 done_(false), 97 done_(false),
114 level_(ResourceType_Study), 98 level_(ResourceType_Study),
115 answers_(false) 99 answers_(false),
100 findNormalized_(true)
116 { 101 {
117 } 102 }
118 103
119 104
120 void QueryRetrieveHandler::SetModality(const std::string& symbolicName) 105 void QueryRetrieveHandler::SetModality(const std::string& symbolicName)
173 size_t i) 158 size_t i)
174 { 159 {
175 Run(); 160 Run();
176 answers_.GetAnswer(i).ExtractDicomSummary(target); 161 answers_.GetAnswer(i).ExtractDicomSummary(target);
177 } 162 }
163
164
165 void QueryRetrieveHandler::SetFindNormalized(bool normalized)
166 {
167 Invalidate();
168 findNormalized_ = normalized;
169 }
178 } 170 }