From 99ef3b7e6caff2fc0581e0dce25937195fd691a5 Mon Sep 17 00:00:00 2001 From: Andrey Fedorov Date: Thu, 24 Aug 2017 11:14:42 -0400 Subject: [PATCH] BUG: skip measurements that cause issues on write This came up with "nan" generated by PET measurements plugin. Related issue: https://github.com/QIICR/QuantitativeReporting/issues/186 --- apps/sr/tid1500writer.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/sr/tid1500writer.cxx b/apps/sr/tid1500writer.cxx index 0ec1e286..f2b00dc7 100644 --- a/apps/sr/tid1500writer.cxx +++ b/apps/sr/tid1500writer.cxx @@ -205,7 +205,10 @@ int main(int argc, char** argv){ // TODO - add measurement method and derivation! const CMR_TID1411_in_TID1500::MeasurementValue numValue(measurement["value"].asCString(), json2cev(measurement["units"])); - CHECK_COND(measurements.addMeasurement(json2cev(measurement["quantity"]), numValue)); + if(!measurements.addMeasurement(json2cev(measurement["quantity"]), numValue).good()){ + std::cerr << "WARNING: Skipping measurement with the value of " << measurement["value"].asCString() << std::endl; + continue; + } if(measurement.isMember("derivationModifier")){ CHECK_COND(measurements.getMeasurement().setDerivation(json2cev(measurement["derivationModifier"])));