comparison OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp @ 5287:c04230962098 am-experimental

wip: 'dicomWeb' json format + 'include' get arguments
author Alain Mazy <am@osimis.io>
date Fri, 28 Apr 2023 10:42:27 +0200
parents 0ea402b4d901
children 7d913ee2f665
comparison
equal deleted inserted replaced
5286:28f0e38e4082 5287:c04230962098
3214 v["00191297"]["vr"] = "UL"; 3214 v["00191297"]["vr"] = "UL";
3215 DicomMap m; 3215 DicomMap m;
3216 m.FromDicomWeb(v); 3216 m.FromDicomWeb(v);
3217 } 3217 }
3218 3218
3219 3219 TEST(DicomMap, MainDicomTagsDicomWebJson)
3220 {
3221 std::unique_ptr<ParsedDicomFile> dicom;
3222
3223 {
3224 std::string source = "{"
3225 "\"0008,0005\" : {"
3226 "\"Name\" : \"SpecificCharacterSet\","
3227 "\"Type\" : \"String\","
3228 "\"Value\" : \"ISO_IR 192\""
3229 "},"
3230 "\"0008,0008\" : {"
3231 "\"Name\" : \"ImageType\","
3232 "\"Type\" : \"String\","
3233 "\"Value\" : \"DERIVED\\\\PRIMARY\\\\AXIAL\""
3234 "},"
3235 "\"0008,0016\" : {"
3236 "\"Name\" : \"SOPClassUID\","
3237 "\"Type\" : \"String\","
3238 "\"Value\" : \"1.2.840.10008.5.1.4.1.1.2\""
3239 "},"
3240 "\"0008,0018\" : {"
3241 "\"Name\" : \"SOPInstanceUID\","
3242 "\"Type\" : \"String\","
3243 "\"Value\" : \"1.2.276.0.7230010.3.1.4.1215942821.4756.1664833117.11987\""
3244 "},"
3245 "\"0018,0050\" : {"
3246 "\"Name\" : \"SliceThickness\","
3247 "\"Type\" : \"String\","
3248 "\"Value\" : \"0.19816064757161\""
3249 "},"
3250 "\"0020,0013\" : {"
3251 "\"Name\" : \"InstanceNumber\","
3252 "\"Type\" : \"String\","
3253 "\"Value\" : \"0\""
3254 "},"
3255 "\"0020,0032\" : {"
3256 "\"Name\" : \"ImagePositionPatient\","
3257 "\"Type\" : \"String\","
3258 "\"Value\" : \"-79.462419676214\\\\-79.462419676214\\\\-59.150953300125\""
3259 "},"
3260 "\"0020,0037\" : {"
3261 "\"Name\" : \"ImageOrientationPatient\","
3262 "\"Type\" : \"String\","
3263 "\"Value\" : \"1\\\\-0\\\\0\\\\-0\\\\1\\\\-0\""
3264 "},"
3265 "\"0028,0004\" : {"
3266 "\"Name\" : \"PhotometricInterpretation\","
3267 "\"Type\" : \"String\","
3268 "\"Value\" : \"MONOCHROME2\""
3269 "},"
3270 "\"0028,0010\" : {"
3271 "\"Name\" : \"Rows\","
3272 "\"Type\" : \"String\","
3273 "\"Value\" : \"803\""
3274 "},"
3275 "\"0028,0011\" : {"
3276 "\"Name\" : \"Columns\","
3277 "\"Type\" : \"String\","
3278 "\"Value\" : \"803\""
3279 "},"
3280 "\"0028,0030\" : {"
3281 "\"Name\" : \"PixelSpacing\","
3282 "\"Type\" : \"String\","
3283 "\"Value\" : \"0.19816064757161\\\\0.19816064757161\""
3284 "},"
3285 "\"0028,0100\" : {"
3286 "\"Name\" : \"BitsAllocated\","
3287 "\"Type\" : \"String\","
3288 "\"Value\" : \"16\""
3289 "},"
3290 "\"0028,0101\" : {"
3291 "\"Name\" : \"BitsStored\","
3292 "\"Type\" : \"String\","
3293 "\"Value\" : \"16\""
3294 "},"
3295 "\"0028,0103\" : {"
3296 "\"Name\" : \"PixelRepresentation\","
3297 "\"Type\" : \"String\","
3298 "\"Value\" : \"0\""
3299 "},"
3300 "\"0028,1050\" : {"
3301 "\"Name\" : \"WindowCenter\","
3302 "\"Type\" : \"String\","
3303 "\"Value\" : \"1023.96875\""
3304 "},"
3305 "\"0028,1051\" : {"
3306 "\"Name\" : \"WindowWidth\","
3307 "\"Type\" : \"String\","
3308 "\"Value\" : \"4095.9375\""
3309 "},"
3310 "\"0028,1052\" : {"
3311 "\"Name\" : \"RescaleIntercept\","
3312 "\"Type\" : \"String\","
3313 "\"Value\" : \"-1024\""
3314 "},"
3315 "\"0028,1053\" : {"
3316 "\"Name\" : \"RescaleSlope\","
3317 "\"Type\" : \"String\","
3318 "\"Value\" : \"0.0625\""
3319 "}"
3320 "}";
3321
3322 Json::Value v;
3323 Orthanc::Toolbox::ReadJson(v, source);
3324
3325 LOG(INFO) << source;
3326 LOG(INFO) << v.toStyledString();
3327 Json::Value result = Json::objectValue;
3328 DicomMap map;
3329 map.FromDicomAsJson(v, false, true);
3330
3331 // for profiling for (int i=0; i < 100; ++i)
3332 {
3333 result = Json::objectValue;
3334 FromDcmtkBridge::ToJson(result, map, Orthanc::DicomToJsonFormat_DicomWeb);
3335 }
3336
3337 ASSERT_TRUE(result.isMember("00281053"));
3338 ASSERT_EQ("0.0625", result["00281053"]["Value"].asString());
3339 }
3340 }
3220 3341
3221 3342
3222 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 3343 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
3223 3344
3224 #include "../Sources/DicomNetworking/DicomStoreUserConnection.h" 3345 #include "../Sources/DicomNetworking/DicomStoreUserConnection.h"