Mercurial > hg > orthanc
comparison OrthancServer/FromDcmtkBridge.cpp @ 2218:3eefb84ac0bd
dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 13 Dec 2016 10:27:20 +0100 |
parents | 9a8fab016145 |
children | 3dd44baebc36 |
comparison
equal
deleted
inserted
replaced
2217:4f39ab2cb453 | 2218:3eefb84ac0bd |
---|---|
1973 else | 1973 else |
1974 { | 1974 { |
1975 return false; | 1975 return false; |
1976 } | 1976 } |
1977 } | 1977 } |
1978 | |
1979 | |
1980 void FromDcmtkBridge::ExecuteToDicom(DicomMap& target, | |
1981 LuaFunctionCall& call) | |
1982 { | |
1983 Json::Value output; | |
1984 call.ExecuteToJson(output, true /* keep strings */); | |
1985 | |
1986 target.Clear(); | |
1987 | |
1988 if (output.type() == Json::arrayValue && | |
1989 output.size() == 0) | |
1990 { | |
1991 // This case happens for empty tables | |
1992 return; | |
1993 } | |
1994 | |
1995 if (output.type() != Json::objectValue) | |
1996 { | |
1997 LOG(ERROR) << "Lua: IncomingFindRequestFilter must return a table"; | |
1998 throw OrthancException(ErrorCode_LuaBadOutput); | |
1999 } | |
2000 | |
2001 Json::Value::Members members = output.getMemberNames(); | |
2002 | |
2003 for (size_t i = 0; i < members.size(); i++) | |
2004 { | |
2005 if (output[members[i]].type() != Json::stringValue) | |
2006 { | |
2007 LOG(ERROR) << "Lua: IncomingFindRequestFilter must return a table mapping names of DICOM tags to strings"; | |
2008 throw OrthancException(ErrorCode_LuaBadOutput); | |
2009 } | |
2010 | |
2011 DicomTag tag(ParseTag(members[i])); | |
2012 target.SetValue(tag, output[members[i]].asString(), false); | |
2013 } | |
2014 } | |
1978 } | 2015 } |