Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 1950:533ff46e944b
return a single raw frame from DICOM videos
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 Apr 2016 11:07:02 +0200 |
parents | cda5b0ab4ce5 |
children | f11e5d200c04 |
comparison
equal
deleted
inserted
replaced
1949:d90f737f2dde | 1950:533ff46e944b |
---|---|
234 } | 234 } |
235 | 235 |
236 | 236 |
237 static void ListFrames(RestApiGetCall& call) | 237 static void ListFrames(RestApiGetCall& call) |
238 { | 238 { |
239 Json::Value instance; | 239 std::string publicId = call.GetUriComponent("id", ""); |
240 if (OrthancRestApi::GetIndex(call).LookupResource(instance, call.GetUriComponent("id", ""), ResourceType_Instance)) | 240 |
241 { | 241 unsigned int numberOfFrames; |
242 unsigned int numberOfFrames = 1; | 242 |
243 | 243 { |
244 try | 244 ServerContext::DicomCacheLocker locker(OrthancRestApi::GetContext(call), publicId); |
245 { | 245 numberOfFrames = locker.GetDicom().GetFramesCount(); |
246 Json::Value tmp = instance["MainDicomTags"]["NumberOfFrames"]; | 246 } |
247 numberOfFrames = boost::lexical_cast<unsigned int>(tmp.asString()); | 247 |
248 } | 248 Json::Value result = Json::arrayValue; |
249 catch (...) | 249 for (unsigned int i = 0; i < numberOfFrames; i++) |
250 { | 250 { |
251 } | 251 result.append(i); |
252 | 252 } |
253 Json::Value result = Json::arrayValue; | 253 |
254 for (unsigned int i = 0; i < numberOfFrames; i++) | 254 call.GetOutput().AnswerJson(result); |
255 { | |
256 result.append(i); | |
257 } | |
258 | |
259 call.GetOutput().AnswerJson(result); | |
260 } | |
261 } | 255 } |
262 | 256 |
263 | 257 |
264 namespace | 258 namespace |
265 { | 259 { |