comparison Framework/Oracle/ParseDicomFromWadoCommand.cpp @ 1484:121d01aa328e

SeriesThumbnailsLoader working on raw dicom files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Jun 2020 17:46:40 +0200
parents 30deba7bc8e2
children
comparison
equal deleted inserted replaced
1483:6abd819aa534 1484:121d01aa328e
23 23
24 #include <OrthancException.h> 24 #include <OrthancException.h>
25 25
26 namespace OrthancStone 26 namespace OrthancStone
27 { 27 {
28 ParseDicomFromWadoCommand::ParseDicomFromWadoCommand(const std::string& sopInstanceUid, 28 ParseDicomFromWadoCommand::ParseDicomFromWadoCommand(const DicomSource& source,
29 const std::string& sopInstanceUid,
29 IOracleCommand* restCommand) : 30 IOracleCommand* restCommand) :
31 source_(source),
30 sopInstanceUid_(sopInstanceUid), 32 sopInstanceUid_(sopInstanceUid),
31 restCommand_(restCommand) 33 restCommand_(restCommand)
32 { 34 {
33 if (restCommand == NULL) 35 if (restCommand == NULL)
34 { 36 {
44 46
45 47
46 IOracleCommand* ParseDicomFromWadoCommand::Clone() const 48 IOracleCommand* ParseDicomFromWadoCommand::Clone() const
47 { 49 {
48 assert(restCommand_.get() != NULL); 50 assert(restCommand_.get() != NULL);
49 return new ParseDicomFromWadoCommand(sopInstanceUid_, restCommand_->Clone()); 51 return new ParseDicomFromWadoCommand(source_, sopInstanceUid_, restCommand_->Clone());
50 } 52 }
51 53
52 54
53 const IOracleCommand& ParseDicomFromWadoCommand::GetRestCommand() const 55 const IOracleCommand& ParseDicomFromWadoCommand::GetRestCommand() const
54 { 56 {
55 assert(restCommand_.get() != NULL); 57 assert(restCommand_.get() != NULL);
56 return *restCommand_; 58 return *restCommand_;
57 } 59 }
60
61
62 ParseDicomFromWadoCommand* ParseDicomFromWadoCommand::Create(
63 const DicomSource& source,
64 const std::string& studyInstanceUid,
65 const std::string& seriesInstanceUid,
66 const std::string& sopInstanceUid,
67 bool transcode,
68 Orthanc::DicomTransferSyntax transferSyntax,
69 Orthanc::IDynamicObject* payload)
70 {
71 std::unique_ptr<Orthanc::IDynamicObject> protection(payload);
72
73 const std::string uri = ("/studies/" + studyInstanceUid +
74 "/series/" + seriesInstanceUid +
75 "/instances/" + sopInstanceUid);
76
77 std::string s;
78 if (transcode)
79 {
80 s = Orthanc::GetTransferSyntaxUid(transferSyntax);
81 }
82 else
83 {
84 s = "*"; // No transcoding, keep source transfer syntax
85 }
86
87 std::map<std::string, std::string> arguments, headers;
88 headers["Accept"] = ("multipart/related; type=\"application/dicom\"; transfer-syntax=" + s);
89
90 std::unique_ptr<IOracleCommand> rest(
91 source.CreateDicomWebCommand(uri, arguments, headers, NULL));
92
93 std::unique_ptr<ParseDicomFromWadoCommand> command(
94 new ParseDicomFromWadoCommand(source, sopInstanceUid, rest.release()));
95
96 if (protection.get() != NULL)
97 {
98 command->AcquirePayload(protection.release());
99 }
100
101 return command.release();
102 }
58 } 103 }