comparison Core/DicomParsing/FromDcmtkBridge.cpp @ 3195:880e4161c312

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Feb 2019 20:44:26 +0100
parents 47ef29168698
children 7724ed267b5c
comparison
equal deleted inserted replaced
3194:47ef29168698 3195:880e4161c312
2251 { 2251 {
2252 visitor.VisitBinary(parentTags, parentIndexes, tag, vr, data, element.getLength()); 2252 visitor.VisitBinary(parentTags, parentIndexes, tag, vr, data, element.getLength());
2253 } 2253 }
2254 else 2254 else
2255 { 2255 {
2256 visitor.VisitUnknown(parentTags, parentIndexes, tag, vr); 2256 visitor.VisitNotSupported(parentTags, parentIndexes, tag, vr);
2257 } 2257 }
2258 2258
2259 break; 2259 break;
2260 } 2260 }
2261 2261
2403 DicomTag t(f.getGroup(), f.getElement()); 2403 DicomTag t(f.getGroup(), f.getElement());
2404 values.push_back(t); 2404 values.push_back(t);
2405 } 2405 }
2406 } 2406 }
2407 2407
2408 visitor.VisitAttributes(parentTags, parentIndexes, tag, vr, values); 2408 assert(vr == ValueRepresentation_AttributeTag);
2409 visitor.VisitAttributes(parentTags, parentIndexes, tag, values);
2409 break; 2410 break;
2410 } 2411 }
2411 2412
2412 2413
2413 /** 2414 /**
2435 case EVR_dirRecord: // used internally for DICOMDIR records 2436 case EVR_dirRecord: // used internally for DICOMDIR records
2436 case EVR_pixelSQ: // used internally for pixel sequences in a compressed image 2437 case EVR_pixelSQ: // used internally for pixel sequences in a compressed image
2437 case EVR_pixelItem: // used internally for pixel items in a compressed image 2438 case EVR_pixelItem: // used internally for pixel items in a compressed image
2438 case EVR_PixelData: // used internally for uncompressed pixeld data 2439 case EVR_PixelData: // used internally for uncompressed pixeld data
2439 case EVR_OverlayData: // used internally for overlay data 2440 case EVR_OverlayData: // used internally for overlay data
2440 visitor.VisitUnknown(parentTags, parentIndexes, tag, vr); 2441 visitor.VisitNotSupported(parentTags, parentIndexes, tag, vr);
2441 return; 2442 return;
2442 2443
2443 2444
2444 /** 2445 /**
2445 * Default case. 2446 * Default case.
2479 // "All subclasses of DcmElement except for DcmSequenceOfItems 2480 // "All subclasses of DcmElement except for DcmSequenceOfItems
2480 // are leaf nodes, while DcmSequenceOfItems, DcmItem, DcmDataset 2481 // are leaf nodes, while DcmSequenceOfItems, DcmItem, DcmDataset
2481 // etc. are not." The following dynamic_cast is thus OK. 2482 // etc. are not." The following dynamic_cast is thus OK.
2482 DcmSequenceOfItems& sequence = dynamic_cast<DcmSequenceOfItems&>(element); 2483 DcmSequenceOfItems& sequence = dynamic_cast<DcmSequenceOfItems&>(element);
2483 2484
2484 std::vector<DicomTag> tags = parentTags; 2485 if (sequence.card() == 0)
2485 std::vector<size_t> indexes = parentIndexes; 2486 {
2486 tags.push_back(tag); 2487 visitor.VisitEmptySequence(parentTags, parentIndexes, tag);
2487 indexes.push_back(0); 2488 }
2488 2489 else
2489 for (unsigned long i = 0; i < sequence.card(); i++) 2490 {
2490 { 2491 std::vector<DicomTag> tags = parentTags;
2491 indexes.back() = static_cast<size_t>(i); 2492 std::vector<size_t> indexes = parentIndexes;
2492 DcmItem* child = sequence.getItem(i); 2493 tags.push_back(tag);
2493 ApplyVisitorToDataset(*child, visitor, tags, indexes, encoding); 2494 indexes.push_back(0);
2495
2496 for (unsigned long i = 0; i < sequence.card(); i++)
2497 {
2498 indexes.back() = static_cast<size_t>(i);
2499 DcmItem* child = sequence.getItem(i);
2500 ApplyVisitorToDataset(*child, visitor, tags, indexes, encoding);
2501 }
2494 } 2502 }
2495 } 2503 }
2496 } 2504 }
2497 2505
2498 2506