comparison OrthancServer/DicomInstanceToStore.cpp @ 1822:9ed9458aa44f

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Nov 2015 10:06:50 +0100
parents bdfae6e17d23
children 0ef4e6e66b56
comparison
equal deleted inserted replaced
1821:580951a33583 1822:9ed9458aa44f
61 61
62 if (!buffer_.HasContent()) 62 if (!buffer_.HasContent())
63 { 63 {
64 if (!parsed_.HasContent()) 64 if (!parsed_.HasContent())
65 { 65 {
66 throw OrthancException(ErrorCode_NotImplemented); 66 if (!summary_.HasContent())
67 }
68 else
69 {
70 // Serialize the parsed DICOM file
71 buffer_.Allocate();
72 if (!FromDcmtkBridge::SaveToMemoryBuffer(buffer_.GetContent(),
73 *parsed_.GetContent().GetDcmtkObject().getDataset()))
74 { 67 {
75 LOG(ERROR) << "Unable to serialize a DICOM file to a memory buffer"; 68 throw OrthancException(ErrorCode_NotImplemented);
76 throw OrthancException(ErrorCode_InternalError);
77 } 69 }
70 else
71 {
72 parsed_.TakeOwnership(new ParsedDicomFile(summary_.GetConstContent()));
73 }
74 }
75
76 // Serialize the parsed DICOM file
77 buffer_.Allocate();
78 if (!FromDcmtkBridge::SaveToMemoryBuffer(buffer_.GetContent(),
79 *parsed_.GetContent().GetDcmtkObject().getDataset()))
80 {
81 LOG(ERROR) << "Unable to serialize a DICOM file to a memory buffer";
82 throw OrthancException(ErrorCode_InternalError);
78 } 83 }
79 } 84 }
80 85
81 if (summary_.HasContent() && 86 if (summary_.HasContent() &&
82 json_.HasContent()) 87 json_.HasContent())