comparison Framework/Toolbox/DicomStructureSet.cpp @ 738:8e31b174ab26

removing using namespace
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 May 2019 08:54:38 +0200
parents 11fa6f00e33c
children 5aa728500586
comparison
equal deleted inserted replaced
737:4d69256d2a46 738:8e31b174ab26
365 } 365 }
366 366
367 367
368 DicomStructureSet::DicomStructureSet(const OrthancPlugins::FullOrthancDataset& tags) 368 DicomStructureSet::DicomStructureSet(const OrthancPlugins::FullOrthancDataset& tags)
369 { 369 {
370 using namespace OrthancPlugins; 370 OrthancPlugins::DicomDatasetReader reader(tags);
371
372 DicomDatasetReader reader(tags);
373 371
374 size_t count, tmp; 372 size_t count, tmp;
375 if (!tags.GetSequenceSize(count, DICOM_TAG_RT_ROI_OBSERVATIONS_SEQUENCE) || 373 if (!tags.GetSequenceSize(count, DICOM_TAG_RT_ROI_OBSERVATIONS_SEQUENCE) ||
376 !tags.GetSequenceSize(tmp, DICOM_TAG_ROI_CONTOUR_SEQUENCE) || 374 !tags.GetSequenceSize(tmp, DICOM_TAG_ROI_CONTOUR_SEQUENCE) ||
377 tmp != count || 375 tmp != count ||
383 381
384 structures_.resize(count); 382 structures_.resize(count);
385 for (size_t i = 0; i < count; i++) 383 for (size_t i = 0; i < count; i++)
386 { 384 {
387 structures_[i].interpretation_ = reader.GetStringValue 385 structures_[i].interpretation_ = reader.GetStringValue
388 (DicomPath(DICOM_TAG_RT_ROI_OBSERVATIONS_SEQUENCE, i, 386 (OrthancPlugins::DicomPath(DICOM_TAG_RT_ROI_OBSERVATIONS_SEQUENCE, i,
389 DICOM_TAG_RT_ROI_INTERPRETED_TYPE), 387 DICOM_TAG_RT_ROI_INTERPRETED_TYPE),
390 "No interpretation"); 388 "No interpretation");
391 389
392 structures_[i].name_ = reader.GetStringValue 390 structures_[i].name_ = reader.GetStringValue
393 (DicomPath(DICOM_TAG_STRUCTURE_SET_ROI_SEQUENCE, i, 391 (OrthancPlugins::DicomPath(DICOM_TAG_STRUCTURE_SET_ROI_SEQUENCE, i,
394 DICOM_TAG_ROI_NAME), 392 DICOM_TAG_ROI_NAME),
395 "No interpretation"); 393 "No interpretation");
396 394
397 Vector color; 395 Vector color;
398 if (ParseVector(color, tags, DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, 396 if (ParseVector(color, tags, OrthancPlugins::DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i,
399 DICOM_TAG_ROI_DISPLAY_COLOR)) && 397 DICOM_TAG_ROI_DISPLAY_COLOR)) &&
400 color.size() == 3) 398 color.size() == 3)
401 { 399 {
402 structures_[i].red_ = ConvertColor(color[0]); 400 structures_[i].red_ = ConvertColor(color[0]);
403 structures_[i].green_ = ConvertColor(color[1]); 401 structures_[i].green_ = ConvertColor(color[1]);
404 structures_[i].blue_ = ConvertColor(color[2]); 402 structures_[i].blue_ = ConvertColor(color[2]);
409 structures_[i].green_ = 0; 407 structures_[i].green_ = 0;
410 structures_[i].blue_ = 0; 408 structures_[i].blue_ = 0;
411 } 409 }
412 410
413 size_t countSlices; 411 size_t countSlices;
414 if (!tags.GetSequenceSize(countSlices, DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, 412 if (!tags.GetSequenceSize(countSlices, OrthancPlugins::DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i,
415 DICOM_TAG_CONTOUR_SEQUENCE))) 413 DICOM_TAG_CONTOUR_SEQUENCE)))
416 { 414 {
417 countSlices = 0; 415 countSlices = 0;
418 } 416 }
419 417
420 LOG(WARNING) << "New RT structure: \"" << structures_[i].name_ 418 LOG(WARNING) << "New RT structure: \"" << structures_[i].name_
427 for (size_t j = 0; j < countSlices; j++) 425 for (size_t j = 0; j < countSlices; j++)
428 { 426 {
429 unsigned int countPoints; 427 unsigned int countPoints;
430 428
431 if (!reader.GetUnsignedIntegerValue 429 if (!reader.GetUnsignedIntegerValue
432 (countPoints, DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, 430 (countPoints, OrthancPlugins::DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i,
433 DICOM_TAG_CONTOUR_SEQUENCE, j, 431 DICOM_TAG_CONTOUR_SEQUENCE, j,
434 DICOM_TAG_NUMBER_OF_CONTOUR_POINTS))) 432 DICOM_TAG_NUMBER_OF_CONTOUR_POINTS)))
435 { 433 {
436 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); 434 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
437 } 435 }
438 436
439 //LOG(INFO) << "Parsing slice containing " << countPoints << " vertices"; 437 //LOG(INFO) << "Parsing slice containing " << countPoints << " vertices";
440 438
441 std::string type = reader.GetMandatoryStringValue 439 std::string type = reader.GetMandatoryStringValue
442 (DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, 440 (OrthancPlugins::DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i,
443 DICOM_TAG_CONTOUR_SEQUENCE, j, 441 DICOM_TAG_CONTOUR_SEQUENCE, j,
444 DICOM_TAG_CONTOUR_GEOMETRIC_TYPE)); 442 DICOM_TAG_CONTOUR_GEOMETRIC_TYPE));
445 if (type != "CLOSED_PLANAR") 443 if (type != "CLOSED_PLANAR")
446 { 444 {
447 LOG(WARNING) << "Ignoring contour with geometry type: " << type; 445 LOG(WARNING) << "Ignoring contour with geometry type: " << type;
448 continue; 446 continue;
449 } 447 }
450 448
451 size_t size; 449 size_t size;
452 if (!tags.GetSequenceSize(size, DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, 450 if (!tags.GetSequenceSize(size, OrthancPlugins::DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i,
453 DICOM_TAG_CONTOUR_SEQUENCE, j, 451 DICOM_TAG_CONTOUR_SEQUENCE, j,
454 DICOM_TAG_CONTOUR_IMAGE_SEQUENCE)) || 452 DICOM_TAG_CONTOUR_IMAGE_SEQUENCE)) ||
455 size != 1) 453 size != 1)
456 { 454 {
457 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); 455 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
458 } 456 }
459 457
460 std::string sopInstanceUid = reader.GetMandatoryStringValue 458 std::string sopInstanceUid = reader.GetMandatoryStringValue
461 (DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, 459 (OrthancPlugins::DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i,
462 DICOM_TAG_CONTOUR_SEQUENCE, j, 460 DICOM_TAG_CONTOUR_SEQUENCE, j,
463 DICOM_TAG_CONTOUR_IMAGE_SEQUENCE, 0, 461 DICOM_TAG_CONTOUR_IMAGE_SEQUENCE, 0,
464 DICOM_TAG_REFERENCED_SOP_INSTANCE_UID)); 462 DICOM_TAG_REFERENCED_SOP_INSTANCE_UID));
465 463
466 std::string slicesData = reader.GetMandatoryStringValue 464 std::string slicesData = reader.GetMandatoryStringValue
467 (DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, 465 (OrthancPlugins::DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i,
468 DICOM_TAG_CONTOUR_SEQUENCE, j, 466 DICOM_TAG_CONTOUR_SEQUENCE, j,
469 DICOM_TAG_CONTOUR_DATA)); 467 DICOM_TAG_CONTOUR_DATA));
470 468
471 Vector points; 469 Vector points;
472 if (!LinearAlgebra::ParseVector(points, slicesData) || 470 if (!LinearAlgebra::ParseVector(points, slicesData) ||
473 points.size() != 3 * countPoints) 471 points.size() != 3 * countPoints)
474 { 472 {