Skip to content

Commit

Permalink
excluding failed conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
knopkem committed Sep 14, 2020
1 parent 8a2b437 commit 40a75b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
12 changes: 8 additions & 4 deletions examples/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ addon.findScu(JSON.stringify(
"port": "5678"
},
"tags" : [
{
"key": "00200012",
"value": "",
},
{
"key": "0020000E",
"value": "1.3.46.670589.5.2.10.2156913941.892665339.860724",
Expand All @@ -115,6 +111,14 @@ addon.findScu(JSON.stringify(
"key": "00080052",
"value": "IMAGE",
},
{
"key": "00200012",
"value": "",
},
{
"key": "00200013",
"value": "",
},
],
"verbose": true
}
Expand Down
17 changes: 9 additions & 8 deletions src/FindAsyncWorker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ void FindScuCallback::callback(T_DIMSE_C_FindRQ *request, int &responseCount, T_
{
OFString value;
// TODO: use correct method depending on VR type
responseIdentifiers->findAndGetOFStringArray(element.xtag, value);
ns::DicomElement cp;
cp.xtag = element.xtag;
cp.value = to_utf8(std::string(value.c_str()));
responseItem.push_back(cp);
OFCondition status = responseIdentifiers->findAndGetOFStringArray(element.xtag, value);
if (status.good()) {
ns::DicomElement cp;
cp.xtag = element.xtag;
cp.value = to_utf8(std::string(value.c_str()));
responseItem.push_back(cp);
}
}
m_responseContainer->push_back(responseItem);
}
Expand Down Expand Up @@ -222,7 +224,6 @@ void FindAsyncWorker::Execute(const ExecutionProgress &progress)
json v = json::object();
for (const ns::DicomElement &elm : obj)
{

std::string value = elm.value;
std::string keyName = int_to_hex(elm.xtag.getGroup()) + int_to_hex(elm.xtag.getElement());
DcmTag t(elm.xtag);
Expand All @@ -232,7 +233,7 @@ void FindAsyncWorker::Execute(const ExecutionProgress &progress)
jsonValue = json::array({json{{"Alphabetic", value}}});
}
else if (vr == "DS" || vr == "IS" || vr == "SL" || vr == "SS" || vr == "UL" || vr == "US") {
if (value.length == 0) {
if (value.length() == 0) {
jsonValue = json::array({});
}
else {
Expand All @@ -250,7 +251,7 @@ void FindAsyncWorker::Execute(const ExecutionProgress &progress)
}
}
else if (vr == "FL" || vr == "FD") {
if (value.length == 0) {
if (value.length() == 0) {
jsonValue = json::array({});
}
else {
Expand Down

0 comments on commit 40a75b3

Please sign in to comment.