comparison OrthancServer/OrthancFindRequestHandler.cpp @ 1851:d364926389e0

OrthancFindRequestHandler::FilterQueryTag
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 01 Dec 2015 14:53:52 +0100
parents 30e97a1f4093
children b7d3d3b182cf
comparison
equal deleted inserted replaced
1850:68854412c7bc 1851:d364926389e0
86 answers.Add(result); 86 answers.Add(result);
87 } 87 }
88 } 88 }
89 89
90 90
91
92 bool OrthancFindRequestHandler::FilterQueryTag(std::string& value /* can be modified */,
93 ResourceType level,
94 const DicomTag& tag,
95 ModalityManufacturer manufacturer)
96 {
97 return true;
98 }
99
100
91 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers, 101 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers,
92 const DicomMap& input, 102 const DicomMap& input,
93 const std::string& remoteIp, 103 const std::string& remoteIp,
94 const std::string& remoteAet, 104 const std::string& remoteAet,
95 const std::string& calledAet) 105 const std::string& calledAet)
103 if (!Configuration::LookupDicomModalityUsingAETitle(modality, remoteAet)) 113 if (!Configuration::LookupDicomModalityUsingAETitle(modality, remoteAet))
104 { 114 {
105 throw OrthancException(ErrorCode_UnknownModality); 115 throw OrthancException(ErrorCode_UnknownModality);
106 } 116 }
107 117
108 // ModalityManufacturer manufacturer = modality.GetManufacturer();
109
110 bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false); 118 bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false);
111 119
112 120
113 /** 121 /**
114 * Retrieve the query level. 122 * Retrieve the query level.
117 const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL); 125 const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL);
118 if (levelTmp == NULL || 126 if (levelTmp == NULL ||
119 levelTmp->IsNull() || 127 levelTmp->IsNull() ||
120 levelTmp->IsBinary()) 128 levelTmp->IsBinary())
121 { 129 {
130 LOG(ERROR) << "C-FIND request without the tag 0008,0052 (QueryRetrieveLevel)";
122 throw OrthancException(ErrorCode_BadRequest); 131 throw OrthancException(ErrorCode_BadRequest);
123 } 132 }
124 133
125 ResourceType level = StringToResourceType(levelTmp->GetContent().c_str()); 134 ResourceType level = StringToResourceType(levelTmp->GetContent().c_str());
126 135
169 { 178 {
170 // An empty string corresponds to a "*" wildcard constraint, so we ignore it 179 // An empty string corresponds to a "*" wildcard constraint, so we ignore it
171 continue; 180 continue;
172 } 181 }
173 182
174 ValueRepresentation vr = FromDcmtkBridge::GetValueRepresentation(tag); 183 if (FilterQueryTag(value, level, tag, modality.GetManufacturer()))
175 184 {
176 // DICOM specifies that searches must be case sensitive, except 185 ValueRepresentation vr = FromDcmtkBridge::GetValueRepresentation(tag);
177 // for tags with a PN value representation 186
178 bool sensitive = true; 187 // DICOM specifies that searches must be case sensitive, except
179 if (vr == ValueRepresentation_PatientName) 188 // for tags with a PN value representation
180 { 189 bool sensitive = true;
181 sensitive = caseSensitivePN; 190 if (vr == ValueRepresentation_PatientName)
182 } 191 {
183 192 sensitive = caseSensitivePN;
184 finder.AddDicomConstraint(tag, value, sensitive); 193 }
194
195 finder.AddDicomConstraint(tag, value, sensitive);
196 }
197 else
198 {
199 LOG(INFO) << "Because of a patch for the manufacturer of the remote modality, "
200 << "ignoring constraint on tag (" << tag.Format() << ") " << FromDcmtkBridge::GetName(tag);
201 }
185 } 202 }
186 203
187 204
188 /** 205 /**
189 * Run the query. 206 * Run the query.