From 4170ac178dcb4d672194d270b853ed29ccacd336 Mon Sep 17 00:00:00 2001 From: Christian Herz Date: Wed, 19 Oct 2016 15:22:25 -0400 Subject: [PATCH 1/2] BUG: fixed issues with json validation (issue #98): - prohibiting additional properties - needed to define @schema which is usually not used in json data files - removed MeasurementGroup keyword since this name is used within definitions. Measurements already defines an array of objects which hold those values. - corrected some typos regarding CodeSequences - using number instead of string for measurement values how it was defined in the schema --- apps/sr/tid1500writer.cxx | 21 ++- doc/bmmr-example.json | 19 +-- doc/common-schema.json | 2 +- doc/pm-schema.json | 2 + doc/seg-example.json | 1 + doc/seg-schema.json | 4 + doc/sr-common-schema.json | 2 + doc/sr-tid1500-ct-liver-example.json | 215 +++++++++++++-------------- doc/sr-tid1500-example.json | 81 +++++----- doc/sr-tid1500-schema.json | 10 ++ 10 files changed, 192 insertions(+), 165 deletions(-) diff --git a/apps/sr/tid1500writer.cxx b/apps/sr/tid1500writer.cxx index 0d70bbd1..1016b165 100644 --- a/apps/sr/tid1500writer.cxx +++ b/apps/sr/tid1500writer.cxx @@ -45,9 +45,17 @@ static OFLogger dcemfinfLogger = OFLog::getLogger("qiicr.apps"); #define STATIC_ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) DSRCodedEntryValue json2cev(Json::Value& j){ - return DSRCodedEntryValue(j["codeValue"].asCString(), - j["codingSchemeDesignator"].asCString(), - j["codeMeaning"].asCString()); + return DSRCodedEntryValue(j["CodeValue"].asCString(), + j["CodingSchemeDesignator"].asCString(), + j["CodeMeaning"].asCString()); +} + +template +string numberToString(T number) +{ + ostringstream sstream; + sstream << number; + return sstream.str(); } void addFileToEvidence(DSRDocument &doc, string dirStr, string fileStr){ @@ -130,7 +138,7 @@ int main(int argc, char** argv){ std::cout << "Total measurement groups: " << metaRoot["Measurements"].size() << std::endl; for(int i=0;i Date: Wed, 19 Oct 2016 19:58:00 -0400 Subject: [PATCH 2/2] ENH: added definition of DS from DICOM with regular expression as a new type in JSON - using string type instead of numerical types for preventing potential inconsistency that could be caused by missing precision definition --- apps/sr/tid1500writer.cxx | 12 +----------- doc/common-schema.json | 5 +++++ doc/sr-tid1500-ct-liver-example.json | 12 ++++++------ doc/sr-tid1500-example.json | 2 +- doc/sr-tid1500-schema.json | 2 +- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/apps/sr/tid1500writer.cxx b/apps/sr/tid1500writer.cxx index 1016b165..5a0d4b3d 100644 --- a/apps/sr/tid1500writer.cxx +++ b/apps/sr/tid1500writer.cxx @@ -50,14 +50,6 @@ DSRCodedEntryValue json2cev(Json::Value& j){ j["CodeMeaning"].asCString()); } -template -string numberToString(T number) -{ - ostringstream sstream; - sstream << number; - return sstream.str(); -} - void addFileToEvidence(DSRDocument &doc, string dirStr, string fileStr){ DcmFileFormat ff; OFString fullPath; @@ -179,9 +171,7 @@ int main(int argc, char** argv){ for(int j=0;j