comparison Framework/Loaders/OrthancMultiframeVolumeLoader.cpp @ 1298:8a0a62189f46

replacing std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Mar 2020 16:31:30 +0100
parents 86400fa16091
children f4a06ad1580b
comparison
equal deleted inserted replaced
1296:86400fa16091 1298:8a0a62189f46
27 namespace OrthancStone 27 namespace OrthancStone
28 { 28 {
29 class OrthancMultiframeVolumeLoader::LoadRTDoseGeometry : public LoaderStateMachine::State 29 class OrthancMultiframeVolumeLoader::LoadRTDoseGeometry : public LoaderStateMachine::State
30 { 30 {
31 private: 31 private:
32 std::auto_ptr<Orthanc::DicomMap> dicom_; 32 std::unique_ptr<Orthanc::DicomMap> dicom_;
33 33
34 public: 34 public:
35 LoadRTDoseGeometry(OrthancMultiframeVolumeLoader& that, 35 LoadRTDoseGeometry(OrthancMultiframeVolumeLoader& that,
36 Orthanc::DicomMap* dicom) : 36 Orthanc::DicomMap* dicom) :
37 State(that), 37 State(that),
88 if (body.type() != Json::objectValue) 88 if (body.type() != Json::objectValue)
89 { 89 {
90 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); 90 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol);
91 } 91 }
92 92
93 std::auto_ptr<Orthanc::DicomMap> dicom(new Orthanc::DicomMap); 93 std::unique_ptr<Orthanc::DicomMap> dicom(new Orthanc::DicomMap);
94 dicom->FromDicomAsJson(body); 94 dicom->FromDicomAsJson(body);
95 95
96 if (StringToSopClassUid(GetSopClassUid(*dicom)) == SopClassUid_RTDose) 96 if (StringToSopClassUid(GetSopClassUid(*dicom)) == SopClassUid_RTDose)
97 { 97 {
98 // Download the "Grid Frame Offset Vector" DICOM tag, that is 98 // Download the "Grid Frame Offset Vector" DICOM tag, that is
99 // mandatory for RT-DOSE, but is too long to be returned by default 99 // mandatory for RT-DOSE, but is too long to be returned by default
100 100
101 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); 101 std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
102 command->SetUri("/instances/" + loader.GetInstanceId() + "/content/" + 102 command->SetUri("/instances/" + loader.GetInstanceId() + "/content/" +
103 Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR.Format()); 103 Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR.Format());
104 command->SetPayload(new LoadRTDoseGeometry(loader, dicom.release())); 104 command->SetPayload(new LoadRTDoseGeometry(loader, dicom.release()));
105 105
106 Schedule(command.release()); 106 Schedule(command.release());
169 */ 169 */
170 if (transferSyntaxUid_ == "1.2.840.10008.1.2" || 170 if (transferSyntaxUid_ == "1.2.840.10008.1.2" ||
171 transferSyntaxUid_ == "1.2.840.10008.1.2.1" || 171 transferSyntaxUid_ == "1.2.840.10008.1.2.1" ||
172 transferSyntaxUid_ == "1.2.840.10008.1.2.2") 172 transferSyntaxUid_ == "1.2.840.10008.1.2.2")
173 { 173 {
174 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); 174 std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
175 command->SetHttpHeader("Accept-Encoding", "gzip"); 175 command->SetHttpHeader("Accept-Encoding", "gzip");
176 command->SetUri("/instances/" + instanceId_ + "/content/" + 176 command->SetUri("/instances/" + instanceId_ + "/content/" +
177 Orthanc::DICOM_TAG_PIXEL_DATA.Format() + "/0"); 177 Orthanc::DICOM_TAG_PIXEL_DATA.Format() + "/0");
178 command->SetPayload(new LoadUncompressedPixelData(*this)); 178 command->SetPayload(new LoadUncompressedPixelData(*this));
179 Schedule(command.release()); 179 Schedule(command.release());
561 Start(); 561 Start();
562 562
563 instanceId_ = instanceId; 563 instanceId_ = instanceId;
564 564
565 { 565 {
566 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); 566 std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
567 command->SetHttpHeader("Accept-Encoding", "gzip"); 567 command->SetHttpHeader("Accept-Encoding", "gzip");
568 command->SetUri("/instances/" + instanceId + "/tags"); 568 command->SetUri("/instances/" + instanceId + "/tags");
569 command->SetPayload(new LoadGeometry(*this)); 569 command->SetPayload(new LoadGeometry(*this));
570 Schedule(command.release()); 570 Schedule(command.release());
571 } 571 }
572 572
573 { 573 {
574 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); 574 std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
575 command->SetUri("/instances/" + instanceId + "/metadata/TransferSyntax"); 575 command->SetUri("/instances/" + instanceId + "/metadata/TransferSyntax");
576 command->SetPayload(new LoadTransferSyntax(*this)); 576 command->SetPayload(new LoadTransferSyntax(*this));
577 Schedule(command.release()); 577 Schedule(command.release());
578 } 578 }
579 } 579 }