comparison Applications/Samples/SingleFrameEditorApplication.h @ 377:8eb4fe74000f

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 Nov 2018 16:18:27 +0100
parents 70256a53ff21
children d20d75f20c5d
comparison
equal deleted inserted replaced
376:70256a53ff21 377:8eb4fe74000f
1162 } 1162 }
1163 1163
1164 1164
1165 void OnTagsReceived(const OrthancApiClient::BinaryResponseReadyMessage& message) 1165 void OnTagsReceived(const OrthancApiClient::BinaryResponseReadyMessage& message)
1166 { 1166 {
1167 size_t index = dynamic_cast<Orthanc::SingleValueObject<size_t>*>(message.Payload.get())->GetValue(); 1167 size_t index = dynamic_cast<const Orthanc::SingleValueObject<size_t>&>(message.GetPayload()).GetValue();
1168 1168
1169 LOG(INFO) << "JSON received: " << message.Uri.c_str() 1169 LOG(INFO) << "JSON received: " << message.GetUri().c_str()
1170 << " (" << message.AnswerSize << " bytes) for bitmap " << index; 1170 << " (" << message.GetAnswerSize() << " bytes) for bitmap " << index;
1171 1171
1172 Bitmaps::iterator bitmap = bitmaps_.find(index); 1172 Bitmaps::iterator bitmap = bitmaps_.find(index);
1173 if (bitmap != bitmaps_.end()) 1173 if (bitmap != bitmaps_.end())
1174 { 1174 {
1175 assert(bitmap->second != NULL); 1175 assert(bitmap->second != NULL);
1176 1176
1177 OrthancPlugins::FullOrthancDataset dicom(message.Answer, message.AnswerSize); 1177 OrthancPlugins::FullOrthancDataset dicom(message.GetAnswer(), message.GetAnswerSize());
1178 dynamic_cast<DicomBitmap*>(bitmap->second)->SetDicomTags(dicom); 1178 dynamic_cast<DicomBitmap*>(bitmap->second)->SetDicomTags(dicom);
1179 1179
1180 float c, w; 1180 float c, w;
1181 if (!hasWindowing_ && 1181 if (!hasWindowing_ &&
1182 bitmap->second->GetDefaultWindowing(c, w)) 1182 bitmap->second->GetDefaultWindowing(c, w))
1191 } 1191 }
1192 1192
1193 1193
1194 void OnFrameReceived(const OrthancApiClient::BinaryResponseReadyMessage& message) 1194 void OnFrameReceived(const OrthancApiClient::BinaryResponseReadyMessage& message)
1195 { 1195 {
1196 size_t index = dynamic_cast<Orthanc::SingleValueObject<size_t>*>(message.Payload.get())->GetValue(); 1196 size_t index = dynamic_cast<const Orthanc::SingleValueObject<size_t>&>(message.GetPayload()).GetValue();
1197 1197
1198 LOG(INFO) << "DICOM frame received: " << message.Uri.c_str() 1198 LOG(INFO) << "DICOM frame received: " << message.GetUri().c_str()
1199 << " (" << message.AnswerSize << " bytes) for bitmap " << index; 1199 << " (" << message.GetAnswerSize() << " bytes) for bitmap " << index;
1200 1200
1201 Bitmaps::iterator bitmap = bitmaps_.find(index); 1201 Bitmaps::iterator bitmap = bitmaps_.find(index);
1202 if (bitmap != bitmaps_.end()) 1202 if (bitmap != bitmaps_.end())
1203 { 1203 {
1204 assert(bitmap->second != NULL); 1204 assert(bitmap->second != NULL);
1205 1205
1206 std::string content; 1206 std::string content;
1207 if (message.AnswerSize > 0) 1207 if (message.GetAnswerSize() > 0)
1208 { 1208 {
1209 content.assign(reinterpret_cast<const char*>(message.Answer), message.AnswerSize); 1209 content.assign(reinterpret_cast<const char*>(message.GetAnswer()), message.GetAnswerSize());
1210 } 1210 }
1211 1211
1212 std::auto_ptr<Orthanc::PamReader> reader(new Orthanc::PamReader); 1212 std::auto_ptr<Orthanc::PamReader> reader(new Orthanc::PamReader);
1213 reader->ReadFromMemory(content); 1213 reader->ReadFromMemory(content);
1214 dynamic_cast<DicomBitmap*>(bitmap->second)->SetSourceImage(reader.release()); 1214 dynamic_cast<DicomBitmap*>(bitmap->second)->SetSourceImage(reader.release());
2821 2821
2822 2822
2823 void OnDicomExported(const OrthancApiClient::JsonResponseReadyMessage& message) 2823 void OnDicomExported(const OrthancApiClient::JsonResponseReadyMessage& message)
2824 { 2824 {
2825 LOG(WARNING) << "DICOM export was successful:" 2825 LOG(WARNING) << "DICOM export was successful:"
2826 << message.Response.toStyledString(); 2826 << message.GetJson().toStyledString();
2827 } 2827 }
2828 }; 2828 };
2829 2829
2830 2830
2831 2831